Linux – filesystem that works under qemu and I can mount on the host

filesystemskernellinuxlinux-kernelqemu

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 ?

Best Answer

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>
Related Question