[Home] [Links] [grouch]
A common question asked by people trying out Linux is, "Can I access my [DOS] [Windows] drives?" The short answer is "yes". But forget the "drives" part.
You tell the operating system what you want to access and what you want to call it and then pretty much forget about the physical location of the device. It becomes just another directory on your tree.
IDE drives are most common, so I'll use those device names in the examples. IDE device names are /dev/hda, /dev/hdb, /dev/hdc and so on. Partitions on these devices are numbered: /dev/hda1, /dev/hda2, and so on. You can get some information about these by using the command 'fdisk -l /dev/hda'. If you tried that and didn't get "command not found", you are already running as 'root' and I hope that is not a habit. 'fdisk' is a serious tool that will allow you to totally trash your system. That's why it is restricted to the root user.
You should get an output similar to:
Device Boot Start End Blocks Id System /dev/hda1 * 1 274 2071408 b Win95 FAT32 /dev/hda2 275 2637 17864280 f Win95 Ext'd LBA /dev/hda5 275 308 257008+ 6 FAT16 /dev/hda6 309 326 136048+ 82 Linux swapand so forth.
There's a lot of information in that table. For our purposes, though, we're interested in /dev/hda1 and /dev/hda5. These are the non-Linux partitions that would be drives C: and D: in Windows, in this example. That takes care of the "what you want to access" from the second paragraph above. Now we need to know "what you want to call it".
First, find out if they are already mounted on your directory tree somewhere by using the 'mount' command by itself.
Here's part of the output I get:
/dev/hda7 on / type ext2 (rw) none on /proc type proc (rw) /dev/hda9 on /var type ext2 (rw) /dev/hda12 on /home type ext2 (rw) /dev/hda11 on /usr type ext2 (rw) /dev/hda10 on /usr/local type ext2 (rw) /dev/hda8 on /home/ftp type ext2 (rw) none on /dev/pts type devpts (rw,mode=0622)Notice that each mounted device is named, its location (mountpoint) on the directory tree, the type, and the mode. I don't see any type FAT32 or FAT16 filesystems listed. There is a directory /mnt that is commonly used for mounting temporary, non-native filesystems to your directory tree. I don't see that listed above, so it must not have anything mounted on it.
The output of 'ls /mnt' may yield something like:
cdrom floppyor it may yield nothing. The first case appears to anticipate that you may want to have your CD mounted at /mnt/cdrom and any floppy disk mounted at /mnt/floppy. The second case anticipates nothing.
Let's just decide we want to access the FAT32 partition at /mnt/w95ishere and the FAT16 partition at /mnt/dossyD. (Hey, you choose your names on your computer... :). Those don't appear to exist, so we have to make them:
mkdir /mnt/w95ishere mkdir /mnt/dossyDYou can ls /mnt to confirm this. Ok, we've made sure we're not messing anything up, chosen what we want to access and what we want to call it, now it's time to tell the operating system.
mount -t vfat /dev/hda1 /mnt/w95ishere mount -t msdos /dev/hda5 /mnt/dossyDDone. ls /mnt/w95ishere or ls /mnt/dossyD to confirm.
Now you may reboot someday (it happens, and why you do it is your business). Since you probably don't repartition your hard drive(s) or change them around every time you shut off the machine, it would be nice if the thing would just deal with this and remember what you told it. It can.
Look in your /etc/fstab file. Add a couple of lines:
/dev/hda1 /mnt/w95ishere vfat defaults 1 2 /dev/hda5 /mnt/dossyD msdos defaults 1 2Use whatever editor you prefer, as long as it can save as plain text (ASCII): ae, ce, pico, joe, elvis, kedit, vim, vi, emacs, jed, gedit, hexedit, bluefish, gxedit, xemacs, or any of the multitude of GUI editors and word processors.
That's a whole lot of description for a simple process. Summary:
fdisk -l /dev/hda or fdisk -l /dev/hdb and so on until you find it.
ls / ls /mnt and so forth
mount /dev/hda# /mnt/something_convenient_to_me
/dev/hda# /mnt/something_convenient_to_me [type] defaults[options] 1 2