码迷,mamicode.com
首页 > 系统相关 > 详细

Linux mount挂载和卸载硬盘脚本分享

时间:2017-01-26 00:14:18      阅读:249      评论:0      收藏:0      [点我收藏+]

标签:code   PFS   ext   卸载   strong   txt   cpp   mount挂载   目录   

Linux 挂载

[root@whp6 ~]# mount /dev/sdb5 /mnt/
[root@whp6 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 16G 2.1G 13G 14% /
tmpfs 931M 0 931M 0% /dev/shm
/dev/sda1 194M 28M 157M 16% /boot
/dev/sdb5 2.0G 68M 1.9G 4% /mnt
[root@whp6 ~]# df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/sda3 ext4 16311208 2134352 13348288 14% /
tmpfs tmpfs 953276 0 953276 0% /dev/shm
/dev/sda1 ext4 198337 28320 159777 16% /boot
/dev/sdb5 ext4 2071384 68632 1897528 4% /mnt
[root@whp6 ~]# 

备注:如果挂载到有文件的目录下 会遮挡原先文件(原文件会变成lost+found文件夹) 必须卸载挂载的硬盘 才能显示

# ls /home/
1.txt 2 22 wanghaipeng whp
# mount /dev/sdb1 /home/  
# ls /home   这时看原来的文件就出来了
lost+found
# umount /home
# ls /home
1.txt 2 22 wanghaipeng whp
#

Linux umount 卸载

[root@whp6 /]# mount LABEL=wanghaipeng /home/whp/
[root@whp6 /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 16G 2.1G 13G 14% /
tmpfs 931M 0 931M 0% /dev/shm
/dev/sda1 194M 28M 157M 16% /boot
/dev/sdb5 2.0G 68M 1.9G 4% /mnt
/dev/sdb1 2.0G 74M 1.9G 4% /home/whp
[root@whp6 /]# umount -l /home/whp/
[root@whp6 /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 16G 2.1G 13G 14% /
tmpfs 931M 0 931M 0% /dev/shm
/dev/sda1 194M 28M 157M 16% /boot
/dev/sdb5 2.0G 68M 1.9G 4% /mnt
[root@whp6 /]#

Linux mount挂载和卸载硬盘脚本分享

标签:code   PFS   ext   卸载   strong   txt   cpp   mount挂载   目录   

原文地址:http://www.cnblogs.com/ggooo/p/6350279.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!