8

So we accidentally caused our server to go down without a clean shutdown and now df is reporting wrong stats for the external usb (exfat).

root@srv1:/backup/usbdisk# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb2       3.6T  2.8T  646G  82% /
...
/dev/sde1       7.3T  241M  7.3T   1% /backup/usbdisk

du says:

root@srv1:/backup/usbdisk# du -sh
2.6T    .

exfatfsck /dev/sde1 says:

exfatfsck 1.1.0
WARN: volume was not unmounted cleanly.
Checking file system on /dev/sde1.
File system version           1.0
Sector size                 512 bytes
Cluster size                128 KB
Volume size                7452 GB
Used space                  241 MB
Available space            7452 GB
ERROR: cluster 0x3f of file 'assets' is not allocated.
ERROR: cluster 0x40 of file 'mysql' is not allocated.
ERROR: cluster 0x41 of file 'public_assets' is not allocated.
Totally 3 directories and 0 files.
File system checking finished. ERRORS FOUND: 3.

so how do we fix this?

5

The manpage for exfatfsck says:

exfatfsck checks an exFAT file system for errors. Note that it cannot repair corrupted FS, it just reports found errors.

One way to fix is to plug it into a Windows system and scan and fix errors there.

0
5

Since v1.3.0 (came out on 15 Sep 2018), exfatfsck should be able to repair some errors.

0
1

You need to install exfatprogs package, which (besides mkfs and tune) provides a fast fsck utility. It is presumably pretty reliable too, because it's in particular developed by Samsung (who also contributed exFAT FS to Lunux kernel, available since Lunux 5.7 version).

6
  • Ubuntu 20.04 sudo apt-get install exfatprogs yields Unable to locate package exfatprogs. – Pierre ALBARÈDE Nov 2 '20 at 22:53
  • @PierreALBARÈDE that's because Ubuntu 20.04 repos are outdated for this package. If you click the package link in my post, you'll see it's currently available only for Groovy, that is Ubuntu 20.10. However, I think you could try downloading the package for Groovy and installing into your 20.04 manually. The package seems to only depend on glibc, so probably should work this way. – Hi-Angel Nov 3 '20 at 6:16
  • I have upgraded to 20.10 specially to try exfatprogs and indeed I was able to mount read only an SDXC card with exFAT format and MBR partitioning. – Pierre ALBARÈDE Nov 5 '20 at 19:29
  • I can mount writable only through a USB card reader. Same thing on MacOS. – Pierre ALBARÈDE Nov 5 '20 at 21:02
  • @PierreALBARÈDE try running journalctl -f before mounting, and mount exfat afterwards. You should see in the journal the reason exfat was mounted read-only; do you see anything interesting? And while on it, what's your kernel version? – Hi-Angel Nov 5 '20 at 21:45

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.