Pages

Monday, May 12, 2014

mount x86 boot sector; partition 1 linux

mount x86 boot sector; partition 1 linux

  • I have a Full Virtualized Image of BOSS Linux ( Debian ).
  • I wanted to mount it in my linux System as I need to copy some data inside the Image.
  • I want to do some thing like this.

  1. http://blogforopensource.blogspot.com/2010/12/how-to-mount-iso-file-as-folder-in.html
  2. http://blogforopensource.blogspot.com/2010/12/how-to-work-on-pre-packed-images-img.html
  3. http://blogforopensource.blogspot.com/2013/12/mount-qcow2-linux.html

I checked the format of the Image

file edu.img

edu.img: x86 boot sector; partition 1: ID=0x83, active, starthead 32, startsector 2048, 15986688 sectors; partition 2: ID=0x83, starthead 64, startsector 15988736, 21760000 sectors, code offset 0x63


From this link, I got  Information on mounting this image.

http://major.io/2010/12/14/mounting-a-raw-partition-file-made-with-dd-or-dd_rescue-in-linux/


Run fdisk -l to find the offset

fdisk -l edu.img

Disk edu.img: 19.3 GB, 19327352832 bytes
255 heads, 63 sectors/track, 2349 cylinders, total 37748736 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
Disk identifier: 0x000e9e45

  Device Boot      Start         End      Blocks   Id  System
edu.img1   *        2048    15988735     7993344   83  Linux
edu.img2        15988736    37748735    10880000   83 
Linux


Sector Starts at 2048 and each sector is of 512 bytes long, we need to use an offset of 2048*512=1048576

To mount the image, try to map the image to a loop device.

losetup --offset 1048576 /dev/loop1  edu.img

Now mount the loop device to a folder.

mount /dev/loop1 /root/t

We have completed mounting to a loop device.

To Unmount the image , run

umount /root/t

Then Free the loop device.

losetup -d /dev/loop1

No comments:

Post a Comment