USB stick formatted vfat won't mount until a file is present

Posts: 8
paraquat
Joined: 13 Sep 2011
#1
Hi all,

Unexpected problem. I formatted a USB stick thus:

mkfs.vfat /dev/sdb1

Formatted fine. But then it wouldn't mount. I have automounting set up, so just pulling out the stick and putting it back in should have mounted it, but didn't.

OK, next logical step was to su to root and try to mount it manually, someplace:

mount /dev/sdb1 /mnt

No success. Also tried SpaceFM - no USB stick visible.

Next step - reboot into Linux Mint Debian (on same machine). Stuck in the USB stick and an icon pops up - I click on that and it mounts. I copied a few files onto the stick. Pulled it out and rebooted again, back into AntiX. Now I insert the stick and it automounts. The files I copied onto it are visible, and I can add and delete files.

I tried reformatting the same USB stick again in AntiX, this time to the ext2 file system. I pulled it out and stuck it back in, it automounts. Is this because ext2 is somehow"better" than vfat? Maybe, but the more likely explanation is that the command mkfs.ext2 will not only format the disk, but also add a"lost+found" directory. It could be the present of this directory that solves the problem of not being able to mount it.

My"workaround" (adding a file or two with another OS) is OK for now, but not an elegant solution. I'm wondering just what is causing this, and how to solve it.

cheers,
P
Posts: 1,308
BitJam
Joined: 31 Aug 2009
#2
In general, it would be helpful if you told us exactly what version of antiX you are running and whether you are running a Live system or an installed system. The automounting code has changed recently and it is different on Live systems versus installed systems, but that information might not be needed in this particular case.

This sounds like a Linux/udev quirk and not something specific to antiX. Sometimes when you update partitions on a usb drive (or if not everything on the drive is cleanly unmounted), it will show up as a different device after unplugging and replugging. If the kernel/udev are not certain the old device has completely gone away, they will give you a new device name just to be on the safe side.

If you encountered this problem again do an"ls /dev/sd*" to see if the usb drive shows up as a different device. A pro-active solution is to use disk labels (or even uuids) to identify partitions. While device names will get changed easily, labels and uuids stay the same. You can see the labels for all your disk devices by doing"ls -l /dev/disk/by-label".