Perform the following steps outlined to partition and create a filesystem on the blank image:
- Load the nbd kernel module:
root@kvm:~# modprobe nbd root@kvm:~#
- Using the qemu-nbd tool, associate the blank image file to the /dev/nbd0 block device:
root@kvm:~# qemu-nbd --format=raw --connect=/dev/nbd0 debian.img root@kvm:~#
- Create two partitions on the block device. One will be used for swap, and the other as the root partition for the guest OS:
root@kvm:~# sfdisk /dev/nbd0 << EOF >,1024,82 >; >EOF Checking that no-one is using this disk right now ...OKDisk /dev/nbd0: cannot get geometryDisk /dev/nbd0: 1305 cylinders, 255 heads, 63 sectors/tracksfdisk: ERROR: sector 0 does not have an msdos signature /dev/nbd0: unrecognized ...