You are not logged in.

#1 2024-03-22 10:47:22

0BADC0DE
Member
From: Regnum Utriusque Siciliae
Registered: 2018-02-21
Posts: 268

[SOLVED] How to recover files+directory structure from RAID1 dump?

My RAID-1 NAS just failed. I mean, the NAS itself, not its 2 disks: I am pretty sure those disks are intact.

I already dumped both disks on my ArchLinux box and would like to restore the contents locally to put them back on a new NAS.
I can see that it was a Linux software raid (mdadm) with LVM2 and EXT3 fs.
I could use photorec on one of the images, but then I would loose all the metadata, mainly filenames and directory structure.
I know also about "ext4magic" but in my case I m not interested into deleted files.

Ideally I would reassemble (if needed) the RAID-1 devices, re-store the LVM2 volume and mount to dump the contents with a "simple" `cp -a src dst`  command.

Any hint on how to proceed?

Last edited by 0BADC0DE (2024-03-22 12:29:34)


Maybe Computers Will Never Become As Intelligent
As Humans. Surely They Won't Ever Become So Stupid.

Offline

#2 2024-03-22 12:38:27

0BADC0DE
Member
From: Regnum Utriusque Siciliae
Registered: 2018-02-21
Posts: 268

Re: [SOLVED] How to recover files+directory structure from RAID1 dump?

I used losetup to mount the images as loop devices and check.

losetup /dev/loop1 ./hd1p3.img
losetup /dev/loop2 ./hd2p3.img
losetup

Then I used mdadm to re-assemble the RAID-1 device and check it:

sudo mdadm --assemble /dev/md0 /dev/loop1 /dev/loop2
sudo mdadm --detail --scan

The I did a few extra LVM-based activities to check, fix (there was  warning about "using old PV header") and activate the volume:

sudo lvscan
sudo vgscan
sudo pvscan
sudo sudo vgck --updatemetadata YOUR_VOLUME_GROUP_NAME
sudo lvchange -aey /dev/YOUR_VOLUME_GROUP_NAME/YOUR_VOLUME_NAME

And finally I could mount the volume to copy files:

sudo mount /dev//dev/YOUR_VOLUME_GROUP_NAME/YOUR_VOLUME_NAME ./recovery_dir

Done!


Maybe Computers Will Never Become As Intelligent
As Humans. Surely They Won't Ever Become So Stupid.

Offline

Board footer

Powered by FluxBB