You are not logged in.
I have an USB drive (/dev/sdb). While Arch Linux (ntfs-3g) and testdisk can read it successfully, gparted and Windows can't. fdisk reports
[user202729@archlinux ~]$ sudo fdisk /dev/sdb
Welcome to fdisk (util-linux 2.33).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk /dev/sdb: 7.6 GiB, 8097103872 bytes, 15814656 sectors
Disk model: Transcend 8GB
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x73736572
Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 63 15824024 15823962 7.6G 7 HPFS/NTFS/exFAT
Command (m for help): v
Total allocated sectors 15824025 greater than the maximum 15814656.ntfsfix can't find any problem:
[user202729@archlinux ~]$ sudo ntfsfix -n /dev/sdb1
Mounting volume... OK
Processing of $MFT and $MFTMirr completed successfully.
Checking the alternate boot sector... OK
NTFS volume version is 3.1.
NTFS partition /dev/sdb1 was processed successfully.gparted cannot read it:

testdisk reporst:
Disk /dev/sdb - 8097 MB / 7722 MiB - CHS 984 255 63
Current partition structure:
Partition Start End Size in sectors
1 * HPFS - NTFS 0 1 1 984 254 63 15823962
Warning: Bad ending cylinder (CHS and LBA don't match)------------
How can I fix the problems? I think that the partition has the size too large, but how can I know what's the correct size and resize it?
Offline
The fact that ntfsfix cannot find anything wrong is just telling us there is no error on the file system itself.
How did you partition and format the USB drive?
Offline
Actually, I've never formatted it. When I started using it, it was already formatted.
Recently I ran some wrong command on the USB that corrupts the drive, then realized that and used testdisk to rebuild the partition table. Before that, the drive works fine everywhere.
--------
Although it's definitely possible to copy all the content to the hard drive, format the usb, then copy everything back, I'd rather making minimal changes to the usb (only fix what's broken).
Offline
I ran some wrong command on the USB that corrupts the drive
copy all the content to the hard drive, format the usb, then copy everything back
This.
Online
formatting won't help a bad partition table.
The fdisk command makes the error obvious; the disk has 15814656 sectors, but the partition ends at sector 15824024, which doesn't exist.
Offline
I hope by "format the usb" he means to redo the device, not the partition.
The main issue is that the device has been compromised in an uncertain way. It's awesome that testdisk got access to -hopefully- all the data, but at this time, the partition and FS integrity can no longer be relied on.
One could shrink FS and partition, but I'd strongly suggest to simply "format the usb", ie. write a new partition table, create a new FS and restore the data.
Also really check that the data you recovered is indeed intact. Assigned inodes do not imply that at all.
Online