External Hard Disk - Partition damaged after power failure

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
Post Reply
Message
Author
tops
Posts: 12
Joined: 29 May 2023, 01:33

External Hard Disk - Partition damaged after power failure

#1 Post by tops »

Hello All, I need some help...

I have an external HD formatted in ext4, which, after a power failure caused by the local provider, lost several folders and files...

I ran testdisk and after some time scanning, it found some information, but when I tried to access it, it was not possible...

Finally, it suggested the test below, but I am not able to run it correctly.

Code: Select all

Christophe GRENIER <grenier@cgsecurity.org>
https://www.cgsecurity.org

Disk /dev/sdc - 3000 GB / 2794 GiB - CHS 357698 64 32

     Partition                  Start        End    Size in sectors

  Linux                    0   8  1 357698  35 21  732566389
superblock 0, blocksize=4096 []
superblock 32768, blocksize=4096 []
superblock 98304, blocksize=4096 []
superblock 163840, blocksize=4096 []
superblock 229376, blocksize=4096 []
superblock 294912, blocksize=4096 []
superblock 819200, blocksize=4096 []
superblock 884736, blocksize=4096 []
superblock 1605632, blocksize=4096 []
superblock 2654208, blocksize=4096 []

To repair the filesystem using alternate superblock, run
fsck.ext4 -p -b superblock -B blocksize device
Could you help me with this?

I believe it is possible to recover something or even everything from this hard disk...

I have Windows machines and my laptop also has Linux Mint installed, so for ext4 partitions, I believe it is the best option to use at this time, do you agree?

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

Re: External Hard Disk - Partition damaged after power failure

#2 Post by recuperation »

tops wrote: Yesterday, 14:31 Hello All, I need some help...

I have an external HD formatted in ext4, which, after a power failure caused by the local provider, lost several folders and files...

I ran testdisk and after some time scanning, it found some information, but when I tried to access it, it was not possible...
What did you find? What do you mean bei "accessing"? Using which means? TestDisk? Any explorer-type shell? What was not possible?
My crystal ball was stolen and I don't have the money to buy a new one...

Finally, it suggested the test below, but I am not able to run it correctly.
Where is your documentation of what you did and how your computer responded?

Code: Select all

Christophe GRENIER <grenier@cgsecurity.org>
https://www.cgsecurity.org

Disk /dev/sdc - 3000 GB / 2794 GiB - CHS 357698 64 32

     Partition                  Start        End    Size in sectors

  Linux                    0   8  1 357698  35 21  732566389
superblock 0, blocksize=4096 []
superblock 32768, blocksize=4096 []
superblock 98304, blocksize=4096 []
superblock 163840, blocksize=4096 []
superblock 229376, blocksize=4096 []
superblock 294912, blocksize=4096 []
superblock 819200, blocksize=4096 []
superblock 884736, blocksize=4096 []
superblock 1605632, blocksize=4096 []
superblock 2654208, blocksize=4096 []

To repair the filesystem using alternate superblock, run
fsck.ext4 -p -b superblock -B blocksize device
Could you help me with this?

I believe it is possible to recover something or even everything from this hard disk...

I have Windows machines and my laptop also has Linux Mint installed, so for ext4 partitions, I believe it is the best option to use at this time, do you agree?

Thanks...
fsck.ext4 is the equivalent for chkdsk under Windows but fsck.ext4 will only check ext4-filesystems.
Only systems providing that command can run this command. These are typically Linux systems. I don't know if some "windows subsystem für linux" provides it. So, run this command on a linux machine but do not forget to duplicate the defective disk using ddrescue as described in the manual.

As for "Could you help me with this?", be more specific.
tops
Posts: 12
Joined: 29 May 2023, 01:33

Re: External Hard Disk - Partition damaged after power failure

#3 Post by tops »

Hello...

I started by analyzing the possibly damaged disk.
I looked for folders or files that could be recovered in the disk structure.
At the end of the analysis, I received the posted recommendation and when I searched the internet for how to run the disk, I came across this message>
rodrigo@SonyVaio-VGN-NW270F:~$ sudo fsck.ext4 -p -b 0 -B 4096 /dev/sdb
[sudo] senha para rodrigo:
fsck.ext4: Bad magic number in super-block while trying to open /dev/sdb
/dev/sdb:
The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem. If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
or
e2fsck -b 32768 <device>

Found a dos partition table in /dev/sdb
recuperation
Posts: 3035
Joined: 04 Jan 2019, 09:48
Location: Hannover, Deutschland (Germany, Allemagne)

Re: External Hard Disk - Partition damaged after power failure

#4 Post by recuperation »

You should use an alternate superblock.
tops
Posts: 12
Joined: 29 May 2023, 01:33

Re: External Hard Disk - Partition damaged after power failure

#5 Post by tops »

recuperation wrote: Yesterday, 17:11 You should use an alternate superblock.
Yes, that's exactly what I'm doing right now, running them one by one until the end...

When I get to the end of all the superblocks, do you recommend that I restart my computer or issue another command?
It will still take a while to finish checking all the superblocks...


Thanks
tops
Posts: 12
Joined: 29 May 2023, 01:33

Re: External Hard Disk - Partition damaged after power failure

#6 Post by tops »

Now, the filesystem was repaired using alternates superblock as we can see below>

Code: Select all

rodrigo@SonyVaio-VGN-NW270F:~$ sudo fsck.ext4 -p -b 0 -B 4096 /dev/sdb1
/dev/sdb1: clean, 16/183148544 files, 11784420/732566389 blocks
rodrigo@SonyVaio-VGN-NW270F:~$ sudo fsck.ext4 -p -b 32768 -B 4096 /dev/sdb1
/dev/sdb1 was not cleanly unmounted, check forced.
/dev/sdb1: Padding at end of inode bitmap is not set. FIXED.
/dev/sdb1: 16/183148544 files (0.0% non-contiguous), 11784420/732566389 blocks
rodrigo@SonyVaio-VGN-NW270F:~$ sudo fsck.ext4 -p -b 98304 -B 4096 /dev/sdb1
[sudo] senha para rodrigo:          
/dev/sdb1 was not cleanly unmounted, check forced.
/dev/sdb1: Padding at end of inode bitmap is not set. FIXED.
/dev/sdb1: 16/183148544 files (0.0% non-contiguous), 11784420/732566389 blocks
rodrigo@SonyVaio-VGN-NW270F:~$ sudo fsck.ext4 -p -b 163840 -B 4096 /dev/sdb1
[sudo] senha para rodrigo:          
/dev/sdb1 was not cleanly unmounted, check forced.
/dev/sdb1: Padding at end of inode bitmap is not set. FIXED.
/dev/sdb1: 16/183148544 files (0.0% non-contiguous), 11784420/732566389 blocks
rodrigo@SonyVaio-VGN-NW270F:~$ sudo fsck.ext4 -p -b 229376 -B 4096 /dev/sdb1
[sudo] senha para rodrigo:          
/dev/sdb1 was not cleanly unmounted, check forced.
^[[6~/dev/sdb1: Padding at end of inode bitmap is not set. FIXED.
/dev/sdb1: 16/183148544 files (0.0% non-contiguous), 11784420/732566389 blocks
rodrigo@SonyVaio-VGN-NW270F:~$ sudo fsck.ext4 -p -b 294912 -B 4096 /dev/sdb1
[sudo] senha para rodrigo:          
/dev/sdb1 was not cleanly unmounted, check forced.
/dev/sdb1: Padding at end of inode bitmap is not set. FIXED.
/dev/sdb1: 16/183148544 files (0.0% non-contiguous), 11784420/732566389 blocks
rodrigo@SonyVaio-VGN-NW270F:~$ sudo fsck.ext4 -p -b 819200 -B 4096 /dev/sdb1
[sudo] senha para rodrigo:          
/dev/sdb1 was not cleanly unmounted, check forced.
/dev/sdb1: Padding at end of inode bitmap is not set. FIXED.
/dev/sdb1: 16/183148544 files (0.0% non-contiguous), 11784420/732566389 blocks
rodrigo@SonyVaio-VGN-NW270F:~$ sudo fsck.ext4 -p -b 884736 -B 4096 /dev/sdb1
[sudo] senha para rodrigo:          
/dev/sdb1 was not cleanly unmounted, check forced.
/dev/sdb1: Padding at end of inode bitmap is not set. FIXED.
/dev/sdb1: 16/183148544 files (0.0% non-contiguous), 11784420/732566389 blocks
rodrigo@SonyVaio-VGN-NW270F:~$ sudo fsck.ext4 -p -b 1605632 -B 4096 /dev/sdb1
[sudo] senha para rodrigo:          
/dev/sdb1 was not cleanly unmounted, check forced.
/dev/sdb1: Padding at end of inode bitmap is not set. FIXED.
/dev/sdb1: 16/183148544 files (0.0% non-contiguous), 11784420/732566389 blocks
rodrigo@SonyVaio-VGN-NW270F:~$ sudo fsck.ext4 -p -b 2654208 -B 4096 /dev/sdb1
[sudo] senha para rodrigo:          
/dev/sdb1 was not cleanly unmounted, check forced.
/dev/sdb1: Padding at end of inode bitmap is not set. FIXED.
/dev/sdb1: 16/183148544 files (0.0% non-contiguous), 11784420/732566389 blocks
rodrigo@SonyVaio-VGN-NW270F:~$ 
I'm restarting my PC and be with crossfingers :)
tops
Posts: 12
Joined: 29 May 2023, 01:33

Re: External Hard Disk - Partition damaged after power failure

#7 Post by tops »

Nothing... :oops: :cry:

Only 1 folder is showed, nothing more...

I will analyze the entire hard disk again, with the difference of changing the USB cable, but this cable is fine, I have already used it with other hard disks.

Very SAD!!!
recuperation
Posts: 3035
Joined: 04 Jan 2019, 09:48
Location: Hannover, Deutschland (Germany, Allemagne)

Re: External Hard Disk - Partition damaged after power failure

#8 Post by recuperation »

tops wrote: Yesterday, 22:49
recuperation wrote: Yesterday, 17:11 You should use an alternate superblock.
Yes, that's exactly what I'm doing right now, running them one by one until the end...
The repeated superblocks should be identical. Having run one repair command linux will assumably require disconnecting and reconnecting the external disk. Running one command after another without trying by disconnecting and reconnecting is not sufficient to check whether the last superblock used is healing anything.

When I get to the end of all the superblocks, do you recommend that I restart my computer or issue another command?
It will still take a while to finish checking all the superblocks...
Post Reply