I just fixed an USB drive that apparently had been hit by a virus. All the top-level directories were invisible on Windows, but visible on GNU/Linux.
First I thought that it was just the “hidden” bit. But turns out it was the “system” bit. I had completely forgotten that one even existed!
After some googling I got this solved by using mtools:
- Create a ~/.mtoolsrc file with this:
drive s: file="/dev/<your-usb-drive"
mtools_skip_check=1 (otherwise it refuses to operate on the drive)
- Check for file attributes with mattrib:
$ mattrib -/ s:
- Fix any broken stuff (this removes the hidden and system bits):
$ mattrib -/ -h -s s:
Hope it saves your neck or the neck of someone that has to use Windows.
Oh, and please, please, don’t make your entire digital life depend on a tiny piece of plastic. Make backups on your real computer, or other drives.
I had the exact same problem a few weeks ago. I came up with a simpler solution (IMO): I just copied everything on the USB stick to my hard drive, which being ext4 erased the hidden system bits, formatted the stick, and copied everything back. It’s probably slower, but it works 🙂
you can apply this with SD Cards
“drive s: file=”/dev/mmcblk0p1″ mtools_skip_check=1”
if you get «init S: non DOS media» that means you aren’t pointing to a correct FAT partition. If you have to use sudo to open a /dev device, copy your .mtoolsrc to the root home folder
sudo cp ~/.mtoolsrc /root/