Friday, May 16, 2008

Long file names and removable media

I was recently trying to copy a bunch of files onto an SD card, and kept getting an "out of space" error message, which was kind of odd, considering the 300 or so image files added up to a grand total of just over 20 MB, and the card was en empty 1 GB card.

Much poking, prodding, trying stuff from the command line and googling resulted in me learning more about VFAT than I'd originally intended. Anyway, it turns out that the implementation for long file names in VFAT is a workaround which means that if you have too many(1) long file names in the root directory you may chew up all your allocation units and get "out of space" errors long before the media itself is full.

Files in sub folders are not implemented in the same way, and therefore don't exhibit the same behavior. Put all of the files in a subdirectory and all is well.

References:

Wikipedia's entry on various implementations of Mr Gates' File Allocation Table.

A MEPIS forum post that really pointed me in the right direction.

Notes:

(1) How many depends on how long your file names actually are, you use one extra directory entry for every 13 characters. I think it's 512 directory entries, so assuming I had 302 x some number greater than 1, I was bound to run into problems.

No comments: