Stephen's Homepage

This page last updated in Jan 2004

Linux & Microsoft Filesystems.

I've recently had cause to read or manipulate various Microsoft filesystems, here are some notes on what I've had to do and how I achieved it.

FAT16/FAT32 NTFS DoubleSpace/DriveSpace


I routinely mount FAT paritions from hard drives, floppy disks or digital camera memory cards into the Linux filesystem hirarchy using the 'vfat' driver. I've not had any problems reading or writing to these filesystems so I think that's about as much detail as this section needs!


The Linux kernel includes an NTFS filesystem driver. No version of this driver is yet able to safely write to NTFS filesystems in anything other than very limited circumstances. Read support, however, I have generally found to work well and I routinely mount (read only) the Windows XP parition from my laptop under Linux.
I have on several occasions had to shrink NTFS paritions to increase the amount of space disk avilable for use by Linux. I have used 'qtparted', available on the Linux System Rescue CD and this as worked fine. The only issue that I have had is that on systems where the NTFS filesystem has seen significant use before the resizing attempt I have needed to defragment the drive first. Windows XP includes a defrag utility, but I have only had very limited success in using it to enable me to shrink the parition. I have had much more luck with 'Raxco PerfectDisk'. At the time of writing a free, 30 day, trial of this is available for download - which suits me fine as I only intend to use the application once!


I recently had cause to want to copy files off of a backup of a Microsoft DriveSpace compressed volume. I found that it is possible to achieve this without installing Windows and/or rebooting into Windows, although I did need to use Microsoft Software to do it.

The solution I found is to use DOSEmu to get the real Microsoft 'drvspace.bin' driver to do the work. I created dosemu hard drive images containg the necessary parts of Windows, 'drvspace.bin' and the drvspace compressed volumes. I could then use an MS-DOS prompt to copy the files off of the compressed drive. No reboots required! I've used 'drvspace' in the examples but I think this works just as well with dblspace, which is basically the same.

  1. Install 'mtools' and 'dosemu', if they are not already installed.
  2. Determine the size of hard drive image required. This will be the size of the compressed volume (which you'll find stored in a file called drvspace.001 or similar) plus a small margin.
  3. Create the DOSEmu hard drive image. We need to use a hard drive image because 'drvspace.bin' expects to be able to access it's files via fairly low-level APIs so it's not sufficient to use 'lredir' to access things stored in Linux directories. I used 'mkfatimage16 -k 400000 -f /path/to/hdimage /path/to/drvspace.001 /path/to/drvspace.002' , which gave me a hard drive image or nearly 400MB containing a copy of both of the drvspace compressed volumes I wanted to access.
  4. Create a Linux directory to use as the virtual 'C:' drive. I called mine 'drive_c'. Copy into this directory 'io.sys', 'msdos.sys', '' and 'drvspace.bin'.
  5. In the 'drive_c' directory create a 'drvspace.ini'. Mine looks something like:
    This means that drvspace.001 on drive 'D:' (our virtual hard drive) will appear as drive 'P:' under DOS, and drvspace.002 will appear as 'G:'. You can pick whatever letters you want, I choose those letters because they relate to the original use of the compressed volumes.
  6. Edit the '$_hdimage' in ~/.dosemurc (or /etc/dosemurc) to contain the paths to your 'drive_c' directory and your hard drive image. Something like: '$_hdimage = "/path/to/drive_c /path/to/hdimage"'.
  7. Type 'dosemu' or 'xdosemu'. Hopefully it'll "boot" to a DOS command prompt, which with you should be able to copy files from your compressed volumes to the 'C:' drive. Since the C drive is just a linux directory you can then get at your files from Linux.

If you want to copy files onto or off of the hard drive image after it's creation you can do so either by running dosemu or by using mtools. In the mtools case you need a line like 'drive k: file="/path/to/hdimage" MTOOLS_SKIP_CHECK=1 MTOOLS_LOWER_CASE=1 MTOOLS_NO_VFAT=1 partition=1 offset=128' in /etc/mtools.conf.

This site is best viewed with any browser Valid HTML 4.01! © Copyright 2009, Stephen White