码迷,mamicode.com
首页 > 其他好文 > 详细

mount

时间:2020-03-08 12:29:52      阅读:97      评论:0      收藏:0      [点我收藏+]

标签:查看   type   ice   etc   echo $?   nod   bash   source   ext   

[root@bogon ~]$fuser -v /mnt/sda7 --查看哪个用户连接
                 USER        PID ACCESS COMMAND

/mnt/sda7: root kernel mount /mnt/sda7
root 7531 ..c.. bash ------------这个用户在通过这个进程连接
[root@bogon ~]$fuser
fuser fusermount fusermount-glusterfs
[root@bogon ~]$fuser -v /boot
USER PID ACCESS COMMAND
/boot: root kernel mount /boot
root 8493 ..c.. bash

[root@bogon ~]$lsof /boot 同样判断是否有进程在访问

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
bash 8493 root cwd DIR 8,1 4096 64 /boot
[root@bogon ~]$

[root@bogon ~]$fuser -km /mnt/sda7/ --------------杀掉所有连接这个文件系统的进程,这是具有破坏性的

/mnt/sda7: 7531c
[root@bogon ~]$fuser -v /mnt/sda7
USER PID ACCESS COMMAND
/mnt/sda7: root kernel mount /mnt/sda7 -------------只剩下内核在用了
[root@bogon ~]$

[root@bogon ~]$umount /mnt/sda7 -----------卸载掉
[root@bogon ~]$df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 100G 16G 85G 16% /
devtmpfs 895M 0 895M 0% /dev
tmpfs 910M 0 910M 0% /dev/shm
tmpfs 910M 11M 900M 2% /run
tmpfs 910M 0 910M 0% /sys/fs/cgroup
/dev/sda3 50G 136M 50G 1% /data
/dev/sda1 1014M 174M 841M 18% /boot
tmpfs 182M 0 182M 0% /run/user/0
tmpfs 182M 12K 182M 1% /run/user/42

[root@bogon ~]$find /mnt/sda7 --判断 /mnt/sda7是否是挂载点

/mnt/sda7
[root@bogon ~]$findmnt /mnt/sda7
[root@bogon ~]$echo $? ---执行结果是1 现在不是
1

[root@bogon ~]$mount /dev/sda7 /mnt/sda7/ ---挂载、mnt/sda7后

[root@bogon ~]$findmnt /mnt/sda7 ---判断 是否是挂载点

TARGET SOURCE FSTYPE OPTIONS
/mnt/sda7 /dev/sda7 ext4 rw,relatime,data=ordered

[root@bogon ~]$echo $? ---结果是

0

[root@bogon ~]$vim /etc/fstab ---加入 UUID /dev/sda7

[root@bogon ~]$df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 100G 16G 85G 16% /
devtmpfs 895M 0 895M 0% /dev
tmpfs 910M 0 910M 0% /dev/shm
tmpfs 910M 11M 900M 2% /run
tmpfs 910M 0 910M 0% /sys/fs/cgroup
/dev/sda3 50G 136M 50G 1% /data
/dev/sda1 1014M 174M 841M 18% /boot
tmpfs 182M 0 182M 0% /run/user/0
tmpfs 182M 12K 182M 1% /run/user/42
/dev/sda7 2.0G 6.0M 1.8G 1% /mnt/sda7
[root@bogon ~]$df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda2 104806400 15956316 88850084 16% /
devtmpfs 915820 0 915820 0% /dev
tmpfs 931624 0 931624 0% /dev/shm
tmpfs 931624 10468 921156 2% /run
tmpfs 931624 0 931624 0% /sys/fs/cgroup
/dev/sda3 52403200 139216 52263984 1% /data
/dev/sda1 1038336 177972 860364 18% /boot
tmpfs 186328 0 186328 0% /run/user/0
tmpfs 186328 12 186316 1% /run/user/42
/dev/sda7 1998672 6144 1871288 1% /mnt/sda7
[root@bogon ~]$umount /mnt/sda7/
[root@bogon ~]$df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda2 104806400 15956296 88850104 16% /
devtmpfs 915820 0 915820 0% /dev
tmpfs 931624 0 931624 0% /dev/shm
tmpfs 931624 10468 921156 2% /run
tmpfs 931624 0 931624 0% /sys/fs/cgroup
/dev/sda3 52403200 139216 52263984 1% /data
/dev/sda1 1038336 177972 860364 18% /boot
tmpfs 186328 0 186328 0% /run/user/0
tmpfs 186328 12 186316 1% /run/user/42
[root@bogon ~]$mount -a
[root@bogon ~]$df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda2 104806400 15956296 88850104 16% /
devtmpfs 915820 0 915820 0% /dev
tmpfs 931624 0 931624 0% /dev/shm
tmpfs 931624 10468 921156 2% /run
tmpfs 931624 0 931624 0% /sys/fs/cgroup
/dev/sda3 52403200 139216 52263984 1% /data
/dev/sda1 1038336 177972 860364 18% /boot
tmpfs 186328 0 186328 0% /run/user/0
tmpfs 186328 12 186316 1% /run/user/42
/dev/sda7 1998672 6144 1871288 1% /mnt/sda7

mount

标签:查看   type   ice   etc   echo $?   nod   bash   source   ext   

原文地址:https://blog.51cto.com/12246080/2476329

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