mount

[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.. bashvim

[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 ~]$bash

[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 ~]$ide

[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/42code

[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=orderedit

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

0class

[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/sda7sed

相關文章
相關標籤/搜索