Skip to main content

Q & A

NFS 遠端目錄無法卸載

Umount a NFS directory with the error: device is busy

當遭遇某些異常情況時,原先的 NFS 目錄可能無法用指令 umount 正常卸載,且主機因為還在營運生產中,不能執行重開機時,下述的指令可能會有幫助。

# 檢查那些程序及用戶使用該目錄
fuser -m -v <mount_point or device_path>
lsof | grep <mount_point or device_path>
lsof +f -- <path-to-dir>

# 刪除無效的程序
fuser -i -k <mount_point or device_path>
fuser -km <mount_point or device_path>
umount <mount_point>

# 以上都無效,可重啟 NFS Client daemon,但其他 NFS 目錄也會被迫中斷。
service netfs stop
service netfs start

# 網友提供的另一個方法
umount -l <mount_point>
umount -f <mount_point>
檢查線上 NFS 掛載參數, nfs 版本
cat /proc/mounts | grep nfs 
Can't mount remotely Linux host on AIX

Try to run the following commands on your AIX.

nfso -o nfs_use_reserved_ports=1
nfso -o portcheck=1
Remove Shared Memory
# see all shared memory segments
# status: dest -> destroyed
# nattach: how many application being attached to the shared memory. 
ipcs -m
ipcs -m -i <shmid>

# remove the shared memory segment
ipcrm shm <shmid>
ipcrm -m <shmid>
CentOS Upgrade Kernel: linux-firmware package files conflicts

說明:要升級 CentOS 7.6 Kernel to CentOS 7.7,遇到 linux-firmware 套件衝突問題。

rpm -ivh kernel-3.10.0-1062.el7.x86_64.rpm

warning: kernel-3.10.0-1062.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
error: Failed dependencies:
        linux-firmware >= 20190429-72 is needed by kernel-3.10.0-1062.el7.x86_64
        

rpm -ivh linux-firmware-20190429-72.gitddde598.el7.noarch.rpm kernel-3.10.0-1062.el7.x86_64.rpm

warning: linux-firmware-20190429-72.gitddde598.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
warning: kernel-3.10.0-1062.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                          ################################# [100%]
        file /usr/lib/firmware/amd-ucode/microcode_amd_fam17h.bin from install of linux-firmware-20190429-72.gitddde598.el7.noarch conflicts with file from package linux-firmware-20180911-69.git85c5d90.el7.noarch
        file /usr/lib/firmware/amd-ucode/microcode_amd_fam17h.bin.asc from install of linux-firmware-20190429-72.gitddde598.el7.noarch conflicts with file from package linux-firmware-20180911-69.git85c5d90.el7.noarch
        
# Solution:
rpm -Uvh linux-firmware-20190429-72.gitddde598.el7.noarch.rpm
rpm -ivh kernel-3.10.0-1062.el7.x86_64.rpm
Adjust reserved 5% of disk space by default

Reduce it to 2%

sudo tune2fs -m2 /dev/sda1
指令 du 與 df 顯示的使用空間有很大的落差

一般來說,問題通常是 df 的使用空間遠大於 du 的使用空間。

原因是 du 不會對開啟中的檔案進行計算,如果有開啟中的大檔案佔用目錄,du 是無法發現的。

解決方法:

  1. 使用指令 lsof /path/to/dir 檢查目錄裡有沒有程式正在執行中
  2. 確實關閉程式後再用 du 檢查一遍