Make an exfat drive that's compatible with Linux, Windows and Mac
by AwesomeMachine from LinuxQuestions.org on (#551TZ)
Well, exfat (fat64) is becoming ubiquitous with flash media. But I just couldn't find a way to take any flash drive or sdxc card, that had been formatted as something else, and turn it into a universal compatible exfat drive.
Windows is the fussiest about tiny issues. But, you can do it with gdisk and mkfs for exfat.
Sudo gdisk
Select the drive
Type o to make a new partition table that Windows will like.
Type n to make a 250MB partition of type 0c01, Windows reserved
250MB is 512,000 sectors,
Type n again to partition the rest of drive as type 0700, Microsoft basic data.
I don't know why you need that tiny partition in front, but every windows volume has it. It's not normally visible. So don't think it disappeared.
Now hit w to write the table. If there is stuff you want on the drive, copy it to another drive, because w will write a new partition table. All the existing files will be gone.
Windows likes monster-sized clusters on large, homebrewed at least, exfat drives. I use
Mkexfatfs -n some_name -s 1024 /dev/sdxy
That gives you a mount point name you can remember (-n) and 512k clusters.
Sector=512 bytes, 2 sectors =1kbyte. 1024 sectors = 512kbytes/cluster.
The process should require 15 minutes the first time. But, there is a caveat. Let's say you use rsync to load GBs onto the exfat drive in Linux.
Rsync will exit when the space for each file has been allocated. But most of them might not be written yet. Flash drives are slow, so, after rsync tells the file system what goes where, the machine can write the files in the background.
But, if you see rsync finished, so you use umount to eject the flash drive, for some reason it will unmount before the files are written. The directories will be visible in a file manager, so you'll feel confident you can pull the drive out, and take it to wherever you want to put those files.
You'll find the directories mostly gone. You can plug it back into the linux box, and mostly everything on you put on the drive will have disappeared.
But actually it was never there. You saw placemarkers, which in a file manager look like folders and files, even with thumbnails for photos. But the files were not written yet, because umount for fuse is not quite up to the task for exfat.
So, after you copy over all the files, you have to force the system to write the files, with the sync command. After rsync, or whatever else exits, run sync. It might run for 15 min to 1/2 hour. After sync exits, then your files are written.
Now you can umount, and remove the drive.
And you don't need to change ownership or permissions on exfat. It has now effect, because the metadata for it isn't really there. Exfat for Linux makes it look like it's there, so Linux doesn't freak out. But if you start using chmod and chown, you'll make ground beef out of it! Then you have to pull out the exfat drive and put it back.


Windows is the fussiest about tiny issues. But, you can do it with gdisk and mkfs for exfat.
Sudo gdisk
Select the drive
Type o to make a new partition table that Windows will like.
Type n to make a 250MB partition of type 0c01, Windows reserved
250MB is 512,000 sectors,
Type n again to partition the rest of drive as type 0700, Microsoft basic data.
I don't know why you need that tiny partition in front, but every windows volume has it. It's not normally visible. So don't think it disappeared.
Now hit w to write the table. If there is stuff you want on the drive, copy it to another drive, because w will write a new partition table. All the existing files will be gone.
Windows likes monster-sized clusters on large, homebrewed at least, exfat drives. I use
Mkexfatfs -n some_name -s 1024 /dev/sdxy
That gives you a mount point name you can remember (-n) and 512k clusters.
Sector=512 bytes, 2 sectors =1kbyte. 1024 sectors = 512kbytes/cluster.
The process should require 15 minutes the first time. But, there is a caveat. Let's say you use rsync to load GBs onto the exfat drive in Linux.
Rsync will exit when the space for each file has been allocated. But most of them might not be written yet. Flash drives are slow, so, after rsync tells the file system what goes where, the machine can write the files in the background.
But, if you see rsync finished, so you use umount to eject the flash drive, for some reason it will unmount before the files are written. The directories will be visible in a file manager, so you'll feel confident you can pull the drive out, and take it to wherever you want to put those files.
You'll find the directories mostly gone. You can plug it back into the linux box, and mostly everything on you put on the drive will have disappeared.
But actually it was never there. You saw placemarkers, which in a file manager look like folders and files, even with thumbnails for photos. But the files were not written yet, because umount for fuse is not quite up to the task for exfat.
So, after you copy over all the files, you have to force the system to write the files, with the sync command. After rsync, or whatever else exits, run sync. It might run for 15 min to 1/2 hour. After sync exits, then your files are written.
Now you can umount, and remove the drive.
And you don't need to change ownership or permissions on exfat. It has now effect, because the metadata for it isn't really there. Exfat for Linux makes it look like it's there, so Linux doesn't freak out. But if you start using chmod and chown, you'll make ground beef out of it! Then you have to pull out the exfat drive and put it back.