This article is more than 1 year old

Linux world gains ability to repair exFAT drives

FAT ain't dead, and the modern version can get big. Really big

In case you thought the FAT filesystem died out with Windows ME – and good riddance – we have bad news for you. Several versions of it are alive, well, and essential to modern PCs, cameras, phones, fondleslabs, and more. The good news is, you'll soon be able to fix the FS with Linux.

A version of Microsoft's FAT filesystem called exFAT forms part of the specification of SDXC (32GB—2TB) and SDUC (2—128TB) cards, and is the default format of SD cards over 32GB in size.

A forthcoming version of the Linux exFAT utilities will make fsck able to repair the filesystem on those devices and other storage.

At one point, using exFAT meant buying a license, but it later got an official free open description and indeed was adopted by the Open Invention Network. Microsoft's own description eases you in quite gently. Essentially, exFAT is to FAT32 as FAT32 is to the old 16-bit FAT of the DOS era. It's not totally unfair to call it FAT64.

But leave it at that. Don't call it "FATty FAT FAT FAT" or anything like that. The Reg does not condone FAT-shaming.

The Linux kernel gained the ability to mount exFAT volumes in version 5.4, via a Samsung driver that the company donated. This later got a substantial upgrade. So, for instance, while in Ubuntu 18.04 you had to load a driver, since Ubuntu 20.04 appeared exFAT-formatted media should Just Work™.

That's great. The problem is if it Just Doesn't™. The exFAT system allows for disks up to 128PB – although 512TB is the recommended maximum. That's a lot of data to risk losing. This is where the exfatprogs tools come in. The forthcoming version 1.2 promises a handy new feature: a fsck.exfat command that can repair filesystem damage.

The command was already there, but until this release it could only find and report damage – not fix it. The easiest way to do that was to insert your card into a Windows computer, and not everyone has one of those available. (The fsck command is the Unixy way of checking and repairing a disk volume, as well as a handy Reg stand-in for a Rude Word.)

It's very much not unprecedented for Linux to support a particular filesystem, but not be able to repair it. While the Linux kernel has had a built-in read-write NTFS driver since version 5.15, it can't fsck NTFS volumes, as the NTFS3 FAQ mentions.

For now, you still need to have the older FUSE-based NTFS-3G installed, which provides the ntfsfix command. Even so, it can only repair some fairly minor types of damage, and flag a volume so that Windows will check it next boot. Meanwhile the fsck.btrfs command will, as per its own description:

fsck.btrfs - do nothing, successfully

The btrfs-check command actually does something, but we advise you to pay close heed to the dire warning in that link. In our experience, it is more akin to a secure data-erasure tool than anything liable to help. ®

Bootnote

FAT32 hasn't gone away, either. It's integral to any modern PC, because UEFI firmware needs an EFI System Partition (ESP). Those are formatted with FAT32, which caused the Reg FOSS desk problems with some recent distros.

More about

TIP US OFF

Send us news


Other stories you might like