Posts tagged: backups

Backups: Quick and Dirty

During my career as a systems administrator I’ve learned two basic ways to perform backups. There are basically two different ways to backup a system; file level backups are where you specifically backup the files from the system. The other way is a bit by bit copy of the storage device.  Remember it is important to either be in single user mode or boot to a live CD.

A file copy:

~ # df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda4             145G  100G   39G  73% /
udev                   10M  192K  9.9M   2% /dev
shm                   1.3G   12K  1.3G   1% /dev/shm
/dev/sda1              38M   25M   12M  68% /boot

These are the file systems I am working with. As per my previous post, it is important to note that traditional copying won’t get everything. We will use the method I mentioned in my previous post to get all the data. We’ll also be backing up to /mnt/backups. For backups, I’m going to use the rsync command. It is pretty powerful and it only copies files that don’t already exist at the destination.

miar mnt # mount -obind / /mnt/root

Once the root file system is mounted on /mnt/root you can back that up to /mnt/backups. I’ve chosen to put it in a sub folder called root.

miar mnt # rsync -avHSx –numeric-ids –progress /mnt/root/ /mnt/backups/root

Once this complete, and it may take some time, it will be time to go to the next file system. In my above example, /boot is the only other file system that needs to be backed up. The shm and udev are dynamic file systems and are created upon boot. They do not need to be backed up.

miar mnt # rsync -avHSx –numeric-ids –progress /boot/ /mnt/backups/boot

Once this command finishes your backups are complete or you need to repeat the steps for /usr, /var, /local and or others.