Difference between revisions of "Create a perfect backup of the LinkStation filesystem"
(First copy/paste and syntax edits)
Revision as of 21:46, 14 June 2006
Backing up the Linkstation
Very Basic Backup
If you don't want to read the contents of hda1 and simply want to backup and later restore it you don't need to fix_ext2_magic because dd copies low level without interpreting the data. Use the command:
- dd if=/dev/hda1 of=/mnt/whatever/hda1.bin
No compression, saved on the data partition, you can copy it to any other PC later. This command should work even when the system is running and files are locked. If you want to make the image better compressable you could do:
- dd if=/dev/zero of=/fillmeup
and delete this file later on. This has the advantage that unused parts become filled with zeroes which allows better compression.
Be careful what you type ! Specifying the wrong "of" parameter can easily wipe out data you would like to keep
USB or External Hard Drive Backup
As soon as you connect an external memory device to the LinkStation it get's mounted as /mnt/usbdisk1 or /mnt/usbdisk2. You could now copy the image you created above to the device:
- cp /mnt/whatever/hda1.bin /mnt/usbdisk1
In case you use a quite small usb stick you can compress the data using:
- gzip -9 /mnt/whatever/hda1.bin
This commands shrinks the image of my system partition to 95MB which easily fit's on a 128MB usb stick. If you gzip you have to add a ".gz" to the copy command above.
- umount /mnt/usbdisk1
after you are finished.
The LinkStation comes with a simple backup system for performing regular backups of the data in the shared directories to an USB disk. To configure it use the LS web interface. Goto Maintenance -> Disk Backup and configure the backup as you desire.
The LS' own backup system is rather slow, so you might want to consider the following methods.
You want a true incremental backup, i.e. after one full backup only daily changes shall be transferred to the LS? Install @@rsync@@ and use it in the LS backup script:
- Binary for the PPC LS see this forum thread
- Binary for the MIPS LS see this forum thread
- Replace the existing file /www/cgi-bin/do-backup.pl with the modified script posted by weikai on this forum thread
You want an incremental backup with history, i.e. keep replaced and deleted files? For information on these more advanced @@rsync@@ uses (like creating snapshots using hard links and @@cron@@) read rsync snapshots
You find @@rsync@@ not suitable or risky? Install @@cpio@@. Write / setup a cron job. In this job use @@find@@ to identify files which need to be backed up. E.g., for an incremental backup search for all files newer than the last backup. Pipe the output of @@find@@ through @@cpio@@. Let @@cpio@@ write its output to an external USB disk or some other mounted network partition on a physically separate device.
Use a backup rotation schema like GFS (grandfather-father-son). Store backups off-site.