Formatting the wrong disk to fat32

How to use TestDisk to recover lost partition
Forum rules
When asking for technical support:
- Search for posts on the same topic before posting a new question.
- Give clear, specific information in the title of your post.
- Include as many details as you can, MOST POSTS WILL GET ONLY ONE OR TWO ANSWERS.
- Post a follow up with a "Thank you" or "This worked!"
- When you learn something, use that knowledge to HELP ANOTHER USER LATER.
Before posting, please read https://www.cgsecurity.org/testdisk.pdf
Locked
Message
Author
windcheetah
Posts: 4
Joined: 02 Nov 2019, 19:57

Formatting the wrong disk to fat32

#1 Post by windcheetah »

Hi, I've just tried to format/erase a SD card, via a USB reader/writer.

Unfortunately, I had not inserted it correctly, so it was not in use. As it has always been the last item in the output from fdisk -l, I used the last entry, but it was no longer the one that I should have formatted.

So, I now have a 8Tb drive, with a 2Tb fat32 partition, and the rest of the drive is marked as 'unallocated'. Before I had this disaster, it was an 8Tb drive, with 1 ext4 partition, full of videos, documents photos and the like.

I don't know if I need to recover the partition first before I can try and recover the files, or do I just try the file recovery??

Equally well, is this the correct forum??

Can someone please hold my hand and lead me through the process??

Thanks loads
Martin

User avatar
cgrenier
Site Admin
Posts: 5432
Joined: 18 Feb 2012, 15:08
Location: Le Perreux Sur Marne, France
Contact:

Re: Formatting the wrong disk to fat32

#2 Post by cgrenier »

Your first step should be to recover your Linux partition.
Select your HDD, EFI GPT, Analyze, Quick Search, Stop, Deeper Search, once your ext4 partition is found, you can choose Stop.
Set the Linux partition to P(rimary), on next screen, choose Write, confirm, Quit, restart your computer.
If fsck failed to repair your filesystem, use TestDisk, Advanced, Superblock and use the parameter given by testdisk to use fsck.

windcheetah
Posts: 4
Joined: 02 Nov 2019, 19:57

Re: Formatting the wrong disk to fat32

#3 Post by windcheetah »

Hi, thanks for the information.
Being the idiot that I am, of course, the disk is not backed up.

I propose to make a copy of the disk, before I start.

Can you please advise on the linux command to create an image of the drive, if you think that will be best??

dd if=/dev/input/DEVICE-HERE of=/dev/OUTPUT/DEVICE-HERE bs=<something quite large, (10M??)> conv=noerror,sync seems to be the most popular option.

Thanks
Martin

recuperation
Posts: 2729
Joined: 04 Jan 2019, 09:48
Location: Hannover, Deutschland (Germany, Allemagne)

Re: Formatting the wrong disk to fat32

#4 Post by recuperation »

Use ddrescue instead of dd because it's designed to handle possible read errors.

windcheetah
Posts: 4
Joined: 02 Nov 2019, 19:57

Re: Formatting the wrong disk to fat32

#5 Post by windcheetah »

Thanks very much, does it use the same command structure as dd??

I've just found dd rescue gui, it look much easier.....

A slight delay, as I ordered the wrong disk as a back up!!!! :oops: :oops: :oops: :lol: :lol: :lol:

recuperation
Posts: 2729
Joined: 04 Jan 2019, 09:48
Location: Hannover, Deutschland (Germany, Allemagne)

Re: Formatting the wrong disk to fat32

#6 Post by recuperation »

windcheetah wrote: 12 Nov 2019, 20:52 Thanks very much, does it use the same command structure as dd??
I don't know. I either find my cheet sheet with a typical command inside or I reread the manual.
I do not see any use for dd anymore.

windcheetah
Posts: 4
Joined: 02 Nov 2019, 19:57

Re: Formatting the wrong disk to fat32

#7 Post by windcheetah »

This is what I did, not having seen this web site, but I couldn't remove the drive, unless I get the screw driver out and unplug the cables!!!
Remove from your computer or laptop any external storage device other than the SD card which will be formatted (USB sticks, external HDDs, etc.)
to avoid the risk of formatting the wrong device (and permanently losing files).
It would appear that the superblocks have been lost/corrupted.

Attached is the log file for when I tried to locate the superblocks http://www.windcheetah.org.uk/DataRecov ... rblock.txt

This didn't work too well as the result suggested that I use "To repair the filesystem using alternate superblock, run fsck.ext4 -p -b superblock -B blocksize device"

So I ran

Code: Select all

sudo fsck.ext4 -p -b 2654208 -B 4096 /dev/sdb
which then created this output: http://www.windcheetah.org.uk/DataRecov ... Output.txt

This then produced superblocks at
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848, 512000000, 550731776, 644972544, 1934917632
This was created from

Code: Select all

sudo mke2fs -n /dev/sdb
and oddly, the same superblocks were found when I ran

Code: Select all

sudo mke2fs -n /dev/sdb1
Which is correct /dev/sdb - the device, the disk, /dev/sdb1 - the partition???

Any thoughts would be most useful.
Please note that all this is being done on the copy of the disk that I mangled, so if it does not work, not to worry!!!!!

recuperation
Posts: 2729
Joined: 04 Jan 2019, 09:48
Location: Hannover, Deutschland (Germany, Allemagne)

Re: Formatting the wrong disk to fat32

#8 Post by recuperation »

Which is correct /dev/sdb - the device, the disk, /dev/sdb1 - the partition???
You normally create file systems on partitions.
I use linux only for recovery purposes - I am not familiar with ext4.

The first google search for "man mkefs" gives me:
https://linux.die.net/man/8/mkfs.ext4

stating "mke2fs is used to create an ext2, ext3, or ext4 filesystem, usually in a disk partition."

Locked