To mount a device or partition, the mount command is used. We can mount devices temporary or permanently.
Lets see how to mount device temporary:
you can mount a partition with any directory ,Temporary or Permenent.
Temporary mount
The mount command provides large number of options and the common pattern for mount command is shown below.
To mount a partition,run:[root@localhost ~]# mount /dev/sda4 /abc
To mount cdrom, run:
[root@localhost ~]# mount /dev/cdrom /mnt
To check whether the partition has mounted or not, run following command
[root@localhost ~]# df -Th
if you wanna detach it, run the following command
[root@localhost ~]# umount /abc
Note: After reboot,the partition will detach automatically
Permanent mount
The /etc/fstab and edit it
[root@localhost ~]# vim /etc/fstab
/dev/sda4 /mnt defaults ext3 0 0
save and exit the file
Now run mount command
[root@localhost ~]# 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
[root@localhost ~]# 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