Complete Guide: Setting Up Proxmox Backup Server with TrueNAS CIFS Share and Autofs

Complete Guide: Setting Up Proxmox Backup Server with TrueNAS CIFS Share and Autofs

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:

  1. Log into your TrueNAS web interface.
  2. Navigate to Sharing > SMB and click Add.
  3. Set the appropriate path for your PBS backups (e.g., /mnt/your_pool/pbs-backup).
  4. Enable the Time Machine option if you plan to use this share for macOS backups as well.
  5. Adjust permissions to ensure the Proxmox Backup Server can write to this share.
  6. 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.

  1. On the Proxmox Backup Server, create a hidden file to store the CIFS credentials:
nano /etc/samba/.smbcreds
  1. Add the following lines, replacing username and password With the correct credentials to access the TrueNAS CIFS share:
username=your_smb_user
password=your_password
  1. 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.

  1. Edit the /etc/fstab file:
nano /etc/fstab
  1. 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
  1. Create the mount point:
mkdir -p /mnt/pbs-backup
  1. Manually mount the share to check that it works:
mount -a
  1. 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.

  1. Install Autofs:
apt install autofs
  1. Edit the Autofs master configuration file:
nano /etc/auto.master
  1. Add the following line at the end of the file:
/mnt /etc/auto.cifs --timeout=60 --ghost
  1. Create the /etc/auto.cifs Configuration file:
nano /etc/auto.cifs
  1. 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
  1. Restart Autofs:
systemctl restart autofs
  1. 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.

  1. From the shell, use the following command to create a datastore:
proxmox-backup-manager datastore create pbs-backup --path /mnt/pbs-backup
  1. 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:

  1. Run ncdu To inspect disk usage and find large files:
ncdu /
  1. Look specifically in /var/lib/proxmox-backup or /root For temporary files:
du -sh /var/lib/proxmox-backup/*
  1. 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

UGREEN USB to Ethernet Adapter 2.5Gb

UGREEN USB to Ethernet Adapter 2.5Gb, Ethernet to USB Adapter, Aluminum, USB 3.0 to RJ45 Computer Network Internet LAN Ethernet Dongle for laptop, Compatible with MacBook Air/Pro, XPS, Windows, macOS

2. USB-C 2.5G Ethernet Adapter

UGREEN USB C to Ethernet Adapter 2.5G

UGREEN USB C to Ethernet Adapter 2.5G, Ethernet Adapter for Laptop, Aluminum, Type C (Thunderbolt 4/3) to RJ45 Network Internet LAN Adapter, Compatible for NAS, MacBook Air/Pro, XPS, iPhone 15 Pro/Max

3. PCIe 10G Network Card

10G PCI-E Network Card with 10Gbps Dual RJ45 Ports

10G PCI-E Network Card with 10Gbps Dual RJ45 Ports, Intel X540-T2 Controller, VIMIN 10Gb Ethernet Adapter Card Compatible with PCI Express X8, X16, Support Windows/Windows Server/Linux/VMware

4. Network Switch with 10G Uplinks

8 Port 2.5G PoE Switch Unmanaged

8 Port 2.5G PoE Switch Unmanaged with 8 x 2.5Gb Base-T PoE+@120W + 10G SFP Uplink, 2.5Gbe IEEE802.3af/at Power Over Ethernet Switch, Support WiFi6 AP, NAS, 4K PoE Camera NVR

5. High-Speed Ethernet Cable (Cat 6a)

Rapink Patch Cables Cat6a 1ft

Rapink Patch Cables Cat6a 1ft (10 Pack) Slim, Cat6a Ethernet Patch Cable 10G Support, Snagless Cat 6 Patch Cable for Patch Panel to Switch, Flexible Cat 6a Ethernet Cable with Gold Plated

6. Network Performance Monitoring Tool

Klein Tools VDV526-200 Cable Tester

Klein Tools VDV526-200 Cable Tester, LAN Scout Jr. 2 Ethernet Cable Tester for CAT 5e, CAT 6/6A Cables with RJ45 Connections

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.