On 15/06/2024 17:36, Phil Ashby wrote:
Bah. Looks like sfdisk is happy to read the partition table from the raw array device, but losetup doesn't like using a block device as backing. I'll try that myself here to confirm.
You could also try the linked short name (/dev/dm-0).
Might need to attempt the same trick with device mapper which is a bit more involved - time to hit the search engine..
..so I tried this myself using a USB stick with a couple of partitions on (actually a Debian installer CD+USB image with an NTFS storage partition at the end) and it works just fine..
--- root@bruce:~# sfdisk -l /dev/sda Disk /dev/sda: 59.16 GiB, 63518539776 bytes, 124059648 sectors Disk model: Cruzer Switch Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0xc7e6ef99
Device Boot Start End Sectors Size Id Type /dev/sda1 * 64 2994047 2993984 1.4G 0 Empty /dev/sda2 7004 17243 10240 5M ef EFI (FAT-12/16/32) /dev/sda3 2994176 124059647 121065472 57.7G 7 HPFS/NTFS/exFAT ---
..I'm going to use partition 3 (NTFS) as an example: 2994176*512=1533018112
--- root@bruce:~# losetup -o 1533018112 -b 512 -f /dev/sda root@bruce:~# losetup -a /dev/loop0: [0005]:2073 (/dev/sda), offset 1533018112 root@bruce:~# mount -o ro /dev/loop0 /mnt root@bruce:~# ls -l /mnt total 0 -rwxrwxrwx 1 root root 0 Jun 15 19:27 welcome-to-NTFS.txt ---
Not sure what's going on with your assembled array device? It must be readable for sfdisk to see a GPT.. best of luck!
P.