17 Jul 2016

Linux: einzelne Partitionen in einem Disk-Image mounten

Wenn man von einer Festplatte ein komplettes Image gezogen hat, will man danach die einzelnen Partitionen mounten.

Mit der Angabe eines Offsets ist das kein Problem!

  • zuerst kann man mit fdisk die Partitionen innerhalb des Images ansehen:
 ~ # fdisk -l image.img 
 Disk image.img: 232.9 GiB, 250059350016 bytes, 488397168 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: 0xabababab 
 
 Device Boot Start End Sectors Size Id Type 
 image.img1 * 2048 206847 204800 100M 7 HPFS/NTFS/exFAT 
 image.img2 206848 204795903 204589056 97.6G 7 HPFS/NTFS/exFAT 
 image.img3 204796620 488375999 283579380 135.2G f W95 Ext'd (LBA) 
 image.img5 204796683 488375999 283579317 135.2G 7 HPFS/NTFS/exFAT 
  • Die Offsets mit parted genau anzeigen, dazu Einheit wählen
 ~ # parted image.img 
 GNU Parted 3.2 
 Using ~/image.img 
 Welcome to GNU Parted! Type 'help' to view a list of commands. 
 (parted) unit 
 Unit? [compact]? b 
 (parted) p 
 Model: (file) 
 Disk ~/image.img: 250059350016B 
 Sector size (logical/physical): 512B/512B 
 Partition Table: msdos 
 Disk Flags: 
 
 Number Start End Size Type File system Flags 
 1 1048576B 105906175B 104857600B primary ntfs boot 
 2 105906176B 104855502847B 104749596672B primary ntfs 
 3 104855869440B 250048511999B 145192642560B extended lba 
 5 104855901696B 250048511999B 145192610304B logical ntfs 
 
 (parted) quit 
  • Mounten je nach belieben
~ # mount -o loop,ro,offset=105906176 image.img /media/test/ 
~ # mount -o loop,ro,offset=104855901696 image.img /media/test2