O'Reilly logo

KVM Virtualization Cookbook by Konstantin Ivanov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

There's more...

If the iSCSI target server does not have any available block devices to export, we can create a new block device using a regular file by following the steps outlined here:

  1. Create a new image file of a given size:
root@iscsi_target:~# truncate --size 10G xvdb.imgroot@iscsi_target:~# file -s xvdb.imgxvdb.img: dataroot@kvmiscsi_target:~# qemu-img info xvdb.imgimage: xvdb.imgfile format: rawvirtual size: 10G (10737418240 bytes)disk size: 0root@iscsi_target:~#
  1. Ensure that the loop kernel module is compiled in (or load it with modprobe loop) and find the first available loop device to use:
root@iscsi_target:~# grep 'loop' /lib/modules/`uname -r`/modules.builtinkernel/drivers/block/loop.koroot@iscsi_target:~# losetup --find ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required