Home    Scripts    Utilities     Softwares     Awards     Contact Us


   Summary   Creating Partitions   File Systems   Mounting   File System Files   /etc/fstab

Mounting Filesystems

Mounting Filesystems

In order to access any filesystem under Linux, you must mount it on a certain directory. This makes the files on the filesystem appear as though they reside in the given directory, allowing you to access them. The mount command is used to do this.

mount -t type device mount-point

where type is the type name of the filesystem as given in Table 6-1, device is the physical device where the filesystem resides (the device file in /dev), and mount-point is the directory on which to mount the filesystem. You have to create the directory before issuing mount.
For example, if you have a Second Extended filesystem on the partition /dev/hda2, and wish to mount it on the directory /mnt, use the command:

mount -t ext2 /dev/hda2 /mnt

To automatically mount /dev/hda2 at each reboot add the below entry in /etc/fstab file.
/dev/hda2	/mnt	ext2	defaults	0	0

After cahnging the /etc/fstab you can use below command to reload the fstab file without rebooting.
mount -a

Mounting ISO image files

Create a directory under /mnt to place the mounted file

$ cd /mnt
$ mkdir iso
$ cd iso
$ mkdir rh73

Now mount the ISO image file to this newly created directory

$ mount -o loop -t iso9660 -r /home/image/rh73-i386.iso /mnt/iso/rh73

The "-o loop" means to mount the file as a block device. The "-t iso9660" means that the file is in the iso9660 CD-ROM format. The "-r" means to mount read-only.

Now you can:

$ cd rh73
$ ls -al

You should see a listing (ls) of the files and directories that are on the actual CD (only now they're inside the iso image file, and that's what you're currently looking at!)


Mounting the ISO image upon System Restart

Now that we've manually mounted the image, and made sure it works, an entry needs to made in the /etc/fstab file so that the image is remounted on the next system startup. It's important to make the entry AFTER the entry for the parent filesystem, e.g. /home:

$ vim /etc/fstab

After the line that looks like the following (or whichever filesystem you've placed your images):

/dev/hda8 /home ext3 defaults 1 2

Insert the following line with a text editor:

/home/image/rh73-i386.iso /mnt/iso/rh73 iso9660 ro,loop,auto 0 0



All trade marks are property of respective owners
All rights reserved 2003-2008, Openpages.info, Multan, Pakistan
          Contact Me