place to discuss Linux
Everything about Mounting a Foreign File System in Linux

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 bytesDevice 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.
| Print article | This entry was posted by Ashik on April 4, 2009 at 5:41 pm, and is filed under Tutorials. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
about 1 year ago
Poor research. You can mount any filesystem which mount can recognize, without using the “-t XXX” option. The “-t” parameter is required only if for some reason mount can’t recognize the filesystem (corruption, unclean mounting etc).
“To mount a foreign Filesystem i.e. the filesystem which is not known to Linux like Fat16, Fat32 or NTFS of Windows” —> that is absolutely crap, because there is nothing like “not known” to Linux – it is either enabled in the kernel (builtin or modularized) or not. In case it is modularized, mount will also automatically load the proper kernel module. Really, mount can do much more than you credit it for. Just reading “man mount” would have saved you the embarrassment.
about 1 year ago
Actually, if you specify “noauto” it will literally NOT be mounted automatically.
about 1 year ago
A new user might find the ‘auto’ followed by ‘noauto’ in the /etc/fstab line to be confusing. You could have explained that ‘auto’ was an instruction to detect the filesystem type automatically, and that the ‘noauto’ was an instruction to *not* mount the device automatically at boot time, but to allow a manual mount sometime later. Then ‘user’ could have been explained as allowing a normal user to mount the device, and not require the root user to do that. Otherwise, you create more questions than you answer, particularly for a topic titled ‘Everything about…’.
about 1 year ago
After reading through this article, I just feel that I need more information on the topic. Can you share some more resources please?
about 8 months ago
hi all