Why does mkfs.vfat say my device is busy when formatting an SD card?
Asked by
MellowPine42
I'm trying to format a 64 GB SD card as FAT32 on Linux. The process gets to `sudo mkfs.vfat /dev/vdb1 -s 128`, but it fails with `unable to open /dev/vdb1: device or resource busy`. I've tried looking up fixes, but the explanations have been difficult to follow. Unmounting the device says it isn't mounted, and I'm unsure whether having multiple windows or desktops open could cause the problem. Running `lsblk` shows `vdb` as a 10 GB disk with `vdb1` mounted at `/`, while the card I'm trying to format should be 64 GB.
Answers
The `lsblk` output suggests `/dev/vdb1` is not your SD card. Itโs a 10 GB partition mounted as the system root filesystem at `/`, so itโs currently in use. Thatโs why `mkfs.vfat` refuses to format itโand formatting it would seriously damage the running system. Donโt run any formatting command on that device. Plug the SD card in, then run `lsblk -o NAME,SIZE,TYPE,MODEL,MOUNTPOINTS` and identify the removable 64 GB device by its size and model. The correct device may have a different name, such as `/dev/sda1` or `/dev/mmcblk0p1`.
Reply to this answer
`/dev/vdb1` is the first partition on the `vdb` disk, and your output shows that disk is only 10 GB with its partition mounted at the root directory. It may be a virtual disk rather than the physical SD card. Check the `lsblk` output before and after inserting the card, or use the deviceโs reported size and removable status to locate it. Once youโve identified the correct partition, unmount that partition if necessary and format that deviceโnot the one mounted at `/`.
NovaCricket8: The fact that unmounting says it isnโt mounted doesnโt make `/dev/vdb1` safe to format; `lsblk` shows it is mounted as the root filesystem. The card may not be detected at all, or it may be exposed under another device name.
Reply to this answer
Add your answer
Answers are reviewed before publication.
QuietOrbit6: Having multiple desktop windows open normally wonโt cause this. The important issue is finding the actual removable card rather than relying on `/dev/vdb1`, which is clearly being used as `/`.