---
title: "Share a Folder Between KVM Host and Guest"
tags:
date: "2012-09-11"
published: false
---
I often find myself in situations where I need to share information
or files between a KVM host and KVM guest. With libvirt version 0.8.5
and newer there is support for mounting a
shared folder between a host and guest. I decided to try this out on
my Fedora 17 host, with a Fedora 17 guest.
Using the libvirt
<filesystem>
xml tag I created the following xml that defines a filesystem device.
<filesystem type='mount' accessmode='mapped'> <source dir='/tmp/shared'/> <target dir='tag'/> </filesystem>
virsh edit
F17
where F17 is the domain name of my guest. This opens the
guest xml in the VI text editor. I then inserted the xml at the end of
the <devices>
section of the guest xml, closed VI, and started the guest.
[root@F17 ~]# mount -t 9p -o trans=virtio,version=9p2000.L tag /mnt/shared/
sudo setenforce 0
in the host.