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:

    [bash]apt-get update[/bash]

  • Install NFS server:

    [bash]apt-get install -y nfs-kernel-server[/bash]

  • Create a new directory for storing NFS shared files:

    [bash]mkdir /backup/proxmox
    chown -R nobody:nogroup /backup/proxmox[/bash]

  • 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):

    [bash]/backup/proxmox XXX.YYY.ZZZ.MMM(rw,sync,no_subtree_check) IP2.IP2.IP2.IP2(rw,sync,no_subtree_check)[/bash]

  • Update the table of the export file system:

    [bash]exportfs -a[/bash]

  • 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:

    [bash]RPCMOUNTDOPTS="–manage-gids –no-nfs-version 4"[/bash]

    . 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:

    rpcbind: ALL

    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:

    [bash]service nfs-kernel-server start[/bash]

Install NFS client on Proxmox server

  • Update package:

    [bash]apt-get update[/bash]

  • Install nfs-common:

    [bash]apt-get install nfs-common[/bash]

  • 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
    [bash]mount.nfs SERVER.IP.ADDRESS.HERE:/backup/proxmox /mnt/pve/VMbackup-NFS[/bash]

    , 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:
    [bash]SERVER.IP.ADDRESS.HERE:/backup/proxmox/ /mnt/pve/VMbackup-NFS/ nfs auto,noatime,nolock,bg,nfsvers=4,intr,tcp,actimeo=1800 0 0[/bash]

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.

About NhocConan

A super lazy guy who tries to write tech blog entries in English.He is lazy, so he can only write when he is in a good mood or when he is tired of coding.

Leave a comment

Your email address will not be published. Required fields are marked *