April 22, 2009

How to mount a directory ??

All files accessible in a Unix system are arranged in one big tree, the file hierarchy, rooted at /. These files can be spread out over several devices. The mount command serves to attach the file system found on some device to the big file tree. Conversely, the umount(8) command will detach it again.you can mount a partition with any directory ,Temporary or Permenent.

Temporary mount

>Create a directory /abc
>Now mount any partition with /abc

# mount /dev/sda4 /abc


>To check whether the partition has mounted or not, run following command

# df -Th

> Now if you wanna detach it, run the following command

# umount /abc

Note: After reboot,the partition will detach automatically


Permanent mount

>open the /etc/fstab and edit it

# vim /etc/fstab

/dev/sda4 /abc defaults ext3 0 0

> save and exit the file
> run mount command

# mount -a

>Now if you wanna detach it again, then you have to remove the above lines from the fstab file and then you have to run the following command

# umount /abc

Note: If you dont wanna detach the partition,then dont remove the entry from the file,,it will still work after reboot. Keep in mind,not to change any other entries of file,bcoz it can lead your system to unbootable condition.

No comments:

Post a Comment