I want to mount a previous Synology basic volume (wasn't using RAID or SHR) to copy data to a new drive.
Plug it in the USB port doesn't work, showing (Partition 1 does not start on phyical sector boundary).
# fdisk -l
Disk /dev/sdr: 2.7 TiB, 3000558944256 bytes, 5860466688 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x00000000
Device Boot Start End Sectors Size Id Type
/dev/sdr1 1 4294967295 4294967295 2T ee GPT
Partition 1 does not start on physical sector boundary.
Calling mount would gives another error:
# mount /dev/sdr oldVolume/
mount: /dev/sdr: can't read superblock
The issue is that there is MD superblock at the beginning of the disk.
This StackOverflow anwser provides a solution,
which is to use a loop mount to mount a partition as a device and skip the superblock.
If we use losetup /dev/loop0 /dev/sdd3 -o 1048576
directly, it is gonna mount the first partition, which is a 2.3G partition that contain system files (hidden from Synology UI).
What I am interested in is the actual data partition.
To find the offset for that, we can look at other drives that has similar partition structure:
# fdisk -l
Disk /dev/sda: 894.3 GiB, 960197124096 bytes, 1875385008 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x29b632b9
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 4982527 4980480 2.4G fd Linux raid autodetect
/dev/sda2 4982528 9176831 4194304 2G fd Linux raid autodetect
/dev/sda3 9437184 1875180191 1865743008 889.7G fd Linux raid autodetect
/dev/sda
is another 1T drive in the system. From the above, we can see the data partition starts at 9437184th block.
Since we have 512 bytes per block, the byte offset for the data partition is 9437184 * 512 = 4831838208.
Thus we can use the following to mount the partition (make sure /dev/loop1000 and /dev/md1000 don't exist):
losetup /dev/loop1000 /dev/sdr -o 4831838208
mdadm --assemble --run /dev/md1000 /dev/loop1000
mount /dev/loop1003 /mnt/oldVolume
Very helpful to me, thank you.
This is my partition structure(in Synology DSM 6.2), and the above mounting method also works in this situation.