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

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux mount挂载和卸载硬盘脚本分享相关的知识,希望对你有一定的参考价值。

Linux 挂载

[[email protected] ~]# mount /dev/sdb5 /mnt/
[[email protected] ~]# 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
[[email protected] ~]# 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
[[email protected] ~]# 

备注:如果挂载到有文件的目录下 会遮挡原先文件(原文件会变成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 卸载

[[email protected] /]# mount LABEL=wanghaipeng /home/whp/
[[email protected] /]# 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
[[email protected] /]# umount -l /home/whp/
[[email protected] /]# 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
[[email protected] /]#

以上是关于Linux mount挂载和卸载硬盘脚本分享的主要内容,如果未能解决你的问题,请参考以下文章

在Linux环境下挂载你的U盘,查看U盘内的内容,最后卸载U盘。

linux硬盘掉线挂载信息还在

linux mount

Linux学习课程笔记

Linux挂载硬盘

Linux系统下如何挂载U盘,硬盘,光驱