3

I'm using qemu for different kind of tasks, I would like to pick a filesystem that is both qemu-compatible and easy to mount under my host.

I already discarded both qcow and qcow2 because apparently they are not supported as filesystem by the linux kernel, there is a little trick but it doesn't meet my needs, I basically need to write and read freely from/to this image file, not just take a look when this image is hotplugged to qemu.

Could you suggest a way to create a qemu filesystem that will be usable under a GNU/Linux host as any other partition/hard disk ?

3

Instead of using an image file (or in addition to an image file) you can use a block device (LVM or loop device) and pass this to the VM (which sees it as disk drive). You can mount it from the guest and from the host. But you should make sure this is not done simultaneously.

The obvious disadvantage: This volume does not grow with the need. But you can extend the block device / loop device file later and adapt the filesystem to the new size.

libvirt configuration

This is not pure QEMU but if you use libvirt then you need entries like this:

<disk type='block' device='disk'>
  <driver name='qemu' type='raw'/>
  <source dev='/dev/mapper/storage-user'/>
  <target dev='vdb' bus='virtio'/>
  <serial>KVM-user</serial>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
</disk>
  • Could you expand a little bit more with the related terminal commands. – user2485710 May 3 '14 at 2:35
  • @user2485710 That's a bit beyond the scope of a single answer. If you don't use LVM yet then you should read about that first. If you already use it then I hope there is some configuration tool. The alternative commands are lvcreate and lvresize. An image file can be created with dd if=/dev/zero of=imagefile.img bs=1M count=1024 (for 1GiB size). The loop device command is losetup. A file system is made with e.g. mke2fs (depending on the wanted filesystem). I add some VM info to the answer. – Hauke Laging May 3 '14 at 2:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.