How to backup UFS?

Status
Not open for further replies.

DCUK6

Cadet
Joined
Oct 26, 2011
Messages
1
Hi,

I have just installed freenas to store a few staff members files locally. The machine that it is installed onto only has 1gb ram and from what i've read is unable to run ZFS smoothly.

I have set the volume up with two hard drives and selected the mirror option but im not sure how to back the files up automatically from within freenas.

One option would be to use a windows machines to come in and copy files out but i would prefer if i could automatically get freenas to backup files on a windows server. Incremental backups is probably a good idea as well if thats possible.

Is this possible? If not is it possible to get freenas to backup to a external usb HDD?

Many thanks,

Dan
 

Durkatlon

Patron
Joined
Aug 19, 2011
Messages
414
Easiest way is to write a script that issues an rsync command. If you want to back up to a Windows server, you can mount the Windows share first, somewhere within /mnt.

Once you're satisfied that the backup is working correctly, you can create a cron job to schedule the script at regular intervals.

Here's a rough example of what such a script might look like:
Code:
#!/bin/bash
SOURCE_MOUNT='/mnt/tank/src'
TARGET_SHARE='//user@windowsmachine/target'
TARGET_MNT='/mnt/windowsbackup/target'
TARGET_OPTIONS='-N -I 192.168.0.2'

RSYNC_ARGS='-rtqO --delete --modify-window=2'

MOUNT=/sbin/mount
MOUNT_SMBFS=/usr/sbin/mount_smbfs
RSYNC=/usr/local/bin/rsync

# Copy password file to root so we can mount the Windows share
$MOUNT -uw /
cp /mnt/tank/nsmbrc /root/.nsmbrc
$MOUNT -ur /

# Mount remote share
mkdir -p $TARGET_MOUNT
$MOUNT_SMBFS $TARGET_OPTIONS $TARGET_SHARE $TARGET_MOUNT

# Perform rsync
$RSYNC $RSYNC_ARGS $SOURCE_MOUNT/ $TARGET_MOUNT/


Note the password file nsmbrc which is copied to /root as .nmbsrc. This is required so the mounting of the Windows share doesn't prompt you for a password.

I typed the sample script by looking at my own script that does something similar, so it's possible it has typos! :D The TARGET_OPTIONS has the IP address of the Windows server, adjust according to your setup.

The .nsmbrc file looks kind of like this (use of upper and lower case in this file is important). You can find plenty of information on this online.
Code:
[WINDOWSMACHINE:USER]
password=the_password_for_user_goes_here
 
Status
Not open for further replies.
Top