Backup config file every night automatically!

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
I've created a cron job that will automatically backup your config every night(or whenever you want).

Here's how I did it: (the name of my zpool is tank, yours may vary so you will need to adjust the following accordingly)

I created a file on my zpool at /mnt/tank/bkpconfig.sh. It has one line:

cp /data/freenas-v1.db /mnt/tank/`date +%Y%m%d`.db

Edit:
-----------------------------------------------
If you want the config file to append the version of FreeNAS you are using, you can use this command:

cp /data/freenas-v1.db /mnt/tank/.scripts/ConfigBackups/`date +%Y%m%d`_`cat /etc/version | cut -d'-' -f2`_`cat /etc/version | cut -d'-' -f4`.db

You'll get filenames that are "20150125_9.3_201501241715" where the last characters tell you the build date/time you were using.
-----------------------------------------------

Another edit for 9.3.0 (but not 9.3.1 users) users (see https://bugs.freenas.org/issues/9091):

If you want to do these commands as tasks that run from cron directly, you'll want to use the following commands, correcting for your locations as appropriate:

cp /data/freenas-v1.db "/mnt/tank/`date \+%Y\%m\%d`.db"

- or -

cp /data/freenas-v1.db /mnt/tank/`date \+%Y\%m\%d`_`cat /etc/version | cut -d'-' -f2`_`cat /etc/version | cut -d'-' -f4`.db

-----------------------------------------------

Note that the ` is the top left key on the keyboard, not the typical apostrophe symbol. You can change the location of the db to anything you want, but you should keep it on your zpool or another location that is NOT on your USB key. Also you may not want to put the backup config anywhere that is shared. You wouldn't want anyone to have access to the database or delete them on accident.

Then log into the FreeNAS UI.

Expand "System", then expand Cron Jobs and then click "Add Cron Job".

For User set it to root.

For command use sh /mnt/tank/bkpconfig.sh or whatever location your bkpconfig.sh file is located at.

For short description enter something that makes sense to you. I put "Daily Backup of Config".

I chose to do the backup at 23:55 every day of the week. I figured that would allow me to backup the file as an "end of the day" routine while also doing the backup at an odd time so that other nightly tasks won't interfere.

For minute I chose the "Each selected minute" tab and chose 55.

For hour I chose the "Each selected hour" tab and then chose 23.

For Day of month I did "Every N day of the month" tab and set it to 1.

For Month I checked every month(default)

For Day of week I checked every day(default)

I left "Redirect Stdout" checked, "Redirect Stderr" unchecked and "Enabled" checked(all defaults).

Click "OK" and you should see the job be created.

If you have emails for root setup and your cron job fails you will get an email of the error.

My config file is only 207kb. I'd expect that regardless of your configuration your file isn't going to be big enough to worry about the lost space storing the config files. Plenty of people have been posting in the forums lately that didn't have a backup at all or had an old backup. With this you will have many copies of the config. This may be handy if the database gets corrupted since you have a backup history you can use.

Keep in mind that while the config file is safe on your zpool or elsewhere, you will need to copy the database file to your desktop to upload the config file. I just auto-imported my zpool and created a quick FTP server using anonymous access and was able to do a recovery in about 5 minutes. If you are really motivated you could create an FTP script in windows/linux/whatever that would auto-download your config files every time you logged into windows.
 
Last edited:

nicisdigital

Cadet
Joined
Jan 15, 2013
Messages
7
Assuming the USB drive is dead, how hard would it be to recover your backed up ".db" file? Would it be better to backup the config file offsite?
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
All I did as a test was reinstall FreeNAS to a new USB, autoimport the zpool, then import the config file. Wait for the automatic reboot for the config and I was back in business.
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
Excellent, I kept meaning to look into doing this. Thanks very much.

One note, you probably don't need to put that line in a script and then call the script from cron. I think you should be able to just put the one liner into cron. Though I probably will write a script that copies the database file to the pool and then also another machine.

Thanks again.
 

travalon

Explorer
Joined
Jan 6, 2013
Messages
82
I happened across this post and thought it was a great idea. I couldn't get it to work though. After getting the email working I just kept getting reports on SMART status and a cron job report "can't open /mnt/Five00m/nas.......: no such fie or directory.
I just realized I put the path to my mount point in as opposed to a direct path to the file.
So I should have put - /mnt/Five00m/NAS_ConfiBU/bkpconfig.sh which is on a local volume
INSTEAD i put /mnt/Five00m/nas/NAS_ConfigBU/bkpconfig.sh, nas being the mounpoint on my htpc.

OOOps.... Hope this helps someone.

D@mn still didn't work....maybe if I take it out of it's folder....

Here's what is in my bkpconfig.sh - cp /data/freenas-v1.db /mnt/Five00m/`date +%Y%m%d`.db

no email so it must have worked. Read the instructions carefully.
I failed to adjust for a direct path to the file and also failed to assure the line in the file had an exact match/path to where I put the file.

Thanks yet again Cyberjock
 

raidflex

Guru
Joined
Mar 14, 2012
Messages
531
I would also make a backup once in a while of your config file to a different location. I had USB stick that was failing and I backed up the configuration. Then after I reinstalled FreeNAS onto a new USB stick and imported my configuration, when the system rebooted it would not POST and just hung right after the BIOS screen.

What I suspect is that the configuration that was saved was corrupted due to the failing drive. Otherwise this is a great idea to automate the backup.
 

GusPS

Cadet
Joined
Jun 24, 2013
Messages
1
I've made this script to be run outside the NAS box (from a different server running linux and with lynx installed).
It can be used to backup several servers, but all of them must have the same user & password account.
Code:
#!/bin/bash
DIR=$(/bin/pwd)
BASEDIR=$(/usr/bin/dirname $0)
cd $BASEDIR
 
servers=(server-freenas-1 server-freenas-2)
 
for server in ${servers[*]}
do
        /usr/bin/lynx -cmd_script=macro_get_config http://${server}
done
 
 
#Add datetime to downloaded configs
cdate=$(date +"%Y%m%d%H%M%S")
shopt -s extglob
for file in !(*[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].db); do
        if [[ $file == *.db ]]
        then
                mv "$file" "$file-${cdate}.db"
        fi
done
 
 
# delete old files (retain 90 days)
/usr/bin/find *.db -mtime +90 -exec rm {} \;
 
cd $DIR

It's ready to be called from a cron job.
One must first run this:
Code:
lynx -cmd_log=macro_get_config http://svr-freenas-1

And navigate to the download button.
The file content of macro_get_config I'm using is:
Code:
# Command logfile created by Lynx 2.8.8dev.9 (12 Jun 2011)
key a
key Down Arrow
key a
key d
key m
key i
key n
key ^J
key *
key *
key *
key *
key *
key *
key *
key *
key ^J
key ^J
key G
key s
key y
key s
key t
key e
key m
key /
key c
key o
key n
key f
key i
key g
key /
key s
key a
key v
key e
key /
key ^J
key d
key Down Arrow
key ^J
key .
key d
key b
key ^J
key q
key y

Make sure to replace the "key *" with the password and set it to chmod 600.
 

KevinM

Contributor
Joined
Apr 23, 2013
Messages
106
Just ran across this post and thought I'd throw my own solution in. I call this one from cron as Cyberjock outlined above.

This one will keep as many versions of the freenas-v1.db file as are specified by the VERSIONS variable. The script also sends an email of the backup results, optionally attaching a uuencoded copy of the db file.

I normally use mutt for this sort of thing because it can send MIME attachments, but I see it is not installed by default on FreeNAS.

Code:
#!/bin/bash
 
SCRIPT=${0##*/}
HOST=$(hostname -s)
SRCEFILE=/data/freenas-v1.db
DESTDIR=/mnt/share/admin/backups
DESTFILE=${DESTDIR}/freenas-v1_$(date +%Y%m%d%H%M%S).db
LOGDIR=/mnt/share/admin/logs
LOGFILE=${LOGDIR}/${SCRIPT}_$(date +%Y%m%d%H%M%S).log
RECIPIENT=me@mycompany.com
MAILCONFIG=n
VERSIONS=30
 
[ -d ${DESTDIR} ] || mkdir -p ${DESTDIR}
 
_log() { printf "$(date): ${*}\n" >>${LOGFILE} 2>&1; }
 
_mail() { mailx -s "${SUBJECT}" ${RECIPIENT} < ${LOGFILE}; }
 
if cp ${SRCEFILE} ${DESTFILE}; then
    _log "PASS: cp ${SRCEFILE} ${DESTFILE}."
else
    SUBJECT="FAIL: ${HOST}: ${SCRIPT}: cp ${SRCEFILE} ${DESTFILE}."
    _log "${SUBJECT}"
    _mail
    exit 1
fi
 
DATAFILES=$(ls -1rt ${DESTFILE%_*}*)
LOGFILES=$(ls -1rt ${LOGDIR}/${SCRIPT}_*)
for FILES in "${DATAFILES}" "${LOGFILES}"; do
    NUM=$(echo "${FILES}" | wc -l)
    if [ ${NUM} -gt ${VERSIONS} ]; then
        TODELETE=$((${NUM} - ${VERSIONS}))
        for file in $(echo "${FILES}" | head -${TODELETE}); do
            if rm -f ${file}; then
                _log "PASS: rm -f ${file}."
            else
                _log "FAIL: rm -f ${file}."
            fi
        done
    fi
done
 
if grep "FAIL" ${LOGFILE} >/dev/null 2>&1; then
    RESULT=FAIL
else
    RESULT=PASS
fi
 
if [ "${MAILCONFIG:=n}" = "y" ]; then
    printf "\n" >>${LOGFILE}
    uuencode ${DESTFILE} ${DESTFILE##*/} >>${LOGFILE}
fi
 
SUBJECT="${RESULT}: ${HOST}: ${SCRIPT}."
_mail
 

taltman

Cadet
Joined
Dec 30, 2013
Messages
3
I think a more elegant way to achieve incremental backups of your config file would be to save the database file to a dedicated "system backup" Dataset within one of your ZFS pool Volumes. Then set up a periodic snapshot task to take daily snapshots of that "system backup" Dataset.

Then, as fracai wrote, you can use the GUI to put the following cron job in place:

cp /data/freenas-v1.db /mnt/tank/system_backup/freenas-v1.db

This achieves the time-stamping properties from your original script, but now we are utilizing ZFS snapshots so we only store the deltas. If the script doesn't change between snapshots, then no storage is consumed at all.

KISS: this approach requires no coding aside from the trivial command line above, and leverages the power of FreeNAS via the GUI. :)

HTH!

I've created a cron job that will automatically backup your config every night(or whenever you want).

Here's how I did it: (the name of my zpool is tank, yours may vary so you will need to adjust the following accordingly)

I created a file on my zpool at /mnt/tank/bkpconfig.sh. It has one line:

cp /data/freenas-v1.db /mnt/tank/`date +%Y%m%d`.db

Note that the ` is the top left key on the keyboard, not the typical apostrophe symbol. You can change the location of the db to anything you want, but you should keep it on your zpool or another location that is NOT on your USB key. Also you may not want to put the backup config anywhere that is shared. You wouldn't want anyone to have access to the database or delete them on accident.

Then log into the FreeNAS UI.

Expand "System", then expand Cron Jobs and then click "Add Cron Job".

For User set it to root.

For command use sh /mnt/tank/bkpconfig.sh or whatever location your bkpconfig.sh file is located at.

For short description enter something that makes sense to you. I put "Daily Backup of Config".

I chose to do the backup at 23:55 every day of the week. I figured that would allow me to backup the file as an "end of the day" routine while also doing the backup at an odd time so that other nightly tasks won't interfere.

For minute I chose the "Each selected minute" tab and chose 55.

For hour I chose the "Each selected hour" tab and then chose 23.

For Day of month I did "Every N day of the month" tab and set it to 1.

For Month I checked every month(default)

For Day of week I checked every day(default)

I left "Redirect Stdout" checked, "Redirect Stderr" unchecked and "Enabled" checked(all defaults).

Click "OK" and you should see the job be created.

If you have emails for root setup and your cron job fails you will get an email of the error.

My config file is only 207kb. I'd expect that regardless of your configuration your file isn't going to be big enough to worry about the lost space storing the config files. Plenty of people have been posting in the forums lately that didn't have a backup at all or had an old backup. With this you will have many copies of the config. This may be handy if the database gets corrupted since you have a backup history you can use.

Keep in mind that while the config file is safe on your zpool or elsewhere, you will need to copy the database file to your desktop to upload the config file. I just auto-imported my zpool and created a quick FTP server using anonymous access and was able to do a recovery in about 5 minutes. If you are really motivated you could create an FTP script in windows/linux/whatever that would auto-download your config files every time you logged into windows.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
I don't think this is simpler at all. You are adding datasets and deduplication(or compression, your pick) to literally save a less than 100MB per year. Seriously!

Check out this info on my database info:
Code:
MD5 (20130104.db) = 5ba2e14306e79b26b67f0f306a7a85a4
MD5 (20130105.db) = 2f31fa765d1498a64851b4e0514ed2a6
MD5 (20130106.db) = 2f31fa765d1498a64851b4e0514ed2a6
MD5 (20130107.db) = 2f31fa765d1498a64851b4e0514ed2a6
MD5 (20130108.db) = 7d92da0d5542493ce80a2395a1256cba
MD5 (20130109.db) = 877e21bf8b1e865c6ab31bb54d791eb3
MD5 (20130110.db) = a2edaeeb1894f119aea6a9ae2cadcf39
MD5 (20130111.db) = a2edaeeb1894f119aea6a9ae2cadcf39
MD5 (20130112.db) = 3b07b2246c6a3769b0fcbacc74d89245
MD5 (20130113.db) = 5190fe046e9c1bf770118ab5c7473290
MD5 (20130114.db) = 5190fe046e9c1bf770118ab5c7473290
MD5 (20130115.db) = b9715ea49c2f7b6a34a06cfb0d8e50ba
MD5 (20130116.db) = 8781afd3fe47ac2d523518f5b1659bb4
MD5 (20130117.db) = 449aa1ab0fce4ac3a1d8098ed75b10f8
MD5 (20130118.db) = a01674c3de732cb749944c11833e9d65
MD5 (20130119.db) = a01674c3de732cb749944c11833e9d65
MD5 (20130120.db) = a01674c3de732cb749944c11833e9d65
MD5 (20130121.db) = d50df56b7a3309b34862c9131a8f577d
MD5 (20130122.db) = 633c87b3b2e9a791eac94450992efc04
MD5 (20130123.db) = f1a0838cbde6b59c44add6853691ecbe
MD5 (20130124.db) = fd7ae74166f112f75a9feff88a2a0049
MD5 (20130125.db) = fd7ae74166f112f75a9feff88a2a0049
MD5 (20130126.db) = 8d74c186280eb897cfa5c4510d493097
MD5 (20130127.db) = 8290480431ed643ada4c518415cbc9b9
MD5 (20130128.db) = bba2efe5e83f6eb7a484c05ba97070b1
MD5 (20130129.db) = a88646dad3557c0d577fa066dc677c7a
MD5 (20130130.db) = 2465538fe1e4702211d8201443a82c1b
MD5 (20130131.db) = 2465538fe1e4702211d8201443a82c1b
MD5 (20130201.db) = 2465538fe1e4702211d8201443a82c1b
MD5 (20130202.db) = 2465538fe1e4702211d8201443a82c1b
MD5 (20130203.db) = c8978452bf9900ae60a87a000af98083
MD5 (20130204.db) = 9c1a603aaa7f21e203c3edeb4dc85b31
MD5 (20130205.db) = 9c1a603aaa7f21e203c3edeb4dc85b31
MD5 (20130206.db) = 9c1a603aaa7f21e203c3edeb4dc85b31
MD5 (20130207.db) = 9c1a603aaa7f21e203c3edeb4dc85b31
MD5 (20130208.db) = d2ce505ced287e6de3442bbc26151c52
MD5 (20130209.db) = d2ce505ced287e6de3442bbc26151c52
MD5 (20130210.db) = d2ce505ced287e6de3442bbc26151c52
MD5 (20130211.db) = d2ce505ced287e6de3442bbc26151c52
MD5 (20130212.db) = d2ce505ced287e6de3442bbc26151c52
MD5 (20130213.db) = d2ce505ced287e6de3442bbc26151c52
MD5 (20130214.db) = 33d08803c4a9f62902b8b5566104e304
MD5 (20130215.db) = 33d08803c4a9f62902b8b5566104e304
MD5 (20130216.db) = 33d08803c4a9f62902b8b5566104e304
MD5 (20130217.db) = 33d08803c4a9f62902b8b5566104e304
MD5 (20130218.db) = 33d08803c4a9f62902b8b5566104e304
MD5 (20130219.db) = dc09878b3daeb80ac0a4088ed5ef4b1d
MD5 (20130220.db) = dc09878b3daeb80ac0a4088ed5ef4b1d
MD5 (20130221.db) = dc09878b3daeb80ac0a4088ed5ef4b1d
MD5 (20130222.db) = dc09878b3daeb80ac0a4088ed5ef4b1d
MD5 (20130223.db) = 37290a99f8907d19331946c71ac217ab
MD5 (20130224.db) = 37290a99f8907d19331946c71ac217ab
MD5 (20130225.db) = 37290a99f8907d19331946c71ac217ab
MD5 (20130226.db) = b9be28c3266a57bfbb024e1de3b3fc45
MD5 (20130227.db) = 994e11bcc2dc08de678c293f294119d0
MD5 (20130228.db) = 994e11bcc2dc08de678c293f294119d0
MD5 (20130301.db) = 994e11bcc2dc08de678c293f294119d0
MD5 (20130302.db) = 994e11bcc2dc08de678c293f294119d0
MD5 (20130303.db) = 994e11bcc2dc08de678c293f294119d0
MD5 (20130304.db) = 994e11bcc2dc08de678c293f294119d0
MD5 (20130305.db) = 131a9fda8c8680933630262927939942
MD5 (20130306.db) = 2addc3ac60d5919ed632a0fac890f57d
MD5 (20130307.db) = 2addc3ac60d5919ed632a0fac890f57d
MD5 (20130308.db) = 2addc3ac60d5919ed632a0fac890f57d
MD5 (20130309.db) = 2addc3ac60d5919ed632a0fac890f57d
MD5 (20130310.db) = 2addc3ac60d5919ed632a0fac890f57d
MD5 (20130311.db) = 2addc3ac60d5919ed632a0fac890f57d
MD5 (20130312.db) = 2addc3ac60d5919ed632a0fac890f57d
MD5 (20130313.db) = 2addc3ac60d5919ed632a0fac890f57d
MD5 (20130314.db) = a6db710c3f2497df6143be49817786fa
MD5 (20130315.db) = 624feafa7a540e37caf2ac1e652e73f5
MD5 (20130316.db) = 624feafa7a540e37caf2ac1e652e73f5
MD5 (20130317.db) = 624feafa7a540e37caf2ac1e652e73f5
MD5 (20130318.db) = 1d8825a89a283a0a0fff4010abb4ffa0
MD5 (20130319.db) = 1d8825a89a283a0a0fff4010abb4ffa0
MD5 (20130320.db) = 1d8825a89a283a0a0fff4010abb4ffa0
MD5 (20130321.db) = 1d8825a89a283a0a0fff4010abb4ffa0
MD5 (20130322.db) = 0a7511d334ad05a0289e0342089fe696
MD5 (20130323.db) = 8306bfe3cd118b15827193cc7cddbca7
MD5 (20130324.db) = 8306bfe3cd118b15827193cc7cddbca7
MD5 (20130325.db) = 8b749c11545fa55cc5c2d8294c8862c6
MD5 (20130326.db) = ff93ff21aeb494144db7fa5c182f8498
MD5 (20130327.db) = a6b2d4be38c134663dccc3bad7a89ec3
MD5 (20130328.db) = f8732cd575d975d6eabcfe88ccabce0d
MD5 (20130329.db) = d6a612abab77e3d57556a4317b343e13
MD5 (20130330.db) = 5e534c57d3158fee7f8cd8e3c4183ed5
MD5 (20130331.db) = daac143e95b88120ee3536ae39d3268e
MD5 (20130401.db) = a9bdedd2b72b64a9012b8fafdb12f676
MD5 (20130402.db) = cdc383575977bb18c3b46d586e938931
MD5 (20130403.db) = 28e173d72a4189df39b580ce036bc88e
MD5 (20130404.db) = bf6f03ddcde7e9efed14763d443264b8
MD5 (20130405.db) = bf6f03ddcde7e9efed14763d443264b8
MD5 (20130406.db) = bf6f03ddcde7e9efed14763d443264b8
MD5 (20130407.db) = bf6f03ddcde7e9efed14763d443264b8
MD5 (20130410.db) = bbf9cf1442b376a19d383a5ff48f3cbd
MD5 (20130411.db) = bbf9cf1442b376a19d383a5ff48f3cbd
MD5 (20130412.db) = 9e0e9d6166cc8edd6fd105bcb23a4135
MD5 (20130413.db) = 7280ffccd48bf035a54eeb1c02c5001e
MD5 (20130414.db) = 8b18cb310dca56b92af18abd7e4b93cf
MD5 (20130415.db) = 8b18cb310dca56b92af18abd7e4b93cf
MD5 (20130416.db) = 418f0159b3d572148d6f25114afcc373
MD5 (20130417.db) = 418f0159b3d572148d6f25114afcc373
MD5 (20130418.db) = 1902c0338fd3cade1246004addd3736d
MD5 (20130419.db) = 90d898d50dd36e9ef7a97c3beb266ac1
MD5 (20130422.db) = db72fd3b3560971475c470e7a028529c
MD5 (20130423.db) = db72fd3b3560971475c470e7a028529c
MD5 (20130424.db) = 5453b16afe8d8ccf718c2c82172466ee
MD5 (20130425.db) = 5453b16afe8d8ccf718c2c82172466ee
MD5 (20130426.db) = 8926b4fee8f2b5080019a5450085f748
MD5 (20130427.db) = 4c89951b4a1794271fc90c46796ba64a
MD5 (20130428.db) = 203bda6c3ebe64e1159f679000cc7205
MD5 (20130429.db) = 203bda6c3ebe64e1159f679000cc7205
MD5 (20130430.db) = 203bda6c3ebe64e1159f679000cc7205
MD5 (20130501.db) = 75301dc920ee646c82e3248a399fc2a1
MD5 (20130502.db) = 6f967fa18737b9ec5dbf52ff8ff5c2b5
MD5 (20130503.db) = 5aced3d35aba4465c5b21591ae3c587b
MD5 (20130505.db) = 8605a86ffc15768b638a1c1cf365bb40
MD5 (20130506.db) = 8605a86ffc15768b638a1c1cf365bb40
MD5 (20130507.db) = 6e624287d6ca13b32e02f5f667832d55
MD5 (20130508.db) = 6e624287d6ca13b32e02f5f667832d55
MD5 (20130509.db) = fbfa58f21f3d0c1502a0566f68c9b2c0
MD5 (20130510.db) = 06c6d7306774cb95a95e590500d6562c
MD5 (20130511.db) = 4ae3a4d7ae26287acdccec28c8ec9798
MD5 (20130512.db) = 8e06ea2c2901a955a453005f002e9c96
MD5 (20130513.db) = 43c1be7e6f9fe29b3361f400f094ba88
MD5 (20130514.db) = 539b6ece937f69af5811b88e165af2de
MD5 (20130515.db) = e70077b08e5d531c25ccf4329097fea8
MD5 (20130516.db) = e70077b08e5d531c25ccf4329097fea8
MD5 (20130518.db) = d9cca47832cb8e9b1bdf79223b8d2b7d
MD5 (20130521.db) = 7650452283a1462480488436585542e2
MD5 (20130522.db) = aab827e20933bdc58e05959342710481
MD5 (20130523.db) = 1cc65a325179620353c4e90f04631470
MD5 (20130524.db) = 1cc65a325179620353c4e90f04631470
MD5 (20130525.db) = 1194aa9f8bc501e40f5829254b0f601d
MD5 (20130526.db) = 3b6a39dc7abecaede11be0522600ddfd
MD5 (20130527.db) = 917d96e57d1e9c628c3a3a13d764cc14
MD5 (20130528.db) = 917d96e57d1e9c628c3a3a13d764cc14
MD5 (20130529.db) = 917d96e57d1e9c628c3a3a13d764cc14
MD5 (20130530.db) = e2937ceb63ffc85425cdef419285b47e
MD5 (20130531.db) = ac7d759d3c588593f1a66867ae965b3a
MD5 (20130601.db) = 4d17baa189f77886ece20dafa03e5887
MD5 (20130602.db) = 819ed58edf8e09697f87b39e8ec69f45
MD5 (20130603.db) = 819ed58edf8e09697f87b39e8ec69f45
MD5 (20130605.db) = 6fb9b769e7c554f30a0ce01f857f4ac7
MD5 (20130606.db) = 4c8f310ed1039e1e0acec6adaf356500
MD5 (20130607.db) = 4c8f310ed1039e1e0acec6adaf356500
MD5 (20130608.db) = b9032ffd2287a41f5cc7011066330a56
MD5 (20130609.db) = b9032ffd2287a41f5cc7011066330a56
MD5 (20130610.db) = e4ace72399b457c15c76942bcb3baff9
MD5 (20130611.db) = 89aae6c1a43135665787e89120067670
MD5 (20130612.db) = 14a666d09c68c3af99cc3569395ae32d
MD5 (20130613.db) = 14a666d09c68c3af99cc3569395ae32d
MD5 (20130614.db) = b26ccde91e7307c6d5d5e8a742f4a3be
MD5 (20130615.db) = c71e69f9ee3b2daecee89d81533a016b
MD5 (20130616.db) = d9311e03e018dc335ed243188481717c
MD5 (20130617.db) = 7ea0f214bae55343388607848bd9cbfc
MD5 (20130618.db) = 7ea0f214bae55343388607848bd9cbfc
MD5 (20130619.db) = 7ea0f214bae55343388607848bd9cbfc
MD5 (20130620.db) = 7ea0f214bae55343388607848bd9cbfc
MD5 (20130621.db) = 64171676b8973ce23a2cecdd2a18e840
MD5 (20130622.db) = 637d46dd5bdd697dd2a18b44c347837a
MD5 (20130623.db) = 86c1a9a464b17274af3bcdc85b1763f3
MD5 (20130624.db) = 3d30a4c58a23ff2c13af30284834852f
MD5 (20130625.db) = 668f93275bd39902cca2f5b5ed55d89d
MD5 (20130626.db) = edcd89ce83c5575e4cbf3176d2c03492
MD5 (20130627.db) = 3aa771959a717b500d1197de97659f19
MD5 (20130628.db) = dcfe84e31a1de9fbccc097da37785d2e
MD5 (20130629.db) = 5de1a517027b03fcfad78857eae165c3
MD5 (20130630.db) = 76c0f50ec54815d61debbf2167daab12
MD5 (20130701.db) = 5c71609eac2cbe5bf19bd8ff9f105b6a
MD5 (20130702.db) = b2bb30b340bc2abbd0b3279dc98c0cbc
MD5 (20130703.db) = b2bb30b340bc2abbd0b3279dc98c0cbc
MD5 (20130704.db) = b2bb30b340bc2abbd0b3279dc98c0cbc
MD5 (20130705.db) = 56210f14fec987ecbd7a618f0795c9df
MD5 (20130706.db) = 028156fdababb9c488365832f167fab0
MD5 (20130707.db) = 028156fdababb9c488365832f167fab0
MD5 (20130708.db) = 0b0353e868fe263aee3818a811030368
MD5 (20130709.db) = c82b76ba3505a2c43ee77acea9c2f641
MD5 (20130710.db) = 75de1af252f5f0384aa787b03b4d0a82
MD5 (20130711.db) = 75de1af252f5f0384aa787b03b4d0a82
MD5 (20130713.db) = 8e48fb73657af421e19f75ecc1902ac1
MD5 (20130714.db) = 8169173b12f9f0ff91f605c5623f74e1
MD5 (20130715.db) = 4c9a94e54780c236204cdad809a3543e
MD5 (20130716.db) = 42df95105010b009510624d56a74b9b7
MD5 (20130717.db) = b0856470e3443c858939be29bdd7b9a2
MD5 (20130722.db) = 2379e90aaff2b22b7d54d96b8d570412
MD5 (20130723.db) = 32e7517d9e92e674df57eb487a3888e6
MD5 (20130724.db) = 327ff3c7f6b4972f7501775feef52825
MD5 (20130725.db) = e03bd9ef2d0004002c274b74131e0a22
MD5 (20130726.db) = 7163353256a8cff4c93d4a9c73c6c061
MD5 (20130727.db) = 00e3b66ba1b50c1d8a8b5a8baf840080
MD5 (20130728.db) = 00e3b66ba1b50c1d8a8b5a8baf840080
MD5 (20130729.db) = 00e3b66ba1b50c1d8a8b5a8baf840080
MD5 (20130730.db) = 00e3b66ba1b50c1d8a8b5a8baf840080
MD5 (20130731.db) = b5efc8f36788fe615199978b18a0fe75
MD5 (20130801.db) = c656d2de81932f6695cb670a14fc9791
MD5 (20130802.db) = c656d2de81932f6695cb670a14fc9791
MD5 (20130803.db) = 849b91c519715f90e7530fba3ade6fd7
MD5 (20130804.db) = 849b91c519715f90e7530fba3ade6fd7
MD5 (20130805.db) = 9ad65099bd2d0f726d6dc9a96b3553d4
MD5 (20130807.db) = 0ccf86dcfae4d692aae452eb8ce70469
MD5 (20130809.db) = 2a7aa769f26b8e3879523284df342c0f
MD5 (20130810.db) = 2a7aa769f26b8e3879523284df342c0f
MD5 (20130811.db) = 21ad3d7acc119946a0831c61af9574e6
MD5 (20130812.db) = 8152013926e36e6c334656e9c38c9062
MD5 (20130813.db) = 8152013926e36e6c334656e9c38c9062
MD5 (20130814.db) = 8152013926e36e6c334656e9c38c9062
MD5 (20130815.db) = d1538d0ab7aeeeffb80970b89aa448aa
MD5 (20130816.db) = f1ff1d767ffbe844e0f71295964da175
MD5 (20130817.db) = f1ff1d767ffbe844e0f71295964da175
MD5 (20130818.db) = f1ff1d767ffbe844e0f71295964da175
MD5 (20130819.db) = f1ff1d767ffbe844e0f71295964da175
MD5 (20130820.db) = f1ff1d767ffbe844e0f71295964da175
MD5 (20130821.db) = 1d476009bae6d12c88949da34348c8fc
MD5 (20130822.db) = 6bc1b481ca662d29c1879dab2665fbab
MD5 (20130823.db) = 42f422316d39ff12a13420b6ff7be7d6
MD5 (20130824.db) = 2d1bfd86e87d33d0e09af04fd74b752b
MD5 (20130825.db) = e88e80751e8f0ab185e2a91f898c1a29
MD5 (20130826.db) = e88e80751e8f0ab185e2a91f898c1a29
MD5 (20130827.db) = e88e80751e8f0ab185e2a91f898c1a29
MD5 (20130828.db) = 158af383c126089c38cbc2d8c8b66378
MD5 (20130829.db) = 158af383c126089c38cbc2d8c8b66378
MD5 (20130830.db) = 158af383c126089c38cbc2d8c8b66378
MD5 (20130901.db) = d29451d590872f290595bcc46450ea8e
MD5 (20130902.db) = be82ec2e25e5430b5aa9102b3e294d9b
MD5 (20130903.db) = a392c243ee3542aad5890847b7dbf006
MD5 (20130904.db) = 69e66c6c5a5435f7f4388f7d5e406866
MD5 (20130905.db) = f8655bf930dc55dddfb0572bb43de2f5
MD5 (20130906.db) = f8655bf930dc55dddfb0572bb43de2f5
MD5 (20130907.db) = 15d39c6309ea0044a2ca4daae32460bf
MD5 (20130908.db) = 4cbbc84c23d85c2f6f194029cd383386
MD5 (20130909.db) = 96f11c21cfb7077137bbe10efec14b1c
MD5 (20130910.db) = 39f677f8ed82bc95cc6b40d20c5409bc
MD5 (20130911.db) = 041db1776a596edfae34d56d7e299a51
MD5 (20130912.db) = 9eb5496d7551de7817a738e765f00707
MD5 (20130913.db) = fdb9ef5a72424b51863c5af744053d21
MD5 (20130914.db) = 1cbe3c8398c89875696e898c13c73978
MD5 (20130915.db) = f7a56586567860eef0f58be2c7c29f68
MD5 (20130916.db) = 2ca2630a1412ce66f977ab387ac83a7c
MD5 (20130917.db) = 2ca2630a1412ce66f977ab387ac83a7c
MD5 (20130918.db) = 2ca2630a1412ce66f977ab387ac83a7c
MD5 (20130919.db) = 2ca2630a1412ce66f977ab387ac83a7c
MD5 (20130920.db) = 16476736259163633e1c64d1faea58c3
MD5 (20130922.db) = 9692f90b7531b63db538f06c624ceb1c
MD5 (20130923.db) = ef0ab71512730c7165c140b4636aaafd
MD5 (20130924.db) = ef0ab71512730c7165c140b4636aaafd
MD5 (20130925.db) = ef0ab71512730c7165c140b4636aaafd
MD5 (20130926.db) = ef0ab71512730c7165c140b4636aaafd
MD5 (20130927.db) = ef0ab71512730c7165c140b4636aaafd
MD5 (20130928.db) = 8b9454a2f89ef9fef8488ae110f1151d
MD5 (20130929.db) = 1970b2fc675e92cfb644a9025d095d90
MD5 (20130930.db) = 1970b2fc675e92cfb644a9025d095d90
MD5 (20131001.db) = 3f0853877ea9ce7057767e2be979acf4
MD5 (20131002.db) = 3f0853877ea9ce7057767e2be979acf4
MD5 (20131003.db) = 553706e593058c5f941c3f89b5966d5f
MD5 (20131004.db) = 4600e4bdec6f91a76bc5fc48268a13c7
MD5 (20131005.db) = 078d95116e4c256d2f9aad03982cf1fb
MD5 (20131006.db) = 7426ef78ea2af1451aed1400be3a6f79
MD5 (20131007.db) = 7426ef78ea2af1451aed1400be3a6f79
MD5 (20131008.db) = 19e9efff918fa0b454e3dff3a4101dda
MD5 (20131009.db) = 89628852f132c89e4436fd6756907aab
MD5 (20131010.db) = ee1d922e5b1d5bca1cd6ffc38f57a71c
MD5 (20131011.db) = ee1d922e5b1d5bca1cd6ffc38f57a71c
MD5 (20131012.db) = ee1d922e5b1d5bca1cd6ffc38f57a71c
MD5 (20131013.db) = ee1d922e5b1d5bca1cd6ffc38f57a71c
MD5 (20131014.db) = ee1d922e5b1d5bca1cd6ffc38f57a71c
MD5 (20131015.db) = ebf4d85525fefc5a410e27496dc9821b
MD5 (20131016.db) = ebf4d85525fefc5a410e27496dc9821b
MD5 (20131017.db) = ebf4d85525fefc5a410e27496dc9821b
MD5 (20131018.db) = ce6c3a2ce489c1715893d430e8cc53ce
MD5 (20131019.db) = 424ed9b481f3ccbc5002a074f1b952b3
MD5 (20131020.db) = ba8ad2c9e4018144c72e7bb8ca4d4e20
MD5 (20131021.db) = ba8ad2c9e4018144c72e7bb8ca4d4e20
MD5 (20131022.db) = ba8ad2c9e4018144c72e7bb8ca4d4e20
MD5 (20131023.db) = ba8ad2c9e4018144c72e7bb8ca4d4e20
MD5 (20131024.db) = 21357e81a4eae77cc086cb83e59354bb
MD5 (20131025.db) = a72103cb8c156f5c9dd0046a54adef11
MD5 (20131027.db) = 6392515b1368208f5d5d136adca202a4
MD5 (20131028.db) = d56446e1e408f8b9c1ff27564b09439a
MD5 (20131029.db) = d56446e1e408f8b9c1ff27564b09439a
MD5 (20131030.db) = 1c7540dfdbd050671efa5d84fde60077
MD5 (20131031.db) = 1c7540dfdbd050671efa5d84fde60077
MD5 (20131101.db) = 1c7540dfdbd050671efa5d84fde60077
MD5 (20131102.db) = f5f831b8a53ee4531bb35724fcda40e5
MD5 (20131103.db) = f5f831b8a53ee4531bb35724fcda40e5
MD5 (20131104.db) = f5f831b8a53ee4531bb35724fcda40e5
MD5 (20131105.db) = f5f831b8a53ee4531bb35724fcda40e5
MD5 (20131106.db) = fbd8aca3e07555de845b4113958e82df
MD5 (20131107.db) = 5dcbf2b7a518b81c0e9a272689e91cd6
MD5 (20131108.db) = 8b4b0538c23d0731bcdbf0abe3b8045e
MD5 (20131109.db) = abecf4978c8d43619d7f0bd9a76d5746
MD5 (20131110.db) = abecf4978c8d43619d7f0bd9a76d5746
MD5 (20131111.db) = 1c8a74e7238018d0146ddfcad6d1bc38
MD5 (20131112.db) = 7829ad912988bbc950891c7790811e8b
MD5 (20131113.db) = 7829ad912988bbc950891c7790811e8b
MD5 (20131114.db) = c78a53e90d2518f749f96c03b607293b
MD5 (20131115.db) = c78a53e90d2518f749f96c03b607293b
MD5 (20131116.db) = c78a53e90d2518f749f96c03b607293b
MD5 (20131117.db) = c0144cb0123be3c691a155681366c2c4
MD5 (20131118.db) = 8fea76963313ac8a06bd5c76ab276043
MD5 (20131119.db) = 8fea76963313ac8a06bd5c76ab276043
MD5 (20131120.db) = ca106045dbc434b6a68c70ad3f3365d7
MD5 (20131121.db) = b9eed5e4ca03551dfa57b59a1a490e06
MD5 (20131123.db) = 5539053f24ca4889a826408b111bffb2
MD5 (20131124.db) = 964b9d74345726e9d35ebab20c8dca80
MD5 (20131125.db) = 964b9d74345726e9d35ebab20c8dca80
MD5 (20131126.db) = 964b9d74345726e9d35ebab20c8dca80
MD5 (20131127.db) = 964b9d74345726e9d35ebab20c8dca80
MD5 (20131128.db) = 964b9d74345726e9d35ebab20c8dca80
MD5 (20131129.db) = c95e7730d26311f275ce0f760a3485a6
MD5 (20131130.db) = c95e7730d26311f275ce0f760a3485a6
MD5 (20131201.db) = c95e7730d26311f275ce0f760a3485a6
MD5 (20131202.db) = 2028427e76420812709dc3351a0c1775
MD5 (20131203.db) = d1a7166fef5810a085272eaf56451fce
MD5 (20131204.db) = d1a7166fef5810a085272eaf56451fce
MD5 (20131205.db) = 560c0ed6e6a82361ee9da578d065198f
MD5 (20131206.db) = 4a40a20f12f95e611a6a470361c7d913
MD5 (20131207.db) = 4a40a20f12f95e611a6a470361c7d913
MD5 (20131208.db) = 91b5a2a4957db2cb722f763ceeeb506b
MD5 (20131209.db) = b4ed79566abc4b882185da15d222d422
MD5 (20131210.db) = fec08efbccd0ee9e76a1fc2b5b1506f6
MD5 (20131211.db) = fec08efbccd0ee9e76a1fc2b5b1506f6
MD5 (20131212.db) = 0dbaacc1ff85774534fc87e60784af9a
MD5 (20131213.db) = 0dbaacc1ff85774534fc87e60784af9a
MD5 (20131214.db) = 0dbaacc1ff85774534fc87e60784af9a
MD5 (20131215.db) = 0dbaacc1ff85774534fc87e60784af9a
MD5 (20131216.db) = 93abf51a9c2cdb2a2095758cfdc3fe47
MD5 (20131217.db) = 93abf51a9c2cdb2a2095758cfdc3fe47
MD5 (20131218.db) = 5c81d542098723a550e7fd35ad24e283
MD5 (20131219.db) = 3b64c76963d07d4e3a3649eb696a5daf
MD5 (20131220.db) = 3b64c76963d07d4e3a3649eb696a5daf
MD5 (20131221.db) = 3b64c76963d07d4e3a3649eb696a5daf
MD5 (20131222.db) = 3b64c76963d07d4e3a3649eb696a5daf
MD5 (20131223.db) = 3b64c76963d07d4e3a3649eb696a5daf
MD5 (20131224.db) = 3b64c76963d07d4e3a3649eb696a5daf
MD5 (20131225.db) = 3b64c76963d07d4e3a3649eb696a5daf
MD5 (20131226.db) = 1228cfe1b38c78d2f5aa5139a3a55697
MD5 (20131227.db) = 1228cfe1b38c78d2f5aa5139a3a55697
MD5 (20131228.db) = 357027b2d246e6c59668d32b9bb61423
MD5 (20131229.db) = 357027b2d246e6c59668d32b9bb61423
MD5 (20131230.db) = 357027b2d246e6c59668d32b9bb61423


Notice that my database seems to change regularly, rarely staying the same for long. But my server runs for weeks at a time without me logging in. So something is changing the database file on occasion.

I'm a few days short of a full years worth of backups. Guess how much space all of this is taking up... 78,637,721 bytes. Yes, 78MB.

So are you really going to argue that we should create a dataset and use dedupe or compression to store our files for that little of savings. I'm all about KISS, but it sure sounds like you are adding complexity for literally no gain. When hard drives are pennies per GB, you aren't going to tell me that you are losing massive quantities of disk space storing a nightly backup. In fact, if I stored a backup every single hour for a year I'd still be using a whole 1.8GB doing some simple math.

Quite literally, what you are trying to argue about is equivalent to taking a cup of water from the Pacific Ocean back to your home and then being upset that the Pacific Ocean level dropped because you took that cup of water.

Frankly, with the amount of storage space used, its a waste of my time to even think about or even talk about this subject any further.

KISS indeed....
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
I rsync the config database every hour to the same file and rely on on snapshots for history. For me, it has two advantages:
1) I only have to look at one file. If I want to see previous versions, I can look at the snapshots and zfs diff to see when things changed.
2) I'm already pruning snapshots with my own scripts, so the backup is a single rsync command in cron.

Dedupe never makes sense, but compression is on for all my datasets (most are lz4, a small handful are bzip9). For me, it's not about space savings as much as a simple view of what I'm backing up.
 

jerryjharrison

Explorer
Joined
Jan 15, 2014
Messages
99
Just an informational post here. Cyberjock's command runs perfectly at the command line, so I (incorrectly) assumed I could just place the command directly into the cron command line. No Bueno. The cron command interpreter interprets the % signs differently. Changed it to the script as Cyberjock had specified, and it worked perfectly.
 

Jens

Dabbler
Joined
Sep 27, 2013
Messages
13
Thanks, would be great if this was a feature in the webgui
 

ECCfrenaslover

Explorer
Joined
Dec 27, 2013
Messages
89
Thanks for sharing this Cyberjock!

Let's vote for Cyberjock! Most helpful admin of the first quarter! lol!
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,545
I just had the USB stick where I installed FreeNAS crap out on me. The above script created by cyberjock really saved my bacon. I just popped in my spare USB stick, imported my zpool, and uploaded the last config file. All done in under 20 minutes. Thanks!
 

KevinM

Contributor
Joined
Apr 23, 2013
Messages
106
I've changed my solution around a little bit. My backup script scp's the config db off the freenas server to my local Ubuntu linux box, the last 30 versions of which are kept locally, and from there it is emailed to my gmail account. EZ offsite backups!

What I'd really like to do is populate a freenas key with the backup db. That way if the current key dies you can just replace it with one loaded with the current working config. Recovery should be only one reboot with minimal fuss.

Unfortunately UFS support in the 3.6.9 kernel I'm currently using is read-only out of the box, so I'm looking at a kernel recompile and a driver marked dangerous/experimental for read-write mounting. I'll probably leave this until after I upgrade to 14.04, if I ever bother with it at all. It would be cool though.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
You should NOT be emailing it. Your passwords are stored, unencrypted, in that config file. Big security risk doing email, which is why this thread doesn't show how to do emails. Your making a situation overly complex here. The pool is the way to go. When I do recoveries(which I've done from time to time because I did something stupid trying to test something for someone) I just have to mount the pool, create a quick share, then pull the .db file off the pool. Those steps add a whole 2 minutes to recovery. Big deal. What I've seen happen to *many* people that do backups to a different machine(usually a desktop) is they do an OS reinstall and totally forget to re-setup the backups. Then, that one day you need it you realize you were a bonehead and forgot. So having backups that are completely self sufficient with the server is completely worth the 2 minutes of inconvenience.
 

matto

FreeBSD Advocate
iXsystems
Joined
Sep 4, 2012
Messages
46
Cyberjock, I'm sorry, I had a hard time trying to read your post. Can you put that in paragraphs so it's a little easier to read? Please?! Thanks, -matt
 
Top