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

(编辑:jimmy 日期: 2024/9/21 浏览:2)

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 ~]#

备注:如果挂载到有文件的目录下 会遮挡原先文件 必须卸载挂载的硬盘 才能显示

[root@whp6 ~]# ls /home/
1.txt 2 22 wanghaipeng whp
[root@whp6 ~]# mount /dev/sdb1 /home/
[root@whp6 ~]# ls /home
lost+found
[root@whp6 ~]# umount /home
[root@whp6 ~]# ls /home
1.txt 2 22 wanghaipeng whp
[root@whp6 ~]#

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挂载和卸载硬盘,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!

一句话新闻

微软与英特尔等合作伙伴联合定义“AI PC”:键盘需配有Copilot物理按键
几个月来,英特尔、微软、AMD和其它厂商都在共同推动“AI PC”的想法,朝着更多的AI功能迈进。在近日,英特尔在台北举行的开发者活动中,也宣布了关于AI PC加速计划、新的PC开发者计划和独立硬件供应商计划。
在此次发布会上,英特尔还发布了全新的全新的酷睿Ultra Meteor Lake NUC开发套件,以及联合微软等合作伙伴联合定义“AI PC”的定义标准。