[CentOS] mkfs.fat Device or resource busy

Sun May 24 23:57:54 UTC 2020
Robert Heller <heller at deepsoft.com>

At Sun, 24 May 2020 18:33:25 -0500 (CDT) CentOS mailing list <centos at centos.org> wrote:

> I'm trying to format a 16 GB SD card to FAT32.
> Either it won't find the device or it
> gives me the titular error message.
> mkfs.fat /dev/sdc

First of all, doing it *without* a partition table is not going to work (well 
mkfs.fat is not going to care (once you deal with the other error).  Since 
you are formatting iy FAT32, I'm presuming you will be using it in some device 
(eg camera, mess-windows machine, etc.).  You want an MBR partition table -- 
eg a visit with fdisk or the like.  (Actually, unless you have already used 
fdisk or the link on this card, it should already have a MBR partition table, 
with one partiton (1) that is the full size of the disk (less the boot 
"cylinder"), with a partition type of MS-DOS, so all you have to do is:

mkfs.fat /dev/sdc1

Once the existing file system has been umounted (see below).

> I have tried "ejecting" the drive and reinserting the card.
> I have tried inserting another card, checking to insure
> that I could see its file, ejecting that card and
> inserting the target card.
> If I do not umount it, busy, if I don't, not found.

I'm guessing you are using a GUI and the GUI has some "magic" GUI mounter hack
that automagically mounts USB disks when they show up. You probably have to
turn that off or work around it. I guess umount from a shell will work. Eject
won't work, since that not only umounts the file system, it also removes the
device files (hense "device not found").

> What is the incantation for formatting an SD card.
> BTW I am using Centos 7 and a USB adapter.

Robert Heller             -- 978-544-6933 Cell: 413-658-7953 GV: 978-633-5364
Deepwoods Software        -- Custom Software Services
http://www.deepsoft.com/  -- Linux Administration Services
heller at deepsoft.com       -- Webhosting Services