Table of Contents
Setting Up Proxmox Backup Server with TrueNAS Share Using CIFS and Autofs
In this guide, we’ll walk through the steps of configuring a Proxmox Backup Server (PBS) to use a CIFS share hosted on TrueNAS. This guide will also show how to mount the share dynamically using Autofs and handle situations where the TrueNAS share is not available during PBS boot-up. We’ll also cover useful tips for troubleshooting and cleaning up temporary data if backups fail due to unavailable shares.
Step 1: Setting Up the CIFS Share on TrueNAS
Before configuring the Proxmox Backup Server, you need to set up a CIFS/SMB share on your TrueNAS server. If you already have one configured, you can skip this step. Here’s how to do it:
- Log into your TrueNAS web interface.
- Navigate to Sharing > SMB and click Add.
- Set the appropriate path for your PBS backups (e.g.,
/mnt/your_pool/pbs-backup
). - Enable the Time Machine option if you plan to use this share for macOS backups as well.
- Adjust permissions to ensure the Proxmox Backup Server can write to this share.
- Save the settings and restart the SMB service if necessary.
Step 2: Create a Credentials File for Mounting the Share
To ensure the PBS can automatically access the TrueNAS CIFS share without hardcoding the credentials in the /etc/fstab
file, we will create a credentials file.
- On the Proxmox Backup Server, create a hidden file to store the CIFS credentials:
nano /etc/samba/.smbcreds
- Add the following lines, replacing
username
andpassword
With the correct credentials to access the TrueNAS CIFS share:
username=your_smb_user
password=your_password
- Change the permissions of the credentials file to restrict access:
chmod 600 /etc/samba/.smbcreds
Step 3: Adding the CIFS Share to /etc/fstab
Next, we need to modify the /etc/fstab
file on the Proxmox Backup Server to mount the CIFS share at boot. This will map the TrueNAS share to a local directory.
- Edit the
/etc/fstab
file:
nano /etc/fstab
- Add the following line to the file (update the IP address, share name, and mount point accordingly):
//192.168.1.100/pbs-backup /mnt/pbs-backup cifs credentials=/etc/samba/.smbcreds,uid=34,gid=34,iocharset=utf8,sec=ntlmv2,vers=3.0 0 0
- Create the mount point:
mkdir -p /mnt/pbs-backup
- Manually mount the share to check that it works:
mount -a
- Verify the mount with:
df -h
Step 4: Setting Up Autofs for Dynamic Mounting
If your TrueNAS server takes longer to boot than your Proxmox Backup Server, you might encounter issues where PBS tries to back up data before the share is available. To resolve this, we’ll use Autofs to dynamically mount the share only when accessed.
- Install Autofs:
apt install autofs
- Edit the Autofs master configuration file:
nano /etc/auto.master
- Add the following line at the end of the file:
/mnt /etc/auto.cifs --timeout=60 --ghost
- Create the
/etc/auto.cifs
Configuration file:
nano /etc/auto.cifs
- Add the following line to configure the CIFS share:
pbs-backup -fstype=cifs,rw,credentials=/etc/samba/.smbcreds,uid=34,gid=34,iocharset=utf8,sec=ntlmv2,vers=3.0 ://192.168.1.100/pbs-backup
- Restart Autofs:
systemctl restart autofs
- Test that the share mounts automatically by navigating to the mount point:
cd /mnt/pbs-backup
Step 5: Creating the Datastore in Proxmox Backup Server
Once the TrueNAS share is correctly mounted, we can create the datastore in the Proxmox Backup Server.
- From the shell, use the following command to create a datastore:
proxmox-backup-manager datastore create pbs-backup --path /mnt/pbs-backup
- Verify that the datastore has been created:
proxmox-backup-manager datastore list
Step 6: Cleaning Up After a Failed Backup
Sometimes backups might fail if the TrueNAS share isn’t mounted in time, and temporary data may be written locally. Here’s how to locate and clean up such data:
- Run
ncdu
To inspect disk usage and find large files:
ncdu /
- Look specifically in
/var/lib/proxmox-backup
or/root
For temporary files:
du -sh /var/lib/proxmox-backup/*
- Once identified, delete unnecessary files using:
rm -rf /path/to/file_or_directory
Conclusion
By following this guide, you can successfully configure the Proxmox Backup Server to back up to a TrueNAS CIFS share, handle dynamic mounting with Autofs, and clean up any temporary files from failed backups. This setup will ensure that your backups run smoothly without consuming unnecessary local disk space, even if your NAS isn’t online when PBS boots.
If you encounter issues, review your /etc/fstab
, Autofs configuration, and permissions on both Proxmox and TrueNAS to ensure everything is configured correctly.
Recommended Products
1. USB 2.5G Ethernet Adapter
2. USB-C 2.5G Ethernet Adapter
3. PCIe 10G Network Card
4. Network Switch with 10G Uplinks
5. High-Speed Ethernet Cable (Cat 6a)
6. Network Performance Monitoring Tool
Why Support Matters
Creating valuable free content is a significant part of our mission but requires resources to maintain and grow. While we are dedicated to providing these resources without charging, they do incur costs. Your support is crucial in helping us continue offering this content. Here’s how you can help:
- Use Affiliate Links: I earn from qualifying purchases as an Amazon Associate. Using our affiliate links for your purchases, you help us earn small commissions that contribute to covering our operational costs, at no extra cost to you.
- Engage and Share: Engage with our content by liking, commenting, and sharing it with others. This increases our reach and attracts more visitors who might support us financially, allowing us to continue providing valuable content.
- Provide Direct Support: Consider donating or subscribing to support the content you value. Even small contributions can make a significant difference and help us sustain our efforts.
Disclaimer
As an Amazon Associate, I earn from qualifying purchases. This means I may earn a commission from qualifying purchases made through affiliate links, at no extra cost to you.
Stay Connected with Us
For exclusive updates, training tips, fitness advice, and more, follow us across all our platforms through one easy link.
👉 Stay Connected for Exclusive Martial Arts & Fitness Tips
Join our community and never miss an update!
Return to the home section.