This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
converting_a_partition_image_to_a_disk_image [2009/09/14 18:31] Michael Fenn created |
converting_a_partition_image_to_a_disk_image [2011/09/10 17:37] (current) |
||
---|---|---|---|
Line 4: | Line 4: | ||
First, create an empty disk (raw format) | First, create an empty disk (raw format) | ||
- | <code> | + | <code bash> |
qemu-img create -f raw 10G starworker.img | qemu-img create -f raw 10G starworker.img | ||
</code> | </code> | ||
Line 11: | Line 11: | ||
Next we will need to mount the root partition of the VM offline. To do this, we will need to use fdisk on the disk image to find the start of the root partition. | Next we will need to mount the root partition of the VM offline. To do this, we will need to use fdisk on the disk image to find the start of the root partition. | ||
- | <code> | + | <code bash> |
fdisk -lu starworker.img | fdisk -lu starworker.img | ||
</code> | </code> | ||
Line 17: | Line 17: | ||
Now mount the both the new and old filesystems and copy the files. | Now mount the both the new and old filesystems and copy the files. | ||
- | <code> | + | <code bash> |
- | mount -o loop starworker_partimg /mnt/looppart/ | + | mount -o loop starworker_part.img /mnt/looppart/ |
mount -o loop,offset=$(( $START * $UNITS )) starworker.img /mnt/loopdisk/ | mount -o loop,offset=$(( $START * $UNITS )) starworker.img /mnt/loopdisk/ | ||
cp -a /mnt/looppart/* /mnt/loopdisk | cp -a /mnt/looppart/* /mnt/loopdisk |