power saving backup setup
- I was looking for a good solution to organize automatic backups from
my Linksation without having an external drive running all day. Here
is a solution, I would not call it the most elegant, but it works.
1. Some infos
- linkstation power consumption - HD spinning: 12W
- linkstation power consumption - HD sleeping: 6,5W
- external USB drive power consumption: 10W
Of course the USB drive refuses to spin down, and (reading previous
messages) there seems to be no way to change that.
2. The setup
- I connected a timer to the powercord of the USB drive. The drive is
switched on at 8pm and switched off at 9pm
- I logged into my linkstation as root via telnet
- I copied a rsync binary to /bin.
- I set up a shell script /root/backup with the following content
rsync -av /mnt/data /mnt2/usbdisk1
It seems to be important to create those shell scripts using vi on
the linkstation. When I used my windows machine and copied the file
to the linkstation it did not work, probably because of the different
line ending code that windows is using.
The touch-commands provide 2 files (start and end), so I can see when
the backup actually started and when it finnished.
- The shell script has to be executable, so I did chmod
- Then I edited the file /etc/crontab using vi, I added one line:
15 20 * * * root /root/backup
So at 8:15pm the shell script is executed
- then I rebooted the linkstation by typing "reboot"
So now once a day my external usb drive is switched on, 15 minutes
later a simple backup is started and 40 minutes later the usb drive
is turned off again.
Before setting up the powercord timer one should run the backup
manually once, because at first all files have to be transferred to
the external drive (that can take hours). Later rsync only transfers
new files and changed files.
Also one has to take care that the time on the powercord timer is set
correctly, the same applies to the time on your linkstation. Its
probably a good idea to check those settings once in a while.