Backup Proxmox with NFS

NFS-architectureWell, there are plenties of online tutorials about proxmox and backup itself, however, there is really difficult to find a working one with NFS installation, configuration and make it work with Proxmox. So I decide to add a short tutorial on how to backup proxmox with nfs.

Install NFS on remote storage server

  • In this case, I also use Debian on the storage server
  • Update package:
    apt-get update
  • Install NFS server:
    apt-get install -y nfs-kernel-server
  • Create a new directory for storing NFS shared files:
    mkdir /backup/proxmox
    chown -R nobody:nogroup /backup/proxmox
  • Edit /etc/exports file to include sharing folder for NFS client (replace XXX.YYY.ZZZ.MMM with your NFS client’s IP. You can also use * for allowing public access, however it is not recommended):
    /backup/proxmox XXX.YYY.ZZZ.MMM(rw,sync,no_subtree_check) IP2.IP2.IP2.IP2(rw,sync,no_subtree_check)
  • Update the table of the export file system:
    exportfs -a
  • Edit /etc/default/nfs-kernel-server to disable NFS v4: find the line with RPCMOUNTDOPTS and edit it to include “–no-nfs-version 4” as follows:
    RPCMOUNTDOPTS="--manage-gids --no-nfs-version 4"

    . Do not use NFS v4 or you will face the error “mount error: mount.nfs: Operation not permitted (500)” when mounting at NFS client.

  • Secure the portmapper service for NFS server (“deny all, allow some” policy) by editing /etc/hosts.deny and /etc/hosts.allow as follows:
    #/etc/hosts.deny
    rpcbind: ALL
    
    #/etc/hosts.allow
    rpcbind: XXX.YYY.ZZZ.MMM, IP2.IP2.IP2.IP2
    
  • Do not forget to open ports for NFS and rpcbind services: TCP + UDP port for 2049 and 111
  • Finally, start NFS server service:
    service nfs-kernel-server start

Install NFS client on Proxmox server

  • Update package:
    apt-get update
  • Install nfs-common:
    apt-get install nfs-common
  • Do not forget to open (OUT) ports for NFS and rpcbind services: TCP + UDP port for 2049 and 111
  • Done, even you can try mounting remote NFS directory with
    mount.nfs SERVER.IP.ADDRESS.HERE:/backup/proxmox /mnt/pve/VMbackup-NFS

    , however, it is not necessary since Proxmox can do it when configuring a backup.

  • If NFS is mounted manually, we will also need to add the following line to /etc/fstab so that it will be available each time the server is restarted:
    SERVER.IP.ADDRESS.HERE:/backup/proxmox/ /mnt/pve/VMbackup-NFS/ nfs auto,noatime,nolock,bg,nfsvers=4,intr,tcp,actimeo=1800 0 0

Configure Proxmox for backups

  • For this, we can simply refer to Proxmox Backup and Restore wiki.
  • First, we need to add a new NFS storage to Proxmox as described at Proxmox Storage Models. Remember to input remote directory path (/backup/proxmox) in Export field.
  • Then, go to Datacenter >> Backup >> Add and configure VMs to be backed up.

Leave a Reply