Reading and Writing to a Windows Partition

If you’re running a dual-boot system as so many of us do, you’ve probably run smack into a problem once or twice. How do I get that text file into Linux that I created and saved in Windows? You could email it to yourself, reboot quickly, and hope to catch it in your Linux inbox. You could use a really short “sneaker-net,” saving it to floppy for the next time you boot to Linux. Or, using the full flexibility of your favorite penguin distro, you could simply mount the Windows partition as another device in Linux and read it straight from the drive. That’s right – Linux will read those Windows partitions, provided you mount them properly.

FAT32 Windows partitions mount and function best. The last few kernel versions have seen the addition of NTFS support, though writing to an NTFS partition is still only experimental. With Win32, you can read *and* write files nearly as easily as in the native Windows by following a few simple steps.
I’ll show you how my machine is set up as a guide.

I’ve created a directory in Linux – /mnt/winc. This is just as it appears: my C: Windows partition. To create the directory, open a console and log in as root [“su” followed by the root password]. Change directory to /mnt [cd /mnt], and enter the command “mkdir winc” [no quotes]. You’ve created, in effect, a directory that all the Windows data on your C: partition will eventually be stuffed into.

Now mount the Windows partition with the following command:

mount -t vfat /dev/hda1 /mnt/winc.

This command simply says, “Mount the device of filesystem type Win32 [“-t vfat”] found on the first partition of the first hard drive [“/dev/hda1”] in the Linux directory /mnt/winc. If you’re creating the Linux directory for the first time, the two commands can be joined:

mkdir /mnt/winc; mount -t vfat /dev/hda1 /mnt/winc.

The “mkdir” command only needs to be used the first time.

Now you can read from and write to that Windows partition to your heart’s content. When you’re done with the Windows file, you can unmount the partition using umount /mnt/winc.

As with all else Linux, there are a few caveats. This example only illustrates mounting the C: Windows partition, which is almost always the first partition on the first hard drive. Other Windows partitions will follow a naming convention in Linux that will, at first, make no sense. Feel free to play but, as always, play prudently.