Sfdisk
sfdisk - “此磁碟目前正在使用” - 但似乎沒有任何東西在使用它?
# sfdisk /dev/mmcblk0p1 Welcome to sfdisk (util-linux 2.29.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Checking that no-one is using this disk right now ... FAILED This disk is currently in use - repartitioning is probably a bad idea. Umount all file systems, and swapoff all swap partitions on this disk. Use the --no-reread flag to suppress this check.
但我找不到它在哪裡使用。
# grep mmc /proc/mounts # grep mmc /proc/swaps # lsof /dev/mmc* # fuser /dev/mmc*
sfdisk
是從util-linux 2.29.2-1+deb9u1
。# strace -f sfdisk /dev/mmcblk0p1 ... write(1, "\33[0mChanges will remain in memor"..., 115Changes will remain in memory only, until you decide to write them. Be careful before using the write command. ) = 115 write(1, "\n", 1 ) = 1 fstat64(3, {st_mode=S_IFBLK|0660, st_rdev=makedev(179, 1), ...}) = 0 ioctl(3, BLKRRPART) = -1 EINVAL (Invalid argument) write(1, "Checking that no-one is using th"..., 62Checking that no-one is using this disk right now ... FAILED
ioctl(3, BLKRRPART) = -1 EINVAL (Invalid argument)
事實上,如果消息是正確的,錯誤程式碼應該顯示
EBUSY
notEINVAL
。您有一個“無效參數”,因為您通過了
/dev/mmcblk0p1
. 這是一個分區。sfdisk
編輯列出所有分區的表。您需要通過整個設備,即# sfdisk /dev/mmcblk0