Tarball it. Multiple TARs, actually.
On alternating weeknights, (3 am) I run bu2tar.scr or bu2tar2.scr, then on Saturday I run bu2tar3.scr. These each do a full backup of all my personal data (no system files -- that's another set of scripts, below) onto a secondary internal hard drive using alternating different partitions.
Each of /mnt/backup, /mnt/backup2, and /mnt/backup3 are 128 G partitions on my large secondary hard drive which I only use for backups.
I suppose I waste a lot of energy, but I've been doing this for many years, I understand it, and they run while I'm sleeping. Here is what one of those look like:
Code: Select all
$ cat bin/bu2tar.scr
#!/bin/sh
mount /mnt/backup
cd /
tar cpzf /mnt/backup/data/bak.tgz scratch/bak/
tar cpzf /mnt/backup/data/bin.tgz scratch/bin/
#tar cpzf cdrecord.tgz /scratch/cdrecord/
tar cpzf /mnt/backup/data/Documents.tgz scratch/Documents/
#tar cpzf dosc.tgz /scratch/dosc/
#tar cpzf dosg.tgz /scratch/dosg/
tar cpzf /mnt/backup/data/Downloads.tgz scratch/Downloads/
#tar cpzf dso.tgz /scratch/dso/
#tar cpzf err.tgz /scratch/err/
#tar cpzf home.tgz /home/
tar cpzf /mnt/backup/data/home.tgz -X /scratch/bin/exclude.home home/
tar cpf /mnt/backup/data/graphics.tar scratch/graphics/
#tar cpzf Mail.tgz /scratch/Mail/
#tar cpf /mnt/backup/data/mntavwork.tar mnt/av/work/
tar cpzf /mnt/backup/data/mozilla.tgz scratch/.mozilla/
tar cpf /mnt/backup/data/mp3.tar scratch/mp3/
tar cpzf /mnt/backup/data/pdf.tgz scratch/pdf/
tar cpf /mnt/backup/data/photos.tar scratch/photos/
#tar cpzf pkg.tgz /scratch/pkg/
#tar cpzf text.tgz /scratch/text/
tar cpzf /mnt/backup/data/thunderbird.tgz scratch/.thunderbird/
#tar cpzf /mnt/backup/data/vbox.tgz -X /scratch/bin/exclude.vbox home/figueroa/.VirtualBox/
tar cpzf /mnt/backup/data/vbox.tgz home/figueroa/.VirtualBox/
tar cpzf /mnt/backup/data/vboxmnt.tgz mnt/vbox/VDI/
tar cpzf /mnt/backup/data/vboxvm.tgz "home/figueroa/VirtualBox VMs/"
tar cpzf /mnt/backup/data/wav.tgz scratch/wav/
tar cpzf /mnt/backup/data/webdev.tgz scratch/webdev/
tar cpzf /mnt/backup/data/www.tgz scratch/www/
#tar cpzf /mnt/backup3/data/janbak.tgz home/jan/
cd
umount /mnt/backup
I have a personal bin directory in /home/myusername/bin which I use for my large collection of scripts. (actualy, bin in my home directory is a symlink and the real home bin is at /scratch/bin) Why do I use a personal /scratch partition? Because, eons ago, drives were small and therefore partitions were small and I ran out of space in /home so I made /scratch and kept doing it as a habit. I don't recommend it.
Here is my personal crontab:
Code: Select all
#Sun, Tue, Thu
1 3 * * 7,2,4 /home/figueroa/bin/bu2tar.scr
#Mon, Wed, Fri
1 3 * * 1,3,5 /home/figueroa/bin/bu2tar2.scr
#Sat
1 3 * * 6 /home/figueroa/bin/bu2tar3.scr
My personal data is found on either /home or /scratch with some additional VirtualBox virtual machines on /mnt/vbox, all on drive /dev/sda/, roughly 80 gig of data, and takes roughly an hour on a fast machine with spinning hard drives. You'll see some of the rows are commented out, old archival stuff where I no longer make any changes. Those collections that make sense to compress are compressed, and things like mp3 files and photos are not compressed.
Five times a month I backup my system files with another script that runs on specified days at 6 am:
Code: Select all
$ cat bin/gentoo2bak.scr
#!/bin/sh
#gentoo2bak.scr
mount /mnt/backup
cd /
tar cpzf /mnt/backup/sysbak/bin.tgz --xattrs --numeric-owner bin/
tar cpzf /mnt/backup/sysbak/boot.tgz --xattrs --numeric-owner boot/
tar cpzf /mnt/backup/sysbak/dev.tgz --xattrs --numeric-owner dev/
tar cpzf /mnt/backup/sysbak/etc.tgz --xattrs --numeric-owner etc/
tar cpf /mnt/backup/sysbak/home.tar --xattrs --numeric-owner --no-recursion -X /scratch/bin/exclude.home2 home/*
tar cpzf /mnt/backup/sysbak/lib.tgz --xattrs --numeric-owner --no-recursion lib/
tar cpzf /mnt/backup/sysbak/lib32.tgz --xattrs --numeric-owner lib32/
tar cpzf /mnt/backup/sysbak/lib64.tgz --xattrs --numeric-owner lib64/
tar cpf /mnt/backup/sysbak/media.tar --xattrs --numeric-owner --no-recursion media/*
tar cpf /mnt/backup/sysbak/mnt.tar --xattrs --numeric-owner --no-recursion mnt/*
tar cpzf /mnt/backup/sysbak/opt.tgz --xattrs --numeric-owner opt/
tar cpf /mnt/backup/sysbak/proc.tar --xattrs --numeric-owner --no-recursion proc/
tar cpzf /mnt/backup/sysbak/root.tgz --xattrs --numeric-owner root/
tar cpf /mnt/backup/sysbak/run.tar --xattrs --numeric-owner --no-recursion run/
tar cpzf /mnt/backup/sysbak/sbin.tgz --xattrs --numeric-owner sbin/
tar cpf /mnt/backup/sysbak/sys.tar --xattrs --numeric-owner --no-recursion sys/
tar cpf /mnt/backup/sysbak/tmp.tar --xattrs --numeric-owner --no-recursion tmp/
tar cpzf /mnt/backup/sysbak/usr.tgz --xattrs --numeric-owner -X scratch/bin/exclude.usr usr/
tar cpzf /mnt/backup/sysbak/usrportage.tgz --xattrs --numeric-owner -X scratch/bin/exclude.distfiles usr/portage/
tar cpzf /mnt/backup/sysbak/var.tgz --xattrs --numeric-owner -X scratch/bin/exclude.var var/
tar cpf /mnt/backup/sysbak/scratch.tar --xattrs --numeric-owner --no-recursion -X scratch/bin/exclude.scratch scratch/
tar cpzf /mnt/backup/janbak/janbak.tgz --xattrs --numeric-owner home/jan/
cd
umount /mnt/backup
This is what my root crontab looks like for those:
Code: Select all
01 6 2,16 * * /home/figueroa/bin/gentoo2bak.scr
01 6 9,23 * * /home/figueroa/bin/gentoo2bak2.scr
01 6 30 * * /home/figueroa/bin/gentoo2bak3.scr
This is currently about 3.6 G, and takes and 18 minutes, more or less.
Once a week, normally on Saturday, I make a compressed, encrypted archive onto an external 128 G USB 3 flash drive (used about 95% of it) and keep these moved around to alternate locations. I use five differnt flash drives currently in rotation. These are for recovery from catastrophe. I expect never to need them. Running this takes 50-60 min. I do this manually, but I don't watch it as I'm doing other things. The script looks like:
Code: Select all
$ cat bin/targpgflash1.scr
#!/bin/sh
#targpgflash1.scr
#Encrypt and store data and OS backups on external media: targpgfire.scr
#If backup partition(s) already mounted, comment out mount and umount commands.
mount /mnt/backup
cd /mnt/backup
date > /run/media/figueroa/MicroCenter128/date1.txt
tar cvf - sysbak/* | gpg -c --batch --yes --passphrase-file /scratch/bin/.passrc --compress-algo none -o /run/media/figueroa/MicroCenter128/sysbackup.tar.gpg
date >> /run/media/figueroa/MicroCenter128/date1.txt
date > /run/media/figueroa/MicroCenter128/date2.txt
tar cvf - janbak/* | gpg -c --batch --yes --passphrase-file /scratch/bin/.passrc --compress-algo none -o /run/media/figueroa/MicroCenter128/janbackup.tar.gpg
date >> /run/media/figueroa/MicroCenter128/date2.txt
cd /
umount /mnt/backup
mount /mnt/backup3
cd /mnt/backup3
date > /run/media/figueroa/MicroCenter128/date3.txt
tar cvf - data/* | gpg -c --batch --yes --passphrase-file /scratch/bin/.passrc --compress-algo none -o /run/media/figueroa/MicroCenter128/databackup.tar.gpg
date >> /run/media/figueroa/MicroCenter128/date3.txt
cd /
umount /mnt/backup3
I didn't mention that once a week I also make a tarball of my wife's entire home directory which she uses occasionally, including a Windows virtual machine for geneology work, about 16 G. That's the last line of my system backup script which used to be in my personal data bakcup script.
I have used my collection of tarballs to recover from hard drive failure as well as to move my system from one computer to another. They work and they use commonly installed software found on any distribution, just tar, gzip, gnupg. I just happen to use Gentoo. Tweak to suit your needs and level of paranioa. Many people have told me not to do this, that I'm wasting space, etc., but it works, and hard drive space is cheap.
Logs are mailed to me nightly at the end of each backup run.