0

I have a raw disk image created by gddrescue. I'm failing on getting it mounted since to it's complex partition structure.

I tried first with losetup portscan option.

# losetup -Pf --show -v silvio-extern.iso 
/dev/loop0

# fdisk -lu /dev/loop0

Disk /dev/loop0: 298,1 GiB, 320072933376 bytes, 625142448 sectors
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: 0x88c8fbd4

Device       Boot Start       End   Sectors   Size Id Type
/dev/loop0p1         63 625137344 625137282 298,1G  7 HPFS/NTFS/exFAT

# fdisk -lu /dev/loop0p1 

Disk /dev/loop0p1: 298,1 GiB, 320070288384 bytes, 625137282 sectors
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: 0x444c544e

Device         Boot      Start        End    Sectors  Size Id Type
/dev/loop0p1p1 ?    1768778098 1776409558    7631461  3,7G 6b unknown
/dev/loop0p1p2 ?    1830843506 3225479386 1394635881  665G 75 PC/IX
/dev/loop0p1p3 ?    1718906437 1718909009       2573  1,3M 41 PPC PReP Boot
/dev/loop0p1p4      2827157504 2827210421      52918 25,9M  0 Empty

Partition table entries are not in disk order.

# fdisk -lu /dev/loop0p1p2
fdisk: cannot open /dev/loop0p1p2: No such file or directory

Partition size tells me that I'm interested in /dev/loop0p1p2.

I tried to create a loop device manual. If I got it right I need an offest of Start * Sector size (1830843506 * 512 = 937391875072) and a sizelimit of Sectors * Sector size (1394635881 * 512 = 714053571072). But it doesn't work:

# losetup -o 937391875072 --sizelimit 714053571072 --show -v -f /dev/loop0p1
/dev/loop1

# fdisk -lu /dev/loop1
fdisk: cannot open /dev/loop1: Inappropriate ioctl for device

# mount /dev/loop1 content/
mount: /dev/loop1 is write-protected, mounting read-only
mount: wrong fs type, bad option, bad superblock on /dev/loop1,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.

So I gave kpartx a change. But it was the same:

# kpartx -av silvio-extern.iso 
add map loop0p1 (253:2): 0 625137282 linear /dev/loop0 63

# fdisk -lu /dev/loop0p1

Disk /dev/loop0p1: 298.1 GiB, 320070288384 bytes, 625137282 sectors
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: 0x444c544e

Device         Boot      Start        End    Sectors  Size Id Type
/dev/loop0p1p1 ?    1768778098 1776409558    7631461  3.7G 6b unknown
/dev/loop0p1p2 ?    1830843506 3225479386 1394635881  665G 75 PC/IX
/dev/loop0p1p3 ?    1718906437 1718909009       2573  1.3M 41 PPC PReP Boot
/dev/loop0p1p4      2827157504 2827210421      52918 25.9M  0 Empty

Partition table entries are not in disk order.

# fdisk -lu /dev/loop0p1p2
fdisk: cannot open /dev/loop0p1p2: No such file or directory

I then tried to run losetup with portscan option but didn't to succeeded:

# losetup -Pf --show -v /dev/loop0p1 
/dev/loop1

# fdisk -lu /dev/loop1

Disk /dev/loop1: 298.1 GiB, 320070288384 bytes, 625137282 sectors
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: 0x444c544e

Device       Boot      Start        End    Sectors  Size Id Type
/dev/loop1p1 ?    1768778098 1776409558    7631461  3.7G 6b unknown
/dev/loop1p2 ?    1830843506 3225479386 1394635881  665G 75 PC/IX
/dev/loop1p3 ?    1718906437 1718909009       2573  1.3M 41 PPC PReP Boot
/dev/loop1p4      2827157504 2827210421      52918 25.9M  0 Empty

Partition table entries are not in disk order.

# fdisk -lu /dev/loop1p2
fdisk: cannot open /dev/loop1p2: No such file or directory

I gave kpartx a try on /dev/loop0p1 and got some error messages:

# kpartx -av /dev/loop0p1 
device-mapper: reload ioctl on loop0p1p1 failed: Invalid argument
create/reload failed on loop0p1p1
add map loop0p1p1 (0:0): 0 7631461 linear /dev/loop0p1 1768778098
device-mapper: reload ioctl on loop0p1p2 failed: Invalid argument
create/reload failed on loop0p1p2
add map loop0p1p2 (0:0): 0 1394635881 linear /dev/loop0p1 1830843506
device-mapper: reload ioctl on loop0p1p3 failed: Invalid argument
create/reload failed on loop0p1p3
add map loop0p1p3 (0:0): 0 2573 linear /dev/loop0p1 1718906437
device-mapper: reload ioctl on loop0p1p4 failed: Invalid argument
create/reload failed on loop0p1p4
add map loop0p1p4 (0:0): 0 52918 linear /dev/loop0p1 2827157504

Just to mention: Auto mount in Ubuntu 16.04 works fine with original disk.

Anybody has any idea?

I'm trying to mount disk image with Debian 8.


As suggested by @Kamil Maciorowski I've tried to mount image file directly with offset option. This one gives me an Input/output error when listing content:

# mount -o offset=$((512*63)) silvio-extern.iso content/
# ls -l content/
ls: reading directory content/: Input/output error
total 0

I've double checked offset with fdisk against image file:

# fdisk -lu silvio-extern.iso 

Disk silvio-extern.iso: 298.1 GiB, 320072933376 bytes, 625142448 sectors
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: 0x88c8fbd4

Device             Boot Start       End   Sectors   Size Id Type
silvio-extern.iso1         63 625137344 625137282 298.1G  7 HPFS/NTFS/exFAT
2
  • 1
    Why would there be nested partitions?
    – Daniel B
    Sep 26, 2016 at 14:22
  • @DanielB I've no idea. I haven't created or even used that disk. I just got it after it was broken. Kamil Maciorowski included a possible reason therefore in his answer.
    – jelhan
    Sep 26, 2016 at 16:41

1 Answer 1

2

The partition table is very simple: one NTFS partition at common offset.

sudo mount -o offset=$((512*63)) silvio-extern.iso /path/to/mountpoint

The command fdisk -lu /dev/loop0p1 reads the actual NTFS partition as if it was a disk with a partition table (although it seems strange to me you already had /dev/loop0p1, kpartx was used later). In many such cases fdisk warns that partition table looks weird, maybe wrong device was chosen.

Here, I guess, the "inner partition table" was not weird enough to trigger the warning. Still "partitions" are not in order, they are of uncommon types, their offsets and sizes don't make sense. In my opinion this "inner partition table" is invalid, such partition setup would be very strange. I think there is just one NTFS partition that shouldn't be treated as a partitioned device. You can mount it with the above command.


Note that you probably don't need losetup. I think your fdisk can read the image file just fine:

fdisk -lu silvio-extern.iso

From its output you can tell the offset 512*63 to use with the mount command (as shown above), without losetup at all.

4
  • I also tried that one but I'm getting an Input/output error when trying to list content of directory where I have mounted image file with offset. I've added more information to question.
    – jelhan
    Sep 26, 2016 at 16:36
  • @jelhan Mounting itself is successful, I still think this is the right thing to do. This error may indicate a problem with NTFS filesystem or, I guess, your physical device (where the image is located). Is there something interesting in dmesg (dmesg | tail -n 20) just after the error? Sep 26, 2016 at 17:48
  • @jelhan It seems somthing may be not right with the NTFS filesystem. You may consider mounting in read-only mode to avoid further corruption. In your case this will be mount -o ro,offset=… Sep 26, 2016 at 17:55
  • So maybe the image created by gddrescue is corrupt. Haven't got the time to create another one. Will accept your answer.
    – jelhan
    Oct 3, 2016 at 3:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.