1

I have a raw disk backup of a 4TB external drive /dev/sda split into 1GiB chunks, within is a single used partition /dev/sda1 and some other junk. The chunks are being stored on multiple physical drives as they are all smaller than 4TB. What's the easiest way to mount or at least extract files in a recovery scenario?

The external drive or filesystem is having issues (mounts but explorer locks up when filesystem explored), but /dev/sda can be dd'd so I've made a backup before attempting a fix with fsck or whatever.

fdisk ouput, which fails because there's more than2^32 512 byte sectors:

[nix@nixos:/run/media/nix/23e365ee-0922-46fc-a749-f732c2e0a77d]$ fdisk -l 4tb/p.0
Disk 4tb/p.0: 1024 MB, 1073741824 bytes, 2097152 sectors
130 cylinders, 256 heads, 63 sectors/track
Units: sectors of 1 * 512 = 512 bytes

Device  Boot StartCHS    EndCHS        StartLBA     EndLBA    Sectors  Size Id Type
4tb/p.0p1    0,0,2       1023,255,63          1 4294967295 4294967295 2047G ee EFI GPT
Partition 1 has different physical/logical end:
     phys=(1023,255,63) logical=(266305,4,4)

[nix@nixos:/run/media/nix/23e365ee-0922-46fc-a749-f732c2e0a77d]$ sudo fdisk -l /dev/sda

fdisk: device has more than 2^32 sectors, can't use all of them
Disk /dev/sda: 2048 GB, 2199023255040 bytes, 4294967295 sectors
266305 cylinders, 256 heads, 63 sectors/track
Units: sectors of 1 * 512 = 512 bytes

Device  Boot StartCHS    EndCHS        StartLBA     EndLBA    Sectors  Size Id Type
/dev/sda1    0,0,2       1023,255,63          1 4294967295 4294967295 2047G ee EFI GPT
gibb
  • 19
  • 2
  • I guess you should start with the "linear mode" from [this answer](https://superuser.com/a/1074130/432690). I'm not sure if the kernel will automatically detect partitions inside the newly created `/dev/md0` or so. Even if not, you should be able to [mount with the right offset](https://superuser.com/a/1173629/432690). To know the right offset you need to examine the partition table (use `fdisk` or `gdisk`). Note the partition table is valid for logical sectors of the size either 512 or 4096 bytes. If there's a mismatch then recalculate ([example](https://unix.stackexchange.com/a/511256)). – Kamil Maciorowski Aug 20 '23 at 11:46
  • The output of `fdisk -l /path/to/the/first/chunk` and/or of `gdisk -l /path/to/the/first/chunk` may be useful. Please [edit] the question and add this information. – Kamil Maciorowski Aug 20 '23 at 11:58
  • Is the size (in bytes) of each chunk divisible by 512? You wrote they are "1GiB chunks", but is this exact? – Kamil Maciorowski Aug 20 '23 at 12:09
  • https://www.amazon.com/4tb-hard-drive/s?k=4tb+hard+drive – Joep van Steen Aug 20 '23 at 15:10
  • @Kamil Yes exact 1GiB chunks, dd'd with conv=noerror,sync – gibb Aug 23 '23 at 11:34
  • But without actual errors? ([Why this matters](https://superuser.com/a/1075837/432690)). – Kamil Maciorowski Aug 23 '23 at 11:40
  • There are some errors. First I dd'd without any conv options to see if any errors cropped up, made a note of the chunks with errors then did conv=noerror,sync to get complete 1GiB chunks. I also dd'd each chunk as a single 1GiB block fwiw. – gibb Aug 23 '23 at 11:53
  • mdadm's linear mode sounds like what I need thank you, I'll look into it more. If that doesn't work I might end up rolling my own fuse implementation that concatenates the files into a large virtual file that can be fed to mount, it might be a pain and convoluted but it has the benefit that I know how to do it. – gibb Aug 23 '23 at 11:56
  • clone the stubborn drive using ddrescue, you are creating [XY problems](https://xyproblem.info/). – Joep van Steen Aug 23 '23 at 12:01
  • @Joep I've already dd'd in 1GiB chunks, most of them completed a full 1GiB read without any conv options specified so presumably they're good with no errors. I will use ddrescue to redo the chunks that needed conv=noerror,sync to skip errors, thank you. – gibb Aug 23 '23 at 12:07
  • What's with the chunks, just get a drive large enough hdd to hold the disk image. – Joep van Steen Aug 23 '23 at 12:09
  • @Joep Venmo me £100 and I might ;) – gibb Aug 23 '23 at 12:13
  • Just occurred to me you may be able to create a JBOD 'array' using mdadm. – Joep van Steen Aug 23 '23 at 21:32

0 Answers0