Mounting qcow2 images
modprobe nbd max_part=63
qemu-nbd -c /dev/nbd0 image.img
mount /dev/nbd0p1 /mnt/qemu
1.
root@slitaz:/usr/src/linux-2.6.37# zcat /proc/config.gz | grep -i nbd
# CONFIG_BLK_DEV_NBD is not set
2.
root@slitaz:/usr/src/linux-2.6.37# make xconfig
root@slitaz:/usr/src/linux-2.6.37# grep -i nbd .config
CONFIG_BLK_DEV_NBD=m
root@slitaz:/usr/src/linux-2.6.37# make drivers/block/
root@slitaz:/usr/src/linux-2.6.37# make drivers/block/nbd.ko
3.
root@slitaz:/usr/src/linux-2.6.37# cp drivers/block/nbd.ko /lib/modules/`uname -r`/kernel/drivers/block
root@slitaz:/usr/src/linux-2.6.37# depmod -a
4.
root@slitaz:/usr/src/linux-2.6.37# modprobe nbd max_part=63
5.
root@slitaz:/usr/src/linux-2.6.37# qemu-nbd -c /dev/nbd0 /home/tux/0000/debian_squeeze_armel_desktop.qcow2
6. root@slitaz:/usr/src/linux-2.6.37# mount /dev/nbd0p1 /mnt/image root@slitaz:/usr/src/linux-2.6.37# ls -l /mnt/image/boot total 4648 -rw-r--r-- 1 root root 69764 Jan 12 23:35 config-2.6.32-5-versatile lrwxrwxrwx 1 root root 29 Feb 28 05:15 initrd.img -> initrd.img-2.6.32-5-versatile -rw-r--r-- 1 root root 2485829 Feb 28 06:19 initrd.img-2.6.32-5-versatile -rw-r--r-- 1 root root 934684 Jan 12 23:35 System.map-2.6.32-5-versatile lrwxrwxrwx 1 root root 26 Feb 28 05:15 vmlinuz -> vmlinuz-2.6.32-5-versatile -rw-r--r-- 1 root root 1243652 Jan 12 23:34 vmlinuz-2.6.32-5-versatile root@slitaz:/usr/src/linux-2.6.37# 7. checklist root@slitaz:/usr/src/linux-2.6.37# file /home/tux/0000/debian_squeeze_armel_desktop.qcow2 /home/tux/0000/debian_squeeze_armel_desktop.qcow2: QEMU QCOW Image (v2), 17179869184 bytes root@slitaz:/usr/src/linux-2.6.37# ls drivers/block/*.ko drivers/block/cryptoloop.ko drivers/block/nbd.ko drivers/block/floppy.ko drivers/block/virtio_blk.ko root@slitaz:/usr/src/linux-2.6.37# lsmod | head -2 Module Size Used by Not tainted nbd 6665 2 root@slitaz:/usr/src/linux-2.6.37# modinfo nbd filename: /lib/modules/2.6.37-slitaz/kernel/drivers/block/nbd.ko description: Network Block Device license: GPL vermagic: 2.6.37-slitaz SMP mod_unload 486 parm: debugflags:flags for controlling debug output parm: max_part:number of partitions per device (default: 0) parm: nbds_max:number of network block devices to initialize (default: 16) root@slitaz:/usr/src/linux-2.6.37# ls /dev/nbd* /dev/nbd0 /dev/nbd1 /dev/nbd13 /dev/nbd3 /dev/nbd7 /dev/nbd0p1 /dev/nbd10 /dev/nbd14 /dev/nbd4 /dev/nbd8 /dev/nbd0p2 /dev/nbd11 /dev/nbd15 /dev/nbd5 /dev/nbd9 /dev/nbd0p5 /dev/nbd12 /dev/nbd2 /dev/nbd6 root@slitaz:/usr/src/linux-2.6.37# dmesg | grep nbd nbd: registered device at major 43 nbd0: p1 p2 < p5 > EXT4-fs (nbd0p1): mounted filesystem with ordered data mode. Opts: (null) root@slitaz:/usr/src/linux-2.6.37# fdisk -l /dev/nbd0 Disk /dev/nbd0: 17.1 GB, 17179869184 bytes 255 heads, 63 sectors/track, 2088 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/nbd0p1 * 1 2027 16275456 83 Linux /dev/nbd0p2 2027 2089 498689 5 Extended /dev/nbd0p5 2027 2089 498688 82 Linux swap root@slitaz:/usr/src/linux-2.6.37# read more.... Network Block Device (TCP version)