Lets begin. First, we need to make a space on the proxmox host. Aside from using this for Time Machine, it could be used for anything.
On Proxmox
Create the ZFS Dataset:
On the Proxmox host, create a ZFS dataset if it doesn’t already exist.
1
zfs create tank/data/whatever-you-want
Set Permissions for the Dataset:
1
2
chown -R nobody:nogroup /tank/data/whatever-you-want
chmod -R 770 /tank/data/whatever-you-want
Step 2: Modify Container Configuration to Bind Mount the ZFS Directory
Stop the Container:
Stop the container to safely edit its configuration.
1
pct stop <container-id>
Edit the Container Configuration File:
Open the container’s configuration file located at /etc/pve/lxc/
1
nano /etc/pve/lxc/<container-id>.conf
Add a Mount Point for the ZFS Directory:
Add a line to bind mount the ZFS directory into the container. For example, to mount /tank/data/timemachine to /mnt/timemachine inside the container:
1
mp0: /tank/data/whatever-you-want,mp=/data/whatever-you-want
Save and Close the Configuration File.
Step 3: Set Appropriate Permissions for the ZFS Directory
Set Permissions for the Container User:
Ensure the user inside the container has the necessary permissions to access and write to the ZFS directory. You might need to match the UID and GID of the user inside the container with the ownership of the ZFS directory.
1
chown -R 100000:100000 /tank/data/whatever-you-want
Here, 100000 is typically the UID and GID mapping for the root user inside an unprivileged container. Adjust this according to the specific user and container configuration.
Restart the Container.
Verify Access Inside the Container:
1
2
3
pct enter <container-id>
ls -l /data/timemachine
touch /data/timemachine/testfile
Ensure that the testfile is created without any permission issues.
Conclusion
By following these steps, you can configure a Proxmox container to access and write to a mounted ZFS directory. The key steps involve creating the ZFS dataset, configuring the container to bind mount the directory, and setting the appropriate permissions to ensure the container can read and write to the ZFS dataset. This setup ensures that your container can use the ZFS storage efficiently and securely.