Mounting RAW image Disks

Recently I needed to do a fsck on KVM disk image (qcow) with LVM.

Before get hands on VM and start on single mode ,start vnc, do the homework, sign the papers, get married and blah blah blah, I choose mount the image partition and check it with fsck without the VM started..

Here is how I did:

/usr/bin/qemu-nbd -c /dev/nbd0 image.img
/sbin/vgscan
/sbin/lvscan

With this, /dev/nbd0 comes in the disk, /dev/nbd0p1 /dev/nbd0p2 are the partitions you have in.

Now you can do the fsck, mount and use the image disk like a device disk.

Leave a Reply

Your email address will not be published. Required fields are marked *

*