relan / exfat

Free exFAT file system implementation
GNU General Public License v2.0
789 stars 179 forks source link

ERROR: file system in clusters is larger than device #134

Open kj opened 4 years ago

kj commented 4 years ago

My Samsung T5, which was working perfectly with both Linux and Android, suddenly stopped working with Android (prompts me to fix by formatting) and is giving me this error when attempting to mount in Linux:

FUSE exfat 1.3.0
WARN: file system in sectors is larger than device: 976768065 * 512 > 412316860416.
ERROR: file system in clusters is larger than device: 3815372 * 131072 > 412316860416.

I don't understand because fdisk -l gives me this output which seems to indicate that the filesystem is not larger than the device (forgive my ignorance about filesystems):

Disk /dev/sdb: 465.78 GiB, 500107862016 bytes, 976773168 sectors
Disk model: Portable SSD T5
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 33553920 bytes
Disklabel type: dos
Disk identifier: 0x92d38318

Device     Boot Start       End   Sectors  Size Id Type
/dev/sdb1        2048 805308415 805306368  384G  7 HPFS/NTFS/exFAT

I tried commenting out the lines in mount.c that give the cluster error above, and it proceeded to mount (this was probably a stupid idea, but I did it anyway), and I was able to see all my files and directories listed as they should be. I didn't go much further as I was scared I might break something so I unmounted it.

I'm sure there's something wrong with the filesystem, but I have no idea what, or why this would suddenly happen (I'm hoping it's not a hardware fault). Any ideas?

relan commented 4 years ago

You can safely modify fuse-exfat and mount your FS in read-only mode. In this case you cannot damage the FS.

The partition table looks off. Have a look at the fdisk output: the whole disk is 465 GB, but the partition on it is only 384 GB. Filesystem looks like it was created for a 465 GB partition.

I'd recommend to mount you FS in read-only mode, backup data, unmount the FS and then resize the partition using fdisk so that it occupies the whole disk. No idea why it suddenly became smaller, might be a hardware issue.

kj commented 4 years ago

Thanks for such a quick reply. I actually deliberately left free space after the partition when I created it in case I wanted to use it for something else, but it's great to know that it is safe to mount RO. I'll try to back up my files as soon as I get a chance in case it is a hardware issue!