Cover Image

# Share folder between host linux and Archlinux VM

October 14, 2023 - Reading time: 3 minutes

In this guide we will share a folder from our host linux machine into an archlinux virtual machine which is being run by virt-manager.

You can check the instructions of how to install the Archlinux VM here.

Note: the share folder will be available for Read-Only to the virtual machine by default, therefore you will be able to only share from host machine to the VM (not vice versa).

Step 1

Create a folder in your host machine which you want to share with the Virtual Machine later.

Step 2

Inside virt-manager, choose the Archlinux VM, 'Open' (the screen icon above), and then the lightbulb icon in the window that opens up.

Now click "Add Hardware" in the lower-left side and choose 'Filesystem' (a folder icon).

Set 'Driver' to 'virtio-9p'.

Set source path to the folder in host machine that you wish to share. For example my folder on host is called 'sharedhost'.

In target path type:

/shareddata

This will be the name of mount drive inside the VM that we will mount in the next steps.

Step 3

Start the virtual machine by clicking on the 'Play' button. Log in.

Open terminal app, and make the directory which will be the folder receiving the files from the host's shared directory:

mkdir ~/shared

Step 4

Now run this command in terminal to open the connection between host's and guest's (VM's) sharing folders, using virtio-9p protocol:

sudo mount -t 9p -o trans=virtio /shareddata ~/shared

ABOUT

Welcome, I am GalacticKreplach. This is my documentation blog for guides, fixes, bugs and updates. Enjoy the content, comment and share your insights.

Hit Counter

23