We will write a bash script and create a cron job that will automatically mount bind our NAS shares (NFS/SMB/CIFS) running on Proxmox VM to unprivileged LXC containers (also on Proxmox) after reboot.
Commands used in the video:
***********
mount.sh script:
#!/usr/bin/env bash
qm start 202
until [ "$(qm status 202 | awk '{print $2}')" == "running" ];
do
sleep 2
done
sleep 20
mount -t cifs -o user=smbuser,password=marekpass //192.168.1.202/MiniPC /mnt/minipc
sleep 20
lxc-start -n 203
**********
crontab -e:
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
@reboot /usr/bin/bash /opt/scripts/mount.sh
*********
== TIMESTAMPS ==
0:00 bind mount that works after reboot
14:00 writing bash script
19:35 creating cron job
You might also want to watch following videos:
Read AND WRITE from unprivileged LXC container to Proxmox SMB / NFS / CIFS / NAS share:
• Read AND WRITE from unprivileged LXC conta...
Bind mount NAS (CIFS/SMB/NFS) shares to Unprivileged LXC Proxmox container:
• Bind mount NAS (CIFS/SMB/NFS) shares to Un...
🔥🔥 Join n8n, AI Agents, Proxmox, Linux and Devops hands-on training: https://www.automation-avenue.com 🔥🔥
📧 Email: [email protected] 📧
== 28 ==