Advertisement
Guest User

Untitled

a guest
Feb 17th, 2017
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. How to loop mount a partition in a full disk image
  2.  
  3. ---------------------------------------------------------------------------------------------------------
  4. How to loop mount a partition in a full disk image
  5. ---
  6. Get the partition layout of the image
  7. sudo fdisk -lu /home/jc/Desktop/MMC/ampd_max2/work/ampd2Full.img
  8. ---
  9. Disk /home/jc/Desktop/MMC/ampd_max2/work/ampd2Full.img: 8120 MB, 8120172544 bytes
  10. 255 heads, 63 sectors/track, 987 cylinders, total 15859712 sectors
  11. Units = sectors of 1 * 512 = 512 bytes
  12. Sector size (logical/physical): 512 bytes / 512 bytes
  13. I/O size (minimum/optimal): 512 bytes / 512 bytes
  14. Disk identifier: 0x00000000
  15. Device Boot Start End Blocks Id System
  16. /home/jc/Desktop/MMC/ampd_max2/work/ampd2Full.img 1 * 193406 15859711 7833153 1 FAT12
  17. /home/jc/Desktop/MMC/ampd_max2/work/ampd2Full.img 2 4 126207 63102 53 OnTrack DM6 Aux3
  18. /home/jc/Desktop/MMC/ampd_max2/work/ampd2Full.img 3 189310 191357 1024 1 FAT12
  19. /home/jc/Desktop/MMC/ampd_max2/work/ampd2Full.img 4 191358 193405 1024 1 FAT12
  20. Partition table entries are not in disk order
  21. ---
  22. Calculate the offset from the start of the image to the partition start
  23. Sector size * Start = Offset
  24. 512 * 193406 = 99023872
  25. ---
  26. Mount it on /dev/loop0 using the offset
  27. sudo losetup -o 99023872 /dev/loop7 /home/jc/Desktop/MMC/ampd_max2/work/ampd2Full.img
  28. OR
  29. mount -o loop,offset=$((512 * 99023872)) /home/jc/Desktop/MMC/ampd_max2/work/ampd2Full.img /mnt/ampd2_1
  30. ---
  31. Now the partition resides on /dev/loop0. You can fsck it, mount it etc
  32. sudo fsck -fv /dev/loop7
  33. fsck.msdos
  34. sudo mount /dev/loop7 /mnt/ampd2_1
  35. ---
  36. Unmount
  37. sudo umount /mnt
  38. sudo losetup -d /dev/loop0
  39. ---------------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement