Share persistent host-directory to VM

alve89

New Member
Apr 9, 2024
9
0
1
Hi all!

I'm new to Proxmox and I try to add a directory from the host (e. g. a directory on the system drive) as shared directory to the (Debian) VM. I want to use this as persistens config directory for Docker containers running inside the VM. If the VM crashes or I need to relaunch a new one, the config files should remain.

By now I added, additionally to the VMs "system" hard disk, an VirtIO Block drive on the local-zfs drive.

Is this even possible? If yes, how?

Many thanks in advance!
 
Hi,
in order to share contents between host and/or VMs you will have to use a network share such as NFS or Samba on the host.

There has been work on integrating the Plan 9 Filesystem Protocol to share a directory on the host with guest VMs, but this is not available yet, see https://lists.proxmox.com/pipermail/pve-devel/2023-April/056656.html
 
Hi,
in order to share contents between host and/or VMs you will have to use a network share such as NFS or Samba on the host.

There has been work on integrating the Plan 9 Filesystem Protocol to share a directory on the host with guest VMs, but this is not available yet, see https://lists.proxmox.com/pipermail/pve-devel/2023-April/056656.html
Just to avoid misundertstandings - by now there is no other way to create a NFS share directly on the PVE host to share it with the VMs or CTs? I found some tutorials but they mostly are about installing additional apt-packages. This seems to confirm that there is no implemented functionality within PVE.

If I understood your message wrong I'd appreciate any correction. :)

The writer of this tutorial explicitly remarks that this solution is not for production purposes. It doesn't seem to be the best way, though?


Can't I simply use a VM with OMV or TrueNAS to handle the real SATA-HDDs and provide the NFS shares?

PS: I'd like to share a ZFS-RAID1-system as well as a single (ZFS) disk.
 
Last edited:
Just to avoid misundertstandings - by now there is no other way to create a NFS share directly on the PVE host to share it with the VMs or CTs? I found some tutorials but they mostly are about installing additional apt-packages. This seems to confirm that there is no implemented functionality within PVE.
Yes, PVE is a pure hypersivor, not a NAS-hypervisor-mix like TrueNAS or Unraid. So you have to do that on your own by installing and configuring such services via CLI.

Common options are:
A) dont share a folder from the host but use a NAS VM using a virtual disk
B) directly run those NFS/SMB servers on the PVE host (makes it harder if you ever need to reinstall PVE...so have a proper documentation to redo it when needed)
C) bind-mount a folder from the PVE host into a LXC and run your SMB/NFS servers inside that LXC to have the folder to your VMs
 
Last edited:
Yes, PVE is a pure hypersivor, not a NAS-hypervisor-mix like TrueNAS or Unraid. So you have to do that on your own but installing and configuring such services via CLI.

Common options are:
A) dont share a folder from the host but use a NAS VM using a virtual disk
B) directly run those NFS/SMB servers on the PVE host (makes it harder if you ever need to reinstall PVE...so have a proper documentation to redo it when needed)
C) bind-mount a folder from the PVE host into a LXC and run your SMB/NFS servers inside that LXC to have the folder to your VMs
Thank you for your clear and understandable answer!

A question about A /C): Which option (VM or LXC) is preferable and why?
 
Benefit of A would be that it is easy to backup that data, it is migratable between PVE nodes and because of the higher isolation of VMs there are less dependencies and higher security.
Benefit of C would be that it is doing what you are asking for but be better practice than B as you usually want to run/customize stuff as less as possbile on the host.
 
  • Like
Reactions: alve89

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!