Long filenames truncated when mounting USB stick in Linux

Q I use a USB stick in a Windows computer and I download files on the stick from the Internet. Then I plug this USB stick in a Linux computer at home and I find that all the files with long names have been renamed using "~" For example, mylongfile3.mp3 will be renamed mylong~1.mp3 If you could help me with this I would appreciate it as I haven't got a clue of what may be wrong. I primarily use grml.org, a Debian based distro, but I have found this problem also happens in other distros like Knoppix, (Debian based too).

A This appears to be a problem with the options used to mount the USB stick's filesystem. The default filesystem on these devices is usually with FAT16 or FAT32, neither of which support long filenames directly, so they use a kludge (yes, I know, it's shocking that a Windows system contains kludges) to map the short names you are seeing to the correct long ones. The vfat filesystem in the Linux kernel handles this, but the msdos filesystem does not. Run the mount command in a terminal and you should see a line like this for your USB stick

/dev/sda1 on /media/usbstick type msdos (rw)

If the type is shown as msdos, you have found the root of the problem, now you need to make sure your stick is mounted correctly. If you are using an entry in /etc/fstab to mount this, change the filesystem type, the third item on the line, from msdos to either vfat or auto. If you are using your distribution's automounting system, then the filesystem type should be correctly identified. Does this happen with every USB stick you have tried, or only this one? If it is only this one, you could have some filesystem corruption that is causing the mount command to misidentify the filesystem. The are ways to work around it, but the best option would be to reformat the stick to get rid of the corruption (or even replace the stick if that does not fix it). I was unable to reproduce this problem with grml.org, so I suspect you may have a corrupted, or broken, USB stick. The flash memory used in these devices has a limited lifetime, it may simply be worn out.

Follow us on Identi.ca or Twitter

Username:   Password: