Differences

This shows you the differences between the selected revision and the current version of the page.

howto:backup 2008/05/22 16:40 howto:backup 2017/09/06 18:38 current
Line 1: Line 1:
-====== HOWTO Backup ======+====== HOWTO Backup ======
This is a step-by-step tutorial on how to set up your DNS-323 for backup.  The contents were copied from the following threads: This is a step-by-step tutorial on how to set up your DNS-323 for backup.  The contents were copied from the following threads:
-  * [[http://forum.dsmg600.info/t1150-Tutorial%3A-Backup-Everything-from-once-night.html|Tutorial: Backup Everything from Vol A to Vol B once a night by Chumby]] +  * [[http://dns323.kood.org/forum/t1150-Tutorial%3A-Backup-Everything-from-once-night.html|Tutorial: Backup Everything from Vol A to Vol B once a night by Chumby]] 
-  * [[http://forum.dsmg600.info/t2125-DNS-323-Rsync-Time-Machine%21.html|DNS-323 Rsync Time Machine! by raid123]]+  * [[http://dns323.kood.org/forum/t2125-DNS-323-Rsync-Time-Machine%21.html|DNS-323 Rsync Time Machine! by raid123]] 
 +  * DNS-323 Online Backup service announcement. 
 + 
 +===== How To Backup the DNS-323 Online ===== 
 + 
 +With the release of firmware v1.09, an integrated online backup service was added to DNS-323. 
 + 
 +The site [[http://dlink.ctera.com]] contains setup information, including a video walk-through, features and pricing. You can also register for the service, and there is a 30-day free trial. The service includes the following features:  
 + 
 +  * Automatically back up your DNS-323 online 
 +  * Restore lost data using a Web browser 
 +  * Recover previous versions of your files 
 +  * No PC software installation required 
 + 
 +The DNS-323 Online Backup Service uses block-level incremental backup with data compression and deduplication, for conserving Internet connection bandwidth. 
 + 
 + 
 + 
 +===== How To Back Up From Drive A To Drive B Once A Night ===== 
 + 
 +=== Why? === 
 +Automatically copying all data from one drive to the other can be used as part of a backup strategy.  Some reports indicate that RAID1 is not altogether reliable, so this may be a better alternative. I have all my working data on Volume_1 and rotate backup disks in Volume_2, every month.  I keep one disk away off site.  
 + 
 +I was tired of trying software backups through my home network.  This is by far the easiest and most efficient backup method I could find. 
 + 
 +=== Software === 
 +  - Firmware 1.03 or 1.04 
 +  - fonz's fun_plug 0.3, 0.4, or 0.5 
 + 
 +(*Note, if you are using fun plug 0.4 you need to install rsync manually (see below) - with fun plug versions 0.3 and 0.5 rsync is automatically installed for you.  Beware though that 0.5 is still in beta at this time). 
 + 
 +=== Hardware === 
 +  - dns323 
 +  - Hard Drives (a third can be used if you want to rotate backup disks in Volume_2 in order to keep one off site) 
 + 
 +=== Procedure === 
 + 
 +Skip steps ONE and TWO if you have already installed and formatted the disks and fonz's fun_plug.
==== Step 1: Install Drives and Set the Correct Time ==== ==== Step 1: Install Drives and Set the Correct Time ====
Line 41: Line 78:
Please note: If you are using fun plug 0.3 or 0.5, rsync will install automatically and you do not need to go through this step. Please note: If you are using fun plug 0.3 or 0.5, rsync will install automatically and you do not need to go through this step.
 +
==== Step 3: Create a Scheduled Backup ==== ==== Step 3: Create a Scheduled Backup ====
Line 94: Line 132:
<code> <code>
chmod a+x /mnt/HD_a2/fun_plug.d/start/editcron.sh chmod a+x /mnt/HD_a2/fun_plug.d/start/editcron.sh
 +</code>
 +
 +5) The /mnt/HD_a2/fun_plug.d/log directory must already exist.  If it doesn't, create it:
 +<code>
 +mkdir /mnt/HD_a2/fun_plug.d/log
</code> </code>
Line 112: Line 155:
When your scheduled time arrives, both HD lights on the dns323 start flashing away. Everything is working fine!  Enjoy hassle free backups from now on! When your scheduled time arrives, both HD lights on the dns323 start flashing away. Everything is working fine!  Enjoy hassle free backups from now on!
-====== Daily Snapshots (RSync Time Machine) ======+ 
 + 
 + 
 + 
 + 
 +===== Daily Snapshots (RSync Time Machine) ===== 
 + 
 +The only drawback for just backing up once a night is that if you accidentally corrupted or deleted a file and didn't realize it until a few days later, you have lost the file.  Thankfully rsync has the ability take snapshots without taking up space for entire backups.
In a nutshell, this is a way of using rsync's hard link functionality to make a full backup, but creating hard links and saving space if the file already existed in the previous backup.  The way hard links work, for those of you who aren't familiar, is like a ref-counting system where multiple files share the actual data.  Until all hard links are deleted, the file will continue to exist. In a nutshell, this is a way of using rsync's hard link functionality to make a full backup, but creating hard links and saving space if the file already existed in the previous backup.  The way hard links work, for those of you who aren't familiar, is like a ref-counting system where multiple files share the actual data.  Until all hard links are deleted, the file will continue to exist.
 +
 +The script checks for the existence of the previous backup by looking for the symbolic link named 'current' which points to the last backup.
==== Step 1: Create snapshot.sh ==== ==== Step 1: Create snapshot.sh ====
-Using the same method mentioned above, create the file "snapshot.sh" script in /ffp/bin directory.  Note that if you're running 0.3 or 0.4, replace anything with /ffp with /mnt/HD_a2/fun_plug.d for the rest of this tutorial.+Using the same method mentioned above, create the file "snapshot.sh" script in /ffp/bin directory.  Note this script is written for fun_plug version 5.0. If you're running 0.3 or 0.4, uncomment the line that reads ffppath=/mnt/HD_a2/fun_plug.d and comment the line that reads ffppath=/ffp.
<code> <code>
#!/bin/sh #!/bin/sh
 +# Set Source Path
 +# Back up the A drive (HD_a2)  by identifying the source path as /mnt/HD_a2
srcpath=/mnt/HD_a2 srcpath=/mnt/HD_a2
-dstpath=/mnt/HD_b2+# Back up multiple directories by surrounding a list with single quotes (i.e., srcpath='/mnt/HD_a2/Music /mnt/HD_a2/Docs') 
 +# srcpath='/mnt/HD_a2/Music /mnt/HD_a2/Docs' 
 + 
 +# Set the Destination Path 
 +dstpath=/mnt/HD_b2/Backup_NAS 
 + 
 +# Set path to Fun_Plug files 
 +# Fun_Plug 3.0 or 4.0 
 +# ffppath=/mnt/HD_a2/fun_plug.d 
 +# Fun_Plug 5.0
ffppath=/ffp ffppath=/ffp
 +
date=`date "+%Y%m%d_%H%M%S"` date=`date "+%Y%m%d_%H%M%S"`
mkdir $dstpath/$date mkdir $dstpath/$date
-$ffppath/bin/rsync -rltEDivx --chmod=go-w --link-dest=$dstpath/current --exclude='workspace/' $srcpath $dstpath/$date > $ffppath/log/snapshot.log 2>&1 + 
-rm $dstpath/current +$ffppath/bin/rsync -avx --ignore-errors --link-dest=$dstpath/current $srcpath $dstpath/$date > $ffppath/log/snapshot.log 2>&1 
-ln -s $date $dstpath/current+ 
 +var=`ls -1A $dstpath/$date | wc -l` 
 + 
 +if [ $var -ne 0 ] 
 +then 
 +  rm $dstpath/current 
 + ln -s $date $dstpath/current 
 +fi
</code> </code>
-The instructions above only shows how to make a snapshot of the entire A drive into B drive.  You can back up multiple directories by surrounding them with quotes single quotes:+The instructions above only shows how to make a snapshot of the entire A drive onto B drive.  You can back up multiple directories by surrounding them with quotes single quotes:
<code> <code>
Line 139: Line 210:
</code> </code>
-Likewise, you can back up to a subfolder backup by changing the dstpath line:+Likewise, you can back up to a subfolder by changing the dstpath line:
<code> <code>
Line 145: Line 216:
</code> </code>
-Finally, make the script executable:+Make the script executable:
<code> <code>
chmod a+x /ffp/bin/snapshot.sh chmod a+x /ffp/bin/snapshot.sh
 +</code>
 +
 +Finally, ensure the /ffp/log directory already exists.  If it doesn't, create it:
 +<code>
 +mkdir /ffp/log
</code> </code>
==== Step 2: Modify editcron.sh ==== ==== Step 2: Modify editcron.sh ====
-Then in editcron.sh, include this entry instead:+Then in editcron.sh, rather than the command listed in step 3 above, include the following entry:
<code> <code>
-/bin/echo "00 2 * * * /ffp/bin/snapshot.sh" >> $CRONTXT+/bin/echo "0 2 * * * /ffp/bin/snapshot.sh" >> $CRONTXT 
 +</code> 
 + 
 + 
 +The editcron.sh file should read as follows; 
 + 
 +<code> 
 +#!/bin/sh 
 + 
 +CRONTXT=/mnt/HD_a2/crontab.txt 
 + 
 +# start with existing crontab 
 +/bin/crontab -l > $CRONTXT 
 + 
 +# add the Rsync job to execute at 2:00 am 
 +/bin/echo "0 2 * * * /ffp/bin/snapshot.sh" >> $CRONTXT 
 + 
 +# install the new crontab 
 +/bin/crontab $CRONTXT 
 + 
 +# clean up 
 +/bin/rm $CRONTXT
</code> </code>
That's it!  You're set up for daily backups!  You can modify this cron entry if you want weekly or monthly backups instead. That's it!  You're set up for daily backups!  You can modify this cron entry if you want weekly or monthly backups instead.
 +
 +
==== Step 3: Verify the backup ==== ==== Step 3: Verify the backup ====
-If you want to verify that this works, run /ffp/bin/snapshot.sh.  First back up may take a while, but when you see the hard drive stop, or that ps no longer shows the rsync processes, do:+If you want to verify that this works run /ffp/bin/snapshot.sh.  First back up may take a while, but when you see the hard drive stop, or that ps no longer shows the rsync processes, do:
<code> <code>
Line 189: Line 288:
</code> </code>
-Each folder now contains a different snapshot, and you can delete the backup from any day, or recover any file from any day, without worrying about how it would affect the previous or the next backup!  Congratulations, you now have your own Time Machine in your DNS-232!+Each folder now contains a different snapshot, and you can delete the backup from any day, or recover any file from any day, without worrying about how it would affect the previous or the next backup!  Congratulations, you now have your own Time Machine in your DNS-323! 
 + 
 + 
 +==== Troubleshooting ==== 
 +If no current link is created, or current is pointing to the wrong (=old) directory after running the script via cron, add 
 +  export PATH=/ffp/sbin:/ffp/bin:$PATH 
 +as the second line in your script. This will set up the ffp 0.5 environment needed for cronjobs on some machines. If you are using an older version of ffp, alter the path accordingly! 
 + 

Navigation

Personal Tools