Monday, December 8, 2014

You'se a big fine SysAdmin - Won't you back that drive up?

Reference to shitty and misogynistic rap aside, it's always important to know how to back your drives up. For the LFSA exam, the requirement is rather ambiguous and doesn't seem to provide any direction as to how they want you to do accomplish this. Nevertheless, there's a bunch of ways to do it and they are all relatively easy.

Creating Backups:
  1. dd - Use this tool to take complete back ups of entire partitions or drives.
    1. dd if=[device you want to backup] of=[backup.img]
      1. IMPORTANT: This backup will be of the entire extent of the device you mention even if there is space on the drive. It will backup the entire extent.
  2. rsync - use this tool if you need to perform backups over a network.
    1. rsync -av [source] [destination]
  3. tar - Standard archiving.
    1. tar cvf tarball.tar /directory/
Some practical code:
  1. dd if=/dev/sda of=/backups/sda.img
  2. rsync -av /root/ /backups/
  3. tar cvfj rootarchive.bz2 /root/
Restoring Backups: Pretty much straightforward in most cases.
  1. dd - simply reverse the process
  2. rsync - Same idea as dd - Reverse the process.
  3. tar - Use the extract directive (x)
Some practical code:
  1. dd if=/backups/sda.img /dev/sda
  2. rsync -v /backups/ /root/
  3. tar xvfj rootarchive.bz2
    1. Make sure you are in the directory you want to the data to be unpacked into.
As always, consult man pages for more information.

So this will give you a quick and dirty rundown - I can't imagine that the Linux Foundation will require you to do crazy backups of large partitions. I think they want to see rsync and tar mostly as dd can be extremely time consuming. But we will see. My exam is Wednesday at 9AM EST

No comments:

Post a Comment