windows-linux1

Linux, being the chameleon that it is, has the ability to support many different file systems, either natively or with “outside” help. Besides its native ext2 (and more recently ext3) file system, it can also handle DOS’ FAT16 and FAT32, Windows’ NTFS4 and NTFS5, OS/2’s HPFS, and Macintosh’s HFS, just to name a few. Given the recent push to add journaling capabilities, Linux has seen even more file systems being offered closer to home, such as Red Hat’s own ext3, Namesys’ ReiserFS, IBM’s JFS, Silicon Graphics’ XFS, etc.

How to Mount a file System?

By default, Linux will not allow users to mount drives. You need to be a Super User to mount a File System. You can become a Super User by typing the following Command in the Terminal:

HungryHacker@localhost:~$  su
Password:

After Switching to Super User mode now you have to type the following command to mount a File System

mount [-options] Device Dir

To mount a ext3 filesystem only the Device and the Directory on which you need to mount the filesystem has to be Specified.

To know the Device name type the following command in the Terminal:

HungryHacker@localhost:~$ fdisk

Disk /dev/hda: 255 heads, 63 sectors, 1245 cylinders
Units = cylinders of 16065 * 512 bytes

Device             Boot      Start      End       Blocks             Id         System
/dev/hda1        *             1             261       2096451           7          HPFS/NTFS
/dev/hda2                      262         392       1052257+        6           FAT16
/dev/hda3                      393         523       1052257+        b           Win95 FAT32
/dev/hda4                      524         1245     5799465          5            Extended
/dev/hda5                      524          536      104391            83          Linux
/dev/hda6                      537         1180     5172898+       83          Linux
/dev/hda7                      1181       1245     522081            82          Linux swap
total 24

As you can see the filesystem shown in the above example has 7 Devices. Now you can mount the filesystem using the above information.

Mount a Foreign Filesystem

Now you know how the mount command works. To mount a foreign Filesystem i.e. the filesystem which is not known to Linux like Fat16, Fat32 or NTFS of Windows you have to specify the options in the mount command.

To mount a NTFS Partition in Linux you type the following command in the terminal:

mkdir /media/winxp
mount -t ntfs /dev/hda1 /media/winxp

The first command is used to create a new directory where the new filesystem will be mounted. In the second command we have used option -t which specify the type of the device to be mounted.

In the second command ntfs is used to specify NTFS Partition. Different types for Foreign Filesystems are as follows:

msdos: This is the FAT16 file system used by DOS.
vfat: This is the FAT32 file system used by Windows 95 and Windows 98.
ext2: This is the default Linux file system.
iso9660: This is the default CD-ROM format.

So now you can mount any filesystem you want. But these mounted filesystem will remain mounted only till the PC is not shutdown. Everytime you restart the Linux the mount table entries will be deleted and you will have to type the same commands again.

Permanently mounting a Filesystem

If you want to avoid the above procedures everytime you restart you can edit the /etc/fstab file. You have to add the following line to the file:

/dev/hda1            /media/winxp             auto               noauto,user      1           1

You can add as many entries as you want and all the entries you specify will mounted automatically everytime you boot the system.