[SOLVED] Can I autoadd a nfs storage after vm start(not add it in hardware )?

fcymk2

Member
Sep 7, 2019
27
3
23
40
I add a nfs storage in hardware now, but if nfs broken, vm start failed.

so I want add nfs storage after vm start as a hotplug disk.
 
not sure I get the whole picture...
if you want to boot a guest and then have the guest mount a NFS-share - yes this is usually possible (exception are unprivileged LXC-containers)
but this needs to be configured inside the guest and has little to do with the PVE-node (if it is a privileged container, you need to allow NFS as feature)

If this was not the question - please post configs, logs and explain a bit more what you want to accomplish

Thanks!
 
  • Like
Reactions: PlOrAdmin
not sure I get the whole picture...
if you want to boot a guest and then have the guest mount a NFS-share - yes this is usually possible (exception are unprivileged LXC-containers)
but this needs to be configured inside the guest and has little to do with the PVE-node (if it is a privileged container, you need to allow NFS as feature)

If this was not the question - please post configs, logs and explain a bit more what you want to accomplish

Thanks!

My guest os can't mount a NFS-share, but it need a large hardisk to use.
I add a nfs-hardisk from nfs storage(hardware->add->hardisk->storage from nfs).
But if remote nfs storage is bloken, guest can't startup.
So I want detach nfs-hardisk before guest start, after guest start, add nfs-hardisk if remote nfs storage work.
 
Please let us know how you got this to work - I cannot mount NFS share from any container or VM, yet I am able to mount the NFS share from the host and other physical Linux devices...
proxmox add remote nfs storage
nfs.jpg

guest add hardisk from nfs storage. and then I can use it in the guest like a physical hardisk
hardisk.jpg1t.jpg
 
solved .
disable guest "start at boot"
autostart in /etc/rc.local

```
#!/bin/bash

qm unlink 100 --idlist scsi1
qm start 100
i=0
while true
do
if [ -d "/mnt/pve/nfs/images" ]; then
qm set 100 -scsi1 file="nfs:100/vm-100-disk-0.raw"
break
elif [ $i -eq 30 ]; then
echo "notify admin"
~/notify.py
break
fi
let i++
sleep 1
done
```
 
FWIW - I created an Ubuntu 16.04 VM on the prox 5.4 host, and discovered that it mounts the NFS share at boot after adding the proper line in fstab .. I will continue to explore the mods for containers ...