Auto mounting File Systems in Linux

Post date: 04-May-2010 07:20:49

Some Linux Distros (like Fedora Core 6 FC6) do not automatically mount the local file systems such as FAT/FAT32 systems that belong to the windows drive. To mount and unmount file systems you must be logged on as a root user or must have root privileges

Mounting Manually

First change to root

@localhost ~]$ su

Password: Password

root@localhost ]# mount -t Filesystem Device Directory

Mounting the file system manually is done by the mount command.

Filesystem is vfat for FAT/FAT32 File System.

Other filesystems that could be given can be found on

/etc/filesystems

The Device can be got from System > Administration > Logical Volume Management which shows local hard drives and its name as

/dev/sdaX

or

/dev/hdaX

etc.

The Directory specifies which folder must the file system be mounted into. For example if you want to mount to mnt/hddC/ the device /dev/sda8 (FAT32) , the full command is

@localhost ~]$ su

Password:

root@localhost ]# mkdir /mnt/hddC

root@localhost ]# mount -t vfat /dev/sda8 /mnt/hddC

NTFS

Install ntfs-3g module by yum install ntfs-3g

root@localhost ]# mount -t ntfs-3g /dev/sda5 /mnt/hddD -o force

Unmounting the File System

@localhost ~]$ su

Password:

root@localhost ]# umount /dev/sda8

Automatcially Mounting File Systems :

To automatically mount certain file systems, so that we do not want to do the same procedure each time the computer starts, we have to edit the

/etc/fstab

file. To edit the same you must have root access. Assuming you have root access to mount a local Filesystem, add the following line.

Device ID Mount Directory FileSystem Options

Eg:

/dev/sda8 /mnt/sda1 vfat rw,umask=0000,uid=500,gid=500 0 0

where the uid=500, gid=500 must be replaced by the proper user ids which can be got from System > Administration > Users and Groups in Fedora Core 6.

Automounting NTFS

Append

/dev/sda8 /mnt/hddD ntfs-3g default 0 0

Help me

I did this in Fedora Core 6. If any of you guys have any information on how to do the same on other linux distros , or if you have any other information, please post a comment.