Monday, 26 September 2016

mounting drives specifying offset


$ ls /dev/sda*
/dev/sda  /dev/sda1  /dev/sda2  /dev/sda5

$ sudo fdisk -l /dev/sda
Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 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: 0x5c7f4b84

Device     Boot   Start       End   Sectors   Size Id Type
/dev/sda1          2048    999423    997376   487M 83 Linux
/dev/sda2       1001470 976771071 975769602 465.3G  5 Extended
/dev/sda5       1001472 976771071 975769600 465.3G 8e Linux LVM

$ sudo mount /dev/sda2 /mnt/sda2
mount: wrong fs type, bad option, bad superblock on /dev/sda2,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.
The offset here is 1001470*512 bytes = 512752640 to get to the second partition:

sudo mount -o ro,loop,offset=512752640 /dev/sda /mnt/sda2/
If using an image file, use the filename instead of /dev/sda

No comments:

Post a Comment