12 comments on “Alphabetically Sorting FAT USB drives with Mac OSX

  1. Riiight, unfortunately it didn’t recognized FAT32 with 64K cluster size.

    check_bootsector: Cluster size is larger than 32k!
    read_bootsector: This is not a FAT boot sector or sector is damaged!
    openFileSystem: Failed to read boot sector!
    sortFileSystem: Failed to open file system!
    main: Failed to sort file system!

      • That was a nice one-line reply, but it had nothing to do with my issue.

        I reformatted the card to FAT32 32K cluster size back then and now it works perfectly.
        File system: FAT32.

        Sorting directory /
        Sorting directory /.Spotlight-V100/
        Sorting directory /.Spotlight-V100/Store-V1/
        Sorting directory /.Spotlight-V100/Store-V2/
        Sorting directory /.Spotlight-V100/Store-V2/E13D679A-C486-403F-BBDE-E456F6A83648/
        Sorting directory /.Spotlight-V100/Store-V2/E13D679A-C486-403F-BBDE-E456F6A83648/journals.live/
        Sorting directory /.Spotlight-V100/Store-V2/E13D679A-C486-403F-BBDE-E456F6A83648/journals.scan/
        Sorting directory /.Trashes/
        Sorting directory /.fseventsd/
        Sorting directory /A-F/
        Sorting directory /A-F/Adele/
        …..

      • Sorry. I thought it had everything to do with your issue since the article is about sorting a FAT volume, not a FAT32 one.

  2. Whoops, didn’t noticed that you’re talking about FAT16 (I assume FAT16 as FAT12 is too legacy?)

    Right, I can assure the fatsort is a good stuff for FAT32, though limited to 32K cluster size. No biggie with no 64K support, anyway. I’ve been using DriveSort on Windows for several days and found out that it would corrupt my audio files occassionally, without any CRC errors! Stay away from DriveSort!

  3. Hi, thanks for taking the time to write this.
    I’m running into some issue though.
    How exactly do you run fatsort from the location you copied it to while staying in root# ? I can’t access the directory.
    And when I exit the root and try to run it from its location I get:
    MBP-de-Thomas:~ Thomas$ ./fatsort /dev/disk3s1
    openFileSystem: Permission denied!
    sortFileSystem: Failed to open file system!
    main: Failed to sort file system!

    • root should be able to access any file in any directory. You may need to alter the fatsort binary to have execute permissions with 755 (rwxr-xr-x) or 775 (rwxrwxr-x). It looks like from the error that its not the execute permission on the program, but rather the filesystem your trying to sort. Make sure the filesystem mounted is read/writable. Again, as root, it shouldn’t be an issue.

      • Well I managed to fix my problem by only entering sudo -s instead of the sudo su command. This gives me the permissions required and lets me access the right directory. I can now sort my car music properly.
        Thanks for the answer anyway 😉

  4. Hi — I’m a complete command-line ignoramus, trying to step through this, and thanks to your methodical explanation I feel tantalizingly close. But I’m still failing. Here’s the story:

    I’m running Mac OS 10.15.5. I download the latest Fatsort, 1.6.2.605, from Sourceforge and it unpacks to my desktop. I open terminal and install Xcode using “xcode-select –install”, which seems to work fine, GUI and all. I navigate to the src folder in the Fatsort folder, then this is what happens (see below). What am I doing wrong? — My sincere thanks in advance for any advice, Larry

    ————————————

    Larry-Gilmans-iMac-5:fatsort-1.6.2.605 larrygilman$ cd src
    Larry-Gilmans-iMac-5:src larrygilman$ make
    uname: illegal option — o
    usage: uname [-amnprsv]
    gcc -Wall -Wextra -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D __OSX__ -c fatsort.c -o fatsort.o
    In file included from fatsort.c:38:
    In file included from ./FAT_fs.h:78:
    ./deviceio.h:57:4: error: Unsupported OS!
    #error Unsupported OS!
    ^
    ./deviceio.h:61:1: error: unknown type name ‘DEVICE’
    DEVICE *device_open(const char *path);
    ^
    ./deviceio.h:64:24: error: unknown type name ‘DEVICE’
    int64_t device_seekset(DEVICE *device, int64_t offset);
    ^
    ./deviceio.h:67:21: error: unknown type name ‘DEVICE’
    int64_t device_read(DEVICE *device, void *data, uint64_t size, uint64_t n);
    ^
    ./deviceio.h:70:22: error: unknown type name ‘DEVICE’
    int64_t device_write(DEVICE *device, const void *data, uint64_t size, uint64_t n);
    ^
    ./deviceio.h:73:17: error: unknown type name ‘DEVICE’
    int device_sync(DEVICE *device);
    ^
    ./deviceio.h:76:18: error: unknown type name ‘DEVICE’
    int device_close(DEVICE *device);
    ^
    In file included from fatsort.c:38:
    ./FAT_fs.h:329:2: error: unknown type name ‘DEVICE’
    DEVICE *device;
    ^
    8 errors generated.
    make: *** [fatsort.o] Error 1
    Larry-Gilmans-iMac-5:src larrygilman$

    • Apologies for the extremely late reply. I’m not sure what’s happening. If you didn’t run a “make config” to prep the environment that could be the cause. It could be that the fatsort source is just too old to compile now without some tweaks due to deprecated items in the source. It’s been a long time since I wrote that original post, and no longer need fatsort. Sorry I am unable to further assist.

  5. Hello,

    I already ran succesfully fatsort on some other Volumes, but i have trouble now:
    wcpifrima100m:~ root# diskutil unmount /dev/disk2s1
    Volume NONAME on disk2s1 unmounted
    wcpifrima100m:~ root# ./fatsort /dev/disk2s1
    main: WARNING: The C locale does not support all multibyte characters!
    device_open: Operation not permitted!
    openFileSystem: Operation not permitted!
    sortFileSystem: Failed to open file system!
    main: Failed to sort file system!

    It’s a large collection of music and there is maybe somewhere some japanese ideogram in file names, does it come frome that?

    Thanks for your help

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.