0

I had a server running a 6 disk BTRFS RAID configuration. Now my server refuses to start because of (likely) PSU issues. I have a new NAS box that I want to use for this purpose but I would like to get my data off the old setup.

So while I could go about and buy a new PSU and try to get the old system back on its feet I'd really like not having to spend the money on that since I'm just going to retire it anyway as soon as I get the data from there.

So I had an idea which may not be possible but that's why I'm here asking.

Would you think that there is any way to take these 6 individual disks, create an image of all of them, then mount the images and reconstruct the BTRFS filesystem that way?

I have a computer that I might be able to fit one large drive in and then connect the 6 individually to create the images of the 6 RAID drives but I do not have a computer which would fit all the 6 drives in.

Another issue would be how to create these disk images. Would I have to just use dd or is there some way to create image files that are smaller than the full size of the disks? It might be problematic if I have to have 6 x 4TB disk image files.

Hope somebody can help with this... either by pointing me in some (hopefully right) direction or just by saying that it can't be done.

StFS
  • 273
  • 2
  • 9
  • 1
    Use one of the ddrescue alternatives, if you are lucky you have a bunch of zeros on the disk which can end up as sparse with the right options, another alternative could be to use compression, not sure how to mount it. Qemu-img is also a great tool for some "rescue" operations. – NiKiZe Nov 20 '21 at 22:33

1 Answers1

1

Yes, this is possible and often used approach.

It is best to take the images with dd utility, so that full hard disk contents are in the image.

After you have the images, for example diskN.img, we'll use the losetup to create loop device for each disk image, which makes the image appear as a device on the system.

losetup /dev/loop0 disk1.img
losetup /dev/loop1 disk2.img
...

Now each disk image is accessible via /dev/loopN device.

Then one can use btrfs device scan to scan for filesystems from all block devices.

Tero Kilkanen
  • 34,499
  • 3
  • 38
  • 58
  • Thanks for your answer. It got me going in the right direction which eventually led to a data recovery. Turns out that the filesystem was actually ZFS but your answer still helped me get going. I ended up finding this for a more detailed step by step guide. Adding this here for completeness: https://wiki.orzfly.com/topics/zfs-on-linux-mount-raw-pool-image – StFS Nov 30 '21 at 00:46