31. December 2022

NFS-Server with CentOS 8 / Red Hat 8 for VMware vCenter Backups

By H. Cemre Günay

In various community meetings, we often talk about backups for VMware vCenter. As you know, image based backups are only conditionally “supported”. It can go well, but in most cases the VMware vCenter will not be fully restored and you will be forced to re-deploy the appliance. Community and customers are ambivalent, one backs up his VMware vCenter via Veeam etc., the other via the VAMI interface. We definetly recommend in any case the path with the VAMI interface.

For more information about the VMware vCenter VAMI interface please visit: https://docs.vmware.com/en/VMware-Adapter-for-SAP-Landscape-Management/2.1.0/Installation-and-Administration-Guide-for-VLA-Administrators/GUID-CEEB151C-8B44-47B3-8D16-CB97BB865B2F.html

Those who already know the VAMI interface will know the supported protocols for backup are: FTPS, HTTPS, SFTP, FTP, NFS, SMB and HTTP. In the past I have always configured an SMB share on my Veeam backup server and wrote my VMware vCenter backups to it.

In various customer situations we had bad experiences with SMB shares, as soon as a customer had to restore from an SMB share, the backup data could not be restored properly and the restore process aborted. The best experience we had was with NFS based backups. Enough talk – now follow the steps below to install your NFS Server on CentOS 8 / RHEL 8 Linux system.

Step 1: Your server should have a static IP address and static hostname that persists reboots.

sudo yum -y update
sudo hostnamectl set-hostname server.example.com --static

Step 2: Next is the installation of the NFS server packages on RHEL / CentOS 8 system. After the installation, start and enable nfs-server service.

sudo yum -y install nfs-utils
sudo systemctl enable --now nfs-server rpcbind

Step 3: Exporting NFS Shares on RHEL 8 / CentOS 8 – For this setup, I added a secondary disk to my server with a capacity of 500 GB. We will partition this disk and create file system on it for use as NFS share.

$ lsblk  | grep sdb
sdb             12:19   0   500G  0 disk 

# Create partition and file system
sudo parted -s -a optimal -- /dev/sdb mklabel gpt
sudo parted -s -a optimal -- /dev/sdb mkpart primary 0% 100%
sudo parted -s -- /dev/sdb align-check optimal 1
sudo mkfs.xfs /dev/sdb1

We’re going to mount it to /data directory.

sudo mkdir /data
echo "/dev/sdb1 /data xfs defaults 0 0" | sudo tee -a /etc/fstab
sudo mount -a

Let’s check the settings to confirm.

$ df -hT | grep /data
/dev/sdb1             xfs        500G  176M   500G   1% /data

Step 4: We create directory on /data/backups that will be exported to NFS clients.

sudo mkdir  /data/backups

Step 5: Now we need to modify /etc/exports to configure NFS share.

/data/backups           192.168.54.0/24(rw,no_root_squash)

The no_root_squash option disables root squashing – enables remote root user to have root privileges. This is usually required for VM installations on NFS share.

Step 6: Once you’re done with the settings, use the exportfs utility to selectively export directories without restarting the NFS service.

$ sudo exportfs -rav
exporting 192.168.54.0/24:/data/backups
  • r – Causes all directories listed in /etc/exports to be exported by constructing a new export list in /etc/lib/nfs/xtab
  • a – All directories are exported or unexported, depending on what other options are passed to exportfs
  • v – Verbose operation – Show what’s going on

Optional: If Firewalld is running, allow NFS service.

sudo firewall-cmd --add-service=nfs --permanent
sudo firewall-cmd --add-service={nfs3,mountd,rpc-bind} --permanent 
sudo firewall-cmd --reload 

Optional: SELinux boolean may need to be enabled.

sudo setsebool -P nfs_export_all_rw 1

Now that we are done with NFS server configurations, the remaining part is mounting NFS shares in the VMware vCenter VAMI interface:

The Backup location starts always with the protocol you use, the dns/ip of the Backup Host and the folder path. Customize your settings and test a manual backup and get the “Complete” Status:

And that is it from this very important Tutorial. In Germany we say “Kein Backup, Kein Mitleid” which means like: “No backup, no pity”, so take care of your environment! 🙂 If you have any questions please leave it in the comment section below.