14. Mounting DOS/Windows Partitions
Some Linux distros are not able to automatically mount (that is, recognize and access) Windows or DOS-based hard disk partitions. For a lot of us who multiboot Linux with some version of DOS or Windows, that's a real sticking point because we often want access to those drives from Linux. The good news is that Linux gives you a way to mount such drives manually, as this installment of For Linux Explorers explains.

A large number of Windows partitions use the FAT32 file system (introduced late in the Windows 95 timeframe). Among other things, FAT32 provides support for both long file names and larger partition sizes. The file system FAT32 replaced was called FAT (which stands for File Allocation Table). FAT is used by DOS and all versions of Windows prior to Windows 95B. Many newer Windows 2000 and Windows XP PCs come with Microsoft's NTFS (New Technology File System) preinstalled. That means that there are potentially three different DOS/Windows file systems that come into play. For more information about Microsoft's file systems, see the company's Windows XP Resource Kit site.

For the purposes this article, we're covering FAT/FAT32, which are collectively known as the FAT file system since the differences between them are relatively minor. And we're giving variations for NTFS where applicable.

Important: The tips in this document require the use command-line statements. For more information about how to read and execute Linux command-line prompts and commands, please check the LinuxClues.com's Linux Cheat Sheet, and in particular, Linux Prompt Basics and Linux Command-Line Nomenclature.

Manually Mounting a FAT Partition
A Linux partition typically uses the Ext2 or Ext3 file system. To manually mount a FAT partition from an Ext partition, you add an extra argument to the Mount command. Start by logging in as root. If you're not sure how to do that, read Logging in and out as Root on LinuxClues.com.

Next, make a new directory in /mnt by typing this command:

# mkdir /mnt/windows

Then you can mount the Windows partition (for this example Windows is on the hda1 drive). To do that, type:

# mount -t vfat /dev/hda1 /mnt/windows

Alternatively for NTFS partitions type:

# mount -t ntfs /dev/hda1 /mnt/windows

To double-check which file system your PC is using, as well as which partition Windows lives on type:

# fdisk -l /dev/hda

Unmounting a FAT Partition
If you manually mount a partition, it is always matter to umount it manually when you finish working on it. (If the partition is automatically mounted, you don't need to unmount it because "automount" will take care of that.) To unmount a FAT partition, type the following:

# umount /mnt/windows

(No, this isn't a typo. The command really is "umount" — unmount.)

Navigating Windows Partitions
Let's say you're browsing the Scot's Newsletter Forums using the brand new Firefox 1.0 browser for Linux. You decide you'd like to have some nice music playing in the background, but all your favorite music is stored in some Windows folder such as C:\My Music.

No problem, just start XMMS, the Linux equivalent of Nullsoft's Winamp media player. Click on the top left corner and select Play Directory. A window will open in which you can browse to /mnt/windows/My Music (or whatever folder contains your music files). IMPORTANT: When you're typing multiple-word file or directory names on the command line, such as "My Music", Linux will read the character space between My and Music as the end of the command. (Linux does not fully support character spaces in names.) To avoid this, you'll need to use what's commonly known as the "escape sign" (or Backslash). So to avoid the space problem, type:

My\ Music

Once over that hurdle, click OK and the music will start. You can listen to The Clash's "London Calling" at the same time that you read "The Tips" from Amsterdam!

Apply the same trick to access that nice background picture stored in FAT partition's My Pictures folder as your Linux desktop background. Or open a .DOC or .XLS file stored in My Documents using OpenOffice. You can also work on files, copy them to your Linux /home directory, drag and drop — basically any Windows trick in the book.

Linux gives you full access to your C, D, E, F, and so on Windows partitions, if they are FAT32 you can read and write them. With some Linux installations, NTFS-formatted partitions will be read only. That is, you can't make changes to the files on the NTFS drive from Linux. However, most modern 2.6-version Linux kernels released in the last six months do allow you to write to NTFS volumes. So if you're having trouble, check into an upgrade for your distro. (Tip: Remember that as you click on /mnt the system may need some time to automount your partitions.)

A pity this is all a one-way street; you can't even see Linux partitions from Windows, never mind mount them. Perhaps someone just prefers to pretend that Linux partitions don't exist. ;->