NTFS USB HDD formatted in FAT32

My external WD USB 320 Gb HDD looks an empty FAT32 partition after an accidental formatting using a create-boot-USB Ubuntu tool. It is recognisable, readable and mountable but empty although it's almost full of data (about 300 Gb).
Testdisk can see it but after adding it to the partition table nothing changes - it still looks as an empty FAT32 partition.
Restoring an original NTFS partition is awfully desirable.
But how?!

The filesystem on the

The filesystem on the partition has been damaged by the format. You can try to use tesdisk to restore the backup MFT, but I doubt that will work.

Before you do anything to try to repair the filesystem use data carving software like Photorec to recover individual files. You will need another drive onto which you will save the recovered data since you cannot write to the drive from which you are rescuing.

Here is an example: 1- I

Here is an example:

1- I created a file onto which I will make an NTFS filesystem:

$ dd if=/dev/zero of=NTFS bs=1 count=1 seek=1G
1+0 records in
1+0 records out
1 byte (1 B) copied, 0.00998564 s, 0.1 kB/s

2- I formatted it to NTFS:

$ mkfs.ntfs -F NTFS
NTFS is not a block device.
mkntfs forced anyway.
The sector size was not specified for NTFS and it could not be obtained automatically. It has been set to 512 bytes.
The partition start sector was not specified for NTFS and it could not be obtained automatically. It has been set to 0.
The number of sectors per track was not specified for NTFS and it could not be obtained automatically. It has been set to 0.
The number of heads was not specified for NTFS and it could not be obtained automatically. It has been set to 0.
Cluster size has been automatically set to 4096 bytes.
To boot from a device, Windows needs the 'partition start sector', the 'sectors per track' and the 'number of heads' to be set.
Windows will not be able to boot from this device.
Initializing device with zeroes: 100% - Done.
Creating NTFS volume structures.
mkntfs completed successfully. Have a nice day.

$ mkdir mnt2
$ sudo mount -o loop NTFS mnt2

3- Then I copied a whole bunch of files until it ran out of space.
$ ls mnt2/ -Sh1t|wc -l
779

4- I unmounted it and formatted the device to FAT:

$ sudo umount mnt2/

$ mkfs.vfat NTFS
mkfs.vfat 3.0.1 (23 Nov 2008)
$ sudo mount -o loop NTFS mnt2
$ ls mnt2/

Nothing there!

5- Unmount and try to repair with Testdisk:

$ sudo umount mnt2
$ testdisk NTFS
(Screens not shown - I selected proceed to unpartitioned media and then Advanced, then Boot for Boot Sector Recovery) Then Quit.

$ sudo mount -t ntfs -o loop NTFS mnt2
ntfs_mst_post_read_fixup: Invalid argument
Record 0 has no FILE magic (0xffffff8)
Failed to load $MFT: Input/output error
Failed to mount '/dev/loop1': Input/output error
NTFS is either inconsistent, or there is a hardware fault, or it's a
SoftRAID/FakeRAID hardware. In the first case run chkdsk /f on Windows
then reboot into Windows twice. The usage of the /f parameter is very
important! If the device is a SoftRAID/FakeRAID then first activate
it and mount a different device under the /dev/mapper/ directory, (e.g.
/dev/mapper/nvidia_eahaabcc1). Please see the 'dmraid' documentation
for more details.

So, the filesystem is too damaged to repair.

$ photorec NTFS

Disk NTFS - 1073 MB / 1024 MiB (RO)
Partition Start End Size in sectors
P NTFS 0 0 1 130 138 9 2097153

742 files saved in /home/andy/reformat/phot/output/recup_dir directory.
Recovery completed.
jpg: 742 recovered

And they are all intact.

742 out of 779 isn't bad...

Thank you Andrew for the job

Thank you Andrew for the job you've made!
I used photorec to recover the files, but regardless any settings and conditions (I run it both from under installed Ubuntu and from USB-stick, tried different sets of settings) it stopped at the one and the same sector (almost just in the middle of the disk) with message

Segmentation fault (core dumped)

So I had to use one Windows tool to complete the recovery...