[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Preferred Backup Method?

On Tue, Dec 04, 2007 at 05:19:48PM -0500, Michael Pobega wrote:
> Just `tar -cvvf backup-`date`.tar /`? Is it really that simple?

You don't need to backup the whole /.

I have a file called backuplist:

and I have a file called excludelist:


These are both in /usr/local/lib/backup, although they should go in
/etc/ but I wanted to avoid any conflicts with any package I may install
that would have /etc/backup/.

For completeness, here's my whole backup script.  This is for my main
box titan.  Less complex scripts are run on other boxes.  Other scrips
do the rsync.  Note that my /home is on a cat lvm while my system
(including /var/local where the backups go) is on lvm over raid1.



### special to hostname titan
# Backup to /var/local/backup/titan

# backing up directories listed in /usr/local/lib/backup/list
# and excluding those in /usr/local/lib/backup/excludelist
/bin/echo -e "System Backup"
/bin/echo -e "=============\n"
/bin/echo -e "First: ensure users have saved essential stuff to ~/essential_backup,"
/bin/echo -e "either as sym-links or actual files; backup will dump links as files."
/bin/echo -e "Examples may be: exporting bookmarks list, special docs, etc."
/bin/echo -e "Backup will then save those to a separate file before"
/bin/echo -e "running the main backup program.\n"
/bin/echo -e "\nBackup files will be in /var/local/backup/titan/"
/bin/echo -e "and will be done in order of priority to restoring the system."
/bin/echo -e "These can then be copied to media-of-choice.\a\n"
/bin/echo -e "\nBackup takes around 10 minutes.\n"
read -p "Press <enter> when ready to continue backup"

/bin/echo -en "\nSaving grub menu.lst..."
/bin/cp -af /boot/grub/menu.lst /var/local/backup/titan
/bin/echo -e "Done."

/bin/echo -en "\nSaving necessary /etc/files plain text..."
## note: bare-bones recovery from basedebs.tar.gz doesn't have bzip2
## so with entire /etc/ backed up bzip2, need everything that we'
## need prior to and for connecting to the internet available
## in either plain text or gzip.

mkdir -m 0750 /var/local/backup/titan/etc
chown root.adm /var/local/backup/titan/etc

/bin/cp -af /etc/fstab /var/local/backup/titan/etc
/bin/cp -af /etc/modules /var/local/backup/titan/etc
/bin/cp -af /etc/hosts /var/local/backup/titan/etc
/bin/cp -af /etc/hosts.allow /var/local/backup/titan/etc
/bin/cp -af /etc/hosts.deny /var/local/backup/titan/etc
/bin/cp -af /etc/inittab /var/local/backup/titan/etc
/bin/cp -af /etc/network/interfaces /var/local/backup/titan/etc
/bin/cp -af /etc/hostname /var/local/backup/titan/etc
/bin/cp -af /etc/modutils/ /var/local/backup/titan/etc/
/bin/rm -rf /var/local/backup/titan/etc/modutils/arch
/bin/cp -af /etc/modprobe.d/ /var/local/backup/titan/etc/
/bin/cp -af /etc/resolv.conf /var/local/backup/titan/etc
/bin/cp -af /etc/ppp/	/var/local/backup/titan/etc/
/bin/cp -af /etc/chatscripts/ /var/local/backup/titan/etc/

/bin/echo -e "Done."

/bin/echo -en "\nSaving the partition table and disk usage information..."
/sbin/fdisk -lu /dev/sda > /var/local/backup/titan/sda_partitions
/sbin/sfdisk -d /dev/sda > /var/local/backup/titan/sda_sfdisk.out
/sbin/fdisk -lu /dev/sdb > /var/local/backup/titan/sdb_partitions
/sbin/sfdisk -d /dev/sdb > /var/local/backup/titan/sdb_sfdisk.out
du -c --si --max-depth=1 /* > /var/local/backup/titan/dusummary 2>/dev/null
df --si > /var/local/backup/titan/dfsummary
/bin/echo -e "Done."

/bin/echo "Saving package selection..."
dpkg --get-selections > /var/local/backup/titan/inst_deb.sel
aptitude search '~i!~M' > /var/local/backup/titan/apt_inst.sel
/bin/echo "Done."

/bin/echo -e "Backing up /root/service/ to /var/local/backup/titan"
/bin/cp -af /root/service/  /var/local/backup/titan/

/bin/echo "Saving etc.tgz.bak" 
/bin/cp -af /var/local/backup/titan/etc.tgz /var/local/backup/titan/etc.tgz.bak
/bin/echo -e "Backing up /etc/ to /var/local/backup/titan/etc.tgz"
/bin/tar -czf /var/local/backup/titan/etc.tgz /etc/ 
/bin/echo -e "Done."
/bin/echo "Removing saved etc.tgz.bak"
/bin/rm -f /var/local/backup/titan/etc.tgz.bak
/bin/echo "Done."

/bin/echo "Saving es_bk.tgz.bak"
/bin/cp -af /var/local/backup/titan/es_bk.tgz /var/local/backup/titan/es_bk.tgz.bak
/bin/echo -e "\nBacking up /var/local/essential_backup/ >"
/bin/echo -en "                            /var/local/backup/titan/es_bk.tgz"
/bin/tar -czhPf /var/local/backup/titan/es_bk.tgz /var/local/essential_backup/
# c=create, -h=don't dump symlinks, but files pointed to
# P=ablsolute path name so they go back exactly where they belong
/bin/echo -e "Done"
/bin/echo "Removing saved es_bk.tgz.bak"
/bin/rm -f /var/local/backup/titan/es_bk.tgz.bak
/bin/echo "Done."

#/bin/echo "Saving backup.tgz.bak"
#/bin/cp -af /var/local/backup/titan/backup.tgz /var/local/backup/titan/backup.tgz.bak
#/bin/echo -e "Backing-up complete system: > /var/local/backup/titan/backup.tgz"
#/bin/tar -czf /var/local/backup/titan/backup.tgz -T /usr/local/lib/backup/backuplist -X /usr/local/lib/backup/excludelist
#/bin/echo "Removing saved backup.tgz.bak"
#/bin/rm -f /var/local/backup/titan/backup.tgz.bak
#/bin/echo "Done."

/bin/echo -e "Backing-up complete system: > /var/local/backup/titan/backup.tgz.XX"
/bin/rm -f /var/local/backup/titan/backup.t*
/bin/tar -cz -T /usr/local/lib/backup/backuplist -X /usr/local/lib/backup/excludelist | split -b 600m - /var/local/backup/titan/backup.tgz. 
/bin/echo "Done."

/bin/echo "Saving uldl.tgz.bak"
/bin/cp -af /var/local/backup/titan/uldl.tgz /var/local/backup/titan/uldl.tgz.bak
/bin/echo -e "Backing up /home/dtutty/uldl > /var/local/backup/titan/uldl.tgz"
/bin/tar -czf /var/local/backup/titan/uldl.tgz /home/dtutty/uldl/
/bin/echo "Removing saved uldl.tgz.bak"
/bin/rm -f /var/local/backup/titan/uldl.tgz.bak
/bin/echo "Done."

/bin/echo "Changing oweners and permissions of /var/local/backup/titan"
/bin/chown -R root.adm /var/local/backup/titan/*
/bin/chmod -R o-rwx /var/local/backup/titan/*
/bin/chmod -R g+rw /var/local/backup/titan/*
/bin/echo "Done."

/bin/echo -e "\nBackup finished.\n"

/bin/echo -e "Remember to copy to floppy."

# vim: tw=0 :

Reply to: