Mounting KVM image

Alex mysqlstudent at gmail.com
Tue Jun 15 04:11:46 UTC 2010


Hi,

> OK, here's your problem: the offset option for losetup was not properly
calculated.
> http://www.campworld.net/thewiki/pmwiki.php/Linux/DiskImagesHOWTO

Yes, you're right, but your calculation were also wrong. It's 512, not 1024.
The link you sent was a great help in getting it working properly. Here is
the full command list, for the archives:

[root at fedora ~]# fdisk -ul systmp-kvm.raw
You must set cylinders.
You can do this from the extra functions menu.

Disk systmp-kvm.raw: 0 MB, 0 bytes
255 heads, 63 sectors/track, 0 cylinders, total 0 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: 0x00000000

         Device Boot      Start         End      Blocks   Id  System
systmp-kvm.raw1   *           1       48194       24097   83  Linux
systmp-kvm.raw2           48195    83875364    41913585   85  Linux extended
Partition 2 has different physical/logical endings:
     phys=(1023, 254, 63) logical=(5220, 254, 63)
systmp-kvm.raw5           48196    81979694    40965749+  83  Linux
systmp-kvm.raw6        81979696    83875364      947834+  82  Linux swap /
Solaris
[root at fedora ~]# losetup -a
[root at fedora ~]# losetup /dev/loop0 systmp-kvm.raw
[root at fedora ~]# losetup -o $((1*512)) /dev/loop1 /dev/loop0
[root at fedora ~]# losetup -o $((48196*512)) /dev/loop2 /dev/loop0
[root at fedora ~]# mount /dev/loop2 /mnt/mytest
[root at fedora ~]# mount /dev/loop2 /mnt/mytest/boot

The image is now mounted, and can be accessed from /mnt/mytest.

Regards,
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.fedoraproject.org/pipermail/users/attachments/20100615/7fef71ff/attachment.html 


More information about the users mailing list