OK... you've got a Frugal install of DSL on some old piece of hardware and it's sitting in the corner just chugging away.
Great.
Then you decided to make it a Samba server by downloading the Samba.dsl and now it can be accessed by the windows boxes.
Great.
Then you wanted it to be a beefed up web server and FTP server so you added Xampp ( Xampp website ).
Great.
Maybe you're lucky enough to have a webcam that linux can use and you've also made the box into a webcam server with the motion.dsl download.
Great.
You've taken your MP3 collection and put it on the dinosaur and added the Edna.dsl. Now it serves up your music and with a few tweaks you can have it serve documents also.
Great.
The DSL machine sits there and runs and runs. A month goes by and you reboot it just because you feel like you should, not because it needs to be rebooted.
Darn Great.
You catch a good sale and put another 120gigs of harddrive space on the old box and now you're looking for something else to do with it.
You know you should backup the other machines on the network once in a while. You were going to start doing that on a regular basis after your last hard drive failure, remember? You start looking around for some backup software and you find something called Rsync (Rsync.samba.org website). Not specifically a backup program but it will work for what you want to do. The icing on the cake is that there is an rsync.dsl module in the library thanks to cbagger01.
Great.
A little background may be in order. This old eMachine box is a 560mhz pentium celeron with 160megs of memory. A generic motherboard with built in sound and video. It was used and abused by several people before it was left outside my door one dark and stormy night. People who know me, know I take in strays. It's currently running version 2.2 of DSL. I think it's 2.2rc1 or maybe rc2. I should probably have upgraded to the offical release of 2.2 when it was ready but "I'm busy" and what the heck, the machine seems to be working just fine on the release candidate version. I tend not to upgrade unless there is a very good reason to do it. It's a frugal install with a persistent /home and /opt directory. I run JWM on the server instead of Fluxbox because I've read on the forum that fluxbox takes a little more resources and may have a memory leak. I like fluxbox as a desktop but JWM works just fine for the server (I know I'm a wuss for using a gui on a server... but at this point in my life a few cpu cycles are easier to waste then brain cells that try to remember arcaine command line parms.)
Rsync will syncronize two directories. So if you have a directory you want to backup (like maybe your home directory) you can copy it via rsync to some other machines backup directory. The first time you run it, it copies all the files. The next time you run it, it only copies the changed files. So in essence you have a mirror copy on the backup machine. Don't ask me about security. This is a home network behind a router/firewall. It's good enough.
So you download the rsync.dsl module onto the server. After doing a little reading I decide I want to run rsync on the server as a daemon (because all the really cool guys are running daemons...) I've set up a directory on the servers new hard drive (which is the fourth IDE device in the box making it: hdd, on partition 1 so we have, hdd1) called 'backups'. Under the 'backups' directory I've created a subdirectory for each machine I want to backup. I used emelfm to change the permissions on the 'backups' directory and all the subdirectories so that they can be read or written to by anyone. Like I said security isn't a concern, my wife or kids not being able to access something when I'm not here IS a concern. I also know there's some great command chown or crown or something that will set these permissions if I could remember the command and the magical numbers to go with it but emelFM works and life is short.
I need the hdd1 partition mounted at bootup so I added a line into /opt/bootlocal.sh so now it looks like this:
#!/bin/bash
loadkeys us
#
# force the same ip addr at each boot
#
ifconfig eth0 192.168.1.125 netmask 255.255.255.0
route add default gw 192.168.1.1
ifup eth0
#
# mount drives you need at bootup
#
sudo mount /dev/hda7 /mnt/hda7
sudo mount /dev/hda6 /mnt/hda6
# new backups drive
sudo mount /dev/hdd1 /mnt/hdd1
#
# startup the xampp stuff
#
cd /opt/lampp
sudo /opt/lampp/lampp start
#
# startup samba
#
sudo nmbd -D -s /opt/samba/smb.conf
sudo smbd -D -s /opt/samba/smb.conf
#endfile
The only thing new is the mount of the hdd1 device.
Once the server is booted I start the rsync daemon manually. It should be easy enough to do this automatically by adding the command to .xinitrc but I just haven't gotten around it it yet and I don't reboot the server very often. The command I use is:
sudo rsync --daemon --config=rsyncd.conf
My rsyncd.conf file looks like this:
uid = dsl
gid = users
log file = /opt/log/rsync/rsnc.log
;
[backups]
read only = no
path = /mnt/hdd1/backups
comment = backup area
transfer logging = yes
;endfile
If you want the log file like I have here then you'll need to create a directory structure of /opt/log/rsync and make sure the permissions are open.
That's it for the server. It should be up and humming. Now how do we do the backups.....
I've created some scripts to help me. You see, on this home network, all of the machines that have Windows installed on them also have a secondary boot into some form of Linux. I had a Linux rsync client but I didn't have a Windows rsync client. After looking around for a little while I decided not to bother. I'd just have the Linux client backup the Windows partition also. So I started to put together some very simple scipts to do the backups. They're not very sophisticated but they do the job.
Here's a copy of the script called rBackup.sh that I run on an WindowsXP/Ubuntu computer:
#!/bin/sh
# this will backup ubuntuuser home to the 192.168.1.125 machine
# some files are excluded - see rsync-exclude.txt and rsync-exclude-win.txt
#
rsync -avvz --stats --delete --exclude-from=/home/ubuntuuser/rsync-exclude.txt /home/ubuntuuser rsync://192.168.1.125:/backups/ubuntu504/ |tee -a rBackup.log
sudo mount -r -o uid=ubuntuuser /dev/hda1 /media/windows
rsync -avvz --stats --delete --exclude-from=/home/ubuntuuser/rsync-exclude-win.txt '/media/windows/Documents and Settings/Bob/My Documents' rsync://192.168.1.125:/backups/windows1/Bob |tee -a rBackup.log
#endfile
This script gets run from a shell on the Ubuntu machine. It syncs the home directory of the ubuntuuser (that really the users name like dsl is the user name on a DSL box) with a directory on the backup computer called /backups/ubuntu504/
The output of the command is printed on the screen and tee'd off rBackup.log file on the Ubuntu machine. I don't want to backup some files. They are listed in the rsync-exclude.txt file. I'll show you that farther down.
Then a mount command is issued to mount the partition that contains the WindowsXP data. I should have probably done some sort of check to see if it was already mounted and then checked to see if the mount worked but I'll leave that up to someone else to figure out and post.
After the mount we backup the My Documents directory of the Bob user from WindowsXP. Any directory structure that contains spaces should be enclosed in single quotes (or as we use to call them, apostrophies).
I'm sure with a little tweaking you can backup whatever you want or at least whatever you have read access to.... Remember the first time it copies everything. Then after that only the changes. Just run the rBackup.sh script once in a while and you'll have a nice backup of you files. I also find it handy to share the servers 'backups' directory under samba so I can get to backed up versions of files even if the client machine isn't turned on. "Oh I need the list of work phone numbers... it's on the laptop, in the trunk of the car...Hey wait, I've got that file backed up on the server....Great!"
The exclusions for the Ubuntu partition follow:
#
# This is a list of directories and files that will be
# EXCLUDED from the rsync backup
# blank lines, or lines starting with a '#' or ';' are ignored
#
#
# These directories and files will NOT be backed up
#
- /ubuntuuser/NoBackup/
- /ubuntuuser/tmp/
- /ubuntuuser/.Trash/
- /ubuntuuser/.mozilla/
#endfile
The exclusions for the Windows partion follow:
#
# rsync-exclude-win.txt
#
# This is a list of directories and files that will be
# EXCLUDED from the rsync backup
# blank lines, or lines starting with a '#' or ';' are ignored
#
#
# These directories and files will NOT be backed up
#
- *.zip
- *.mp3
- *.avi
- *.mpg
- *.mpeg
- *.iso
- *.tar
- *.tar.gz
- *.wav
- *.dsl
#endfile
Look on the DSL forum for help to your questions since I don't look at the blog pages too often... Feel free to post revisions or point out where I've gone totally off the deep end.
Good luck,
newolduser at gmail dot com