From f178b8a654db6c17a4bbb4a3347dc81c5dd45bb6 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Wed, 12 May 2021 22:56:52 +0100 Subject: [PATCH] Mention how to mount NFS --- content/posts/mount-nfs-inside-lxc/index.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/content/posts/mount-nfs-inside-lxc/index.md b/content/posts/mount-nfs-inside-lxc/index.md index fc06dfb..4e5ef36 100644 --- a/content/posts/mount-nfs-inside-lxc/index.md +++ b/content/posts/mount-nfs-inside-lxc/index.md @@ -38,6 +38,20 @@ Personally, I think this isn't the best name for the setting. It implies more of To support NFS under LXC, some of the apparmor protections need to be lifted. Looking online, there are a number of guides which claim to make the required modifications for [LXC to mount NFS](https://unix.stackexchange.com/questions/450308/how-to-allow-specific-proxmox-lxc-containers-to-mount-nfs-shares-on-the-network). I tried every single one, and nothing appeared to work correctly. That said I've not worked much with apparmor. They all hinged around creating a new profile for LXC, and forcing the container to use it. If you know the secret ingredient to make this work for unprivileged containers, please [tell me]({{}})! There are however several ways to make it work for privileged containers, which like I say isn't the end of the world, and is needed for some of my use cases anyway. +## Mouting + +One that's done, restart the container, and you should be able to mount your NFS shares as normal. To ensure they're mounted correctly on boot, configure your mounts in `/etc/fstab`: + +``` +192.168.1.1:/data /mnt/data nfs defaults 0 0 +``` + +Or the quick and dirty way using the command line: + +```bash +$ mount -t nfs 192.168.1.1:/data /mnt/data +``` + ## TL;DR How _do_ you mount NFS shares inside an LXC container? @@ -45,5 +59,6 @@ How _do_ you mount NFS shares inside an LXC container? 1. Create a privileged LXC container, using any guest distribution of your choosing 2. Once created, modify the config file (`/etc/pve/lxc/.conf` on Proxmox) and add `features: mount=nfs` 3. Restart the container +4. Mount your data (e.g. `mount -t nfs 192.168.1.1:/data /mnt/data`) ![Proxmox makes enabling NFS on privileged containers just a check of a box](lxc-features.png)