Description ----------- This script is to be used for backing up a network of Windows machines to a large local hard drive on a Linux server. Using free utilities it is possible to have a simple snapshot-based backup system of a Windows network. Design ------ The process is simple: 1. nmblookup the NetBIOS name to find the IP address of PC to be backed up 2. Verify MAC matches the one known stored in a configuration file for the NetBIOS name 3. smbmount the defined shares 4. Use rsync to perform a pseudo-snapshot backup as described at http://www.mikerubel.org/computers/rsync_snapshots/ Requirements ------------ I use this script on a LAN of Windows PCs that all get dynamic IPs assigned via DHCP. The following are the requirements: 1. All MAC addresses of the PCs must be known 2. All NetBIOS names of the PCs must be known 3. The drive/share that you wish to backup must be smbmountable 4. There should be no PCs with the same NetBIOS name 5. Linux system with rsync and smbmount that will do backups I also suggest applying the unicode patches available here: http://www.hojdpunkten.ac.se/054/samba/ Otherwise you may get character set translation problems when accessing certain files on Windows clients. Configuration ------------- Create a winbackup.cfg file. The format is as follows. Fields are separated by semicolon (;). Fields in brackets ([]) are optional. [IP];[MAC];NETBIOS;STORENAME[;[MOUNTUSER];[MOUNTPASS];[KEEPNUM];[WINDOW]] SHARE:DIR SHARE:DIR .. IP = IP address MAC = MAC address(es) (multiple separated by '|') NETBIOS = NetBIOS name STORENAME = Directory name to store backups in MOUNTUSER = User to mount shares as MOUNTPASS = Password to mount shares as KEEPNUM = Number of backups to keep WINDOW = Range of hours when backups should be done (i.e. '0-5' means 12am to 5am) Example winbackup.cfg file: ;00:08:74:E4:39:5C;artichoke;jdoe c$:/work c$:/Documents and Settings/John Doe 1.2.3.4;;blah;msmith;;;3 c$:/Documents and Settings/msmith ;00:20:78:1C:C8:CD;tauntaun;valankar;;;;0-5 c$:/Documents and Settings/valankar ;00:06:5B:B9:13:E1|00:0B:DB:21:84:EB;mars;kathy e$:/Program Files/Outlook PST files winbackup.exclude are files to exclude (see 'man rsync') Running ------- You can run like the following: ./winbackup.pl | tee winbackup.out I use something like this via cron: # Backup PCs, trying every hour for off PCs 0 * * * * cd /disk/store1/backup/pcs; ./winbackup.pl > winbackup.out Bugs and Suggestions -------------------- Send to valankar@bigfoot.com