环境
root@ubuntu18:/var# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic
步骤
- init 1
- fuser -mvk 挂载目录 // 杀掉占用目录的进程
- 如果上一步出现下面这种一直干不掉
root@ubuntu18:/tmp# fuser -mvu /var
USER PID ACCESS COMMAND
/var: root kernel mount (root)/var
参考这个链接umount: device is busy. Why?,
- 上面的链接说是nfs-kernel-server的原因,其实就是kernel这个PID,但是这个东西好像是因为只要有挂载之类的就会这样(fuser doesn’t find NFS exports that prevent umounting),但我的不是,我没有安装nfs-kernel-server
- 解决办法
mount|grep /var 查看(我的挂载目录是/var)
root@ubuntu18:/tmp# mount|grep var
/dev/sda3 on /var type ext4 (rw,relatime,data=ordered)
/var/lib/snapd/snaps/core_8213.snap on /snap/core/8213 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/core_8268.snap on /snap/core/8268 type squashfs (ro,nodev,relatime,x-gdu.hide)
有2个/var/lib/snapd
这样的东西,先挨个umount ,再umount /var 成功