Volume is down, can I still restore the data?

Marvell Kirkwood based
Mijzelf
Posts: 6207
Joined: Mon Jun 16, 2008 10:45 am

Re: Volume is down, can I still restore the data?

Post by Mijzelf » Thu Feb 09, 2017 6:40 pm

The only way I am aware of is

Code: Select all

e2fsck <device>
Maybe with the -p or -y option to prevent to have to type 'y' numerous times.
Luca127 wrote:I don't want to risk anything.
You still have a bitwise backup, don't you?

Anyway, I'm curious if e2fsck from Entware-ng succeeds in detecting the right size of the raid array. I think it's not possible to repair if it doesn't. The superblocks are located on certain percentages of the volume size.
If it doesn't show the right size, it should be possible to create a loop device, or to edit the partition table to be able to skip the raid array.

Luca127
Posts: 9
Joined: Thu Jan 26, 2017 3:57 pm

Re: Volume is down, can I still restore the data?

Post by Luca127 » Thu Feb 16, 2017 5:46 pm

Yes sure. I executed the repair command and this was the output:

Code: Select all

 e2fsck.new /dev/md0
e2fsck 1.41.14 (22-Dec-2010)
The filesystem size (according to the superblock) is 488249232 blocks
The physical size of the device is 488249198 blocks
Either the superblock or the partition table is likely to be corrupt!
Abort<y>? no

/dev/md0 contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/md0: 496661/122068992 files (9.5% non-contiguous), 423805863/488249232 blocks

And for sda2

Code: Select all

 e2fsck.new /dev/sda2
e2fsck 1.41.14 (22-Dec-2010)
e2fsck.new: Device or resource busy while trying to open /dev/sda2
Filesystem mounted or opened exclusively by another program?
I unmounted sda2, but the message continous to appear.

Mijzelf
Posts: 6207
Joined: Mon Jun 16, 2008 10:45 am

Re: Volume is down, can I still restore the data?

Post by Mijzelf » Thu Feb 16, 2017 7:41 pm

OK, let's try a loop device, to see if e2fsck then can see the right physical size.

According to your mdadm dumps, the data on the raid array starts at 2048 sectors. A sector is 512 bytes, so it starts at 1048576 bytes. Using a loop device we can create a virtual disk, which starts at a relative posiiton on /dev/sda2.

First find out which loop devices are already in use:

Code: Select all

losetup -a
When I remember well, the ZyXEL firmware has 1 loopdevice in use, so loop0 is unavailable. Assuming you can use loop1:

Code: Select all

# stop the array
mdadm --stop /dev/md0
losetup -o 1048576 /dev/loop1 /dev/sda2
e2fsck.new /dev/loop1

Post Reply