Backing up Window server with FreeNAS + rsync [Tutorial]

Status
Not open for further replies.

pernils

Explorer
Joined
Aug 31, 2015
Messages
87
As freenas is a multi-tool OS, why not use it for backing up your windows servers ? We can then take the advantage of the snapshot feature in zfs. But best of all we can use the famous rsync. No need for installing backup software etc ...

I will take my setup as a example.

First I made a dataset /mnt/Vol_1/BCK_monsrv. Vol_1 is my root dataset often named tank in the docs.

I'm using this script. I have it stored in the /root folder. (Edit to suite your needs)
Code:
#!/bin/sh
MONWIN_MOUNT_POINT="/mnt/Monsrv_monwin"

MONWIN_PATH="//MON@MONSRV/MONWIN"

MONWIN_BCK_DEST="/mnt/Vol_1/BCK_monsrv"

#
# See if directory for mountpoint exist
#
if [ ! -d "$MONWIN_MOUNT_POINT" ]; then
# If not make it so

  mkdir "$MONWIN_MOUNT_POINT"
fi

#
# See if monwin is mounted
#
if ! df "$MONWIN_MOUNT_POINT" |grep "$MONWIN_PATH" ;

then

# Mount MonSrv smb share as read only (-r)

  mount_smbfs -I 192.168.100.7 -N "$MONWIN_PATH" "$MONWIN_MOUNT_POINT"
fi

EXCLUDE_DIRS="--exclude=Db --exclude=DBBackup --exclude=Edi/backup"

# rsync -n   for dry run

rsync -aI --no-owner --no-perms --no-group --size-only "$EXCLUDE_DIRS" --progress "$MONWIN_MOUNT_POINT"/ "$MONWIN_BCK_DEST"



Then I have a cron for the script in Tasks. In my case once a day.

upload_2017-3-10_12-35-59.png


And we are done. Generate your snapshot schema on the dataset and sit back and relax.
 
Last edited:
Status
Not open for further replies.
Top