Skip to content

Instantly share code, notes, and snippets.

@macdet
Forked from olokelo/readme.md
Created February 15, 2024 08:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save macdet/ec0968b08ca9438fea23b0323ab5b699 to your computer and use it in GitHub Desktop.
Save macdet/ec0968b08ca9438fea23b0323ab5b699 to your computer and use it in GitHub Desktop.
Proxmox 9P Configuration - Youtube shownotes

My Youtube Video

https://youtu.be/glbiWWx52Sk

Variables

  • shared directory name - Arbitrary directory name that you want to share with Guest. I recommend using the same in Guest and Host to avoid confustion.
  • virtual machine id - An ID of Virtual Machine that will have access to shared directory. The ID is visible in proxmox and will usually be 3 digit: 100, 101.. .
  • mount tag - Unique tag that identifies which shared directory needs to be the same in both Host and Guest configuration.

Proxmox Configuration

$ zfs create -o mountpoint=/9pshare -o acltype=posixacl -o xattr=sa -o aclinherit=passthrough rpool/9pshare
$ mkdir /9pshare/<shared directory name>
$ nano /etc/pve/qemu-server/<virtual machine id>.conf

Add a line that says:

args: -virtfs local,path=/9pshare/<shared directory name>,mount_tag=<mount tag>,security_model=mapped-xattr,id=fs0

Save the file and start VM.

VM Configuration (as root)

Make sure the following kernel modules are loaded: 9p, 9pnet, 9pnet_virtio.

Then edit the fstab file:

$ mkdir /<shared directory name>
$ nano /etc/fstab

Add the following line:

<mount tag> /<shared directory name>    9p  trans=virtio,version=9p2000.L,nobootwait,rw,msize=524288,user_xattr,posixacl,_netdev    0   0

Save fstab and check it for errors:

$ mount -a

That's all :)

Benchmark 9p on VM (optional, as root)

$ apt update; apt install fio
$ fio --name=write_throughput --directory=/<shared directory name> --numjobs=4 --size=4G --time_based --runtime=180s --ramp_time=2s --ioengine=libaio --direct=1 --verify=0 --bs=1M --iodepth=64 --rw=write --group_reporting=1 --iodepth_batch_submit=64 --iodepth_batch_complete_max=64

References and Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment