3

I have an SD card, and I would like to make the files on it consecutive in the flash memory itself (so there are no gaps in between). However, I understand that such a process could use an unnecessary large number of RW cycles, so I would like to perform it on an disk image of the card and then send the image back to the card. Are there any tools that would allow me to edit the file table in such a manner? (It must support FAT)

P.S. It would be great if said tool also supported rearranging the files manually.

P.P.S. (thanks, Izzy) I would prefer it if this tool ran on Linux, and it would be best if it's open-source, as nobody compiles for ARM :-(, but I'm open to all suggestions as long as it runs on Linux.

EDIT: Removed GUI requirement!

  • Good luck then! I've just updated your tags accordingly. – Izzy Dec 20 '16 at 6:38
  • The ISO file system does not support fragmented files, so making an ISO and writing it back to the SD card should suffice for removing gaps. Based on which criteria do you want to order the files? What makes you think your manual ordering has any benefits? – Thomas Weller Dec 20 '16 at 7:43
  • @ThomasWeller I have a speaker that plays music from an SD card, but it does not sort the files; it plays them in the physical order that they appear. That is why I want to reorder them, and I want to remove any gaps (from deleted files) so that new files will always be copied to the end of the currently written section, rather than appearing in between already written songs. – Nonny Moose Dec 20 '16 at 14:15
  • That's an issue of the file system then, not of fragmentation. You need a tool that could rearrange e.g. the MFT on NTFS or the FAT on FAT32. Potential solution: copy all files from the SD card, then format the SD card, copy the files back in the order you want them to appear. – Thomas Weller Dec 20 '16 at 14:24
  • @ThomasWeller I would but I have almost a thousand of them and I have found that the operating system doesn't necessarily copy them in the correct order. – Nonny Moose Dec 20 '16 at 14:25
0

I finally found a tool that can rearrange FATs!
http://fatsort.sourceforge.net/

From man fatsort:

-a     Use ASCIIbetical order for sorting

-n     Natural order sorting

-d=DIR
          Sort directory DIR only

-D=DIR Sort directory DIR and all subdirectories

-x=DIR Don't sort directory DIR

-X=DIR Don't sort directory DIR and its subdirectories

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.