I have two linux servers; server two is a backup to server one where server two is NFS mounted to server one.

I use rsnapshot on server one to copy from /data/ to the nfs mounted folder /bkup from server two.

Problem is if the nfs /bkup mount isn't there, rsnapshot will copy /data {20tb) onto the root partition {1tb}.

Instead of cron'ing my one call to launch rsnapshot I would like to call a backup script that first checks on everything before calling rsnaphot to prevent that scenario. I do not think rsnapshot's no_create_root is relevant because the /bkup folder will always exist. Can the following happen in a bash script? i'm hoping someone fluent in bash can type it up in 2 minutes? my bash writing is horrible.

if ( showmount -e server_two responds with "/bkup server_two" )
    if ( check if /bkup is nfs mounted == true )
        /usr/bin/rsnapshot daily
       mount /bkup
       if ( check if /bkup is nfs mounted === true )
          /usr/bin/rsnapshot daily

right now I have this to work where/when my nfs bkup mount is good on server_one

mount | grep bkup

server_two:/bkup on /bkup type nfs4

df -h | grep bkup

server_two:/bkup   15T  3.0T   12T  21% /bkup

showmount -e server_two

Export list for server_two:
/bkup server_one

1 Answer 1


Our crontab has a line similar to

if ! mountpoint -q /mnt/beegfs_backup ;then mount /mnt/beegfs_backup;fi && rsnapshot daily

You can adapt this to your script.

  • thanks. going to use if mountpoint -q /bkup; then rsnapshot daily in /etc/crontab
    – ron
    Commented Sep 29, 2021 at 17:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .