Mittwoch, 27. Juli 2011

My Backup Strategy Part I

today i will tell you something about the most important tasks of maintaining a system up and running. Today i will show you my backup solution.

In fact my backup solution does not involve technology you will find on server infrastructure such as raid or lvm. I was able to get all my system and private data backuped without this sophisticated technology. The reason why i don't use backup with raid and lvm is, that raid does not prevent you from doing stupid things. For example when you delete data on a RAID 1 array you also delete this data from all your backup disks as well.

I use only scripts and cron jobs and couple of extra hard disks. First thing i build in an extra hard disk of the same size which is mounted to /mnt/Backup.

This disk could be bigger than the disk where your operating system is sitting but it should not have less space.

For the systems backup you should realize that you do not need to save the data which were installed by rpm or debian packages. Instead to save time and space only save those files which are different from an installed or not installed by a system package. In suse you can use the yast backup tool which does exactly this. In debian you can create an iso image of installed packages from aptoncd program and find those files not installed and save this into a tar.gz file as the yast backup tool does.

With Yast you are able to easily set up a automated cronjob running once a week on friday 22 pm for example. It will save both the packages installed on your system and the list of packages you have installed. If you prefer a more stable backup you could use the script package_state and use the -s option to save the current state of packages in a tar.gz file.

In debian you can archive this by using:

dpkg -l|grep '^ii.*'|awk '{print $2}' >> installed.lst

apt-get install --download-only --from-file=installed.lst --targt=/Your/desired/directory

tar cvfz backuped_packages.tar.gz /Your/desired/directory

mv backuped_packages.tar.gz /mnt/Backup/system/

But i am not an Debian Expert. So there might be other ways for accomplishing this task.

Also i always make a copy of the whole /etc directory just in case. You could use etckeeper on debian systems. On rpm systems you have todo this task with the copy command:

cp -av /etc/* /mnt/Backup/system/etc/

With this solution when the backup disk fails you simply plug in a new disk a make a new backup. when the main disk fails, where your system is running on you plug in a new disk for system and recover your system from the packages you have previously installed.

And copying back the /etc directory and the files which were not installed
by any package.

Now for the users home directory i recommend to use separate /home partition so whenever installing a new system you dont need to delete these files. You can even backup the users files and settings wiht my rsync wrapper script
backup_userhome. You clearly need rsync to be installed. Afer that you can call the script with:

backup_userhome /mnt/Backup User

And restoration is just the other way around with restore_userhome

restore_userhome /mnt/Backup User

Be sure you delete all data from users home which where deployed during the insatllation, then have the restore script running and then login for the
first time. et vola all is back where it should be. you even can visit the files you were last working on by using the places in gnome.

thats it:
Part II will be written when gnu hurd ready or even earlier ;)

Freitag, 15. Juli 2011

LinuxWissen

Update:
Das Linuxwissen ist auf github umgezogen: https://github.com/tuxlover/LinuxWissen


Ich habe nun begonnen mein Linux Sheet in html zu gießen.
Dank zim konnte ich es relativ einfach bewältigen.
Es ist zu ca 40% fertig und enthält auch einige Verbesserungen gegenüber der Textvariante, die auch weiterhin verfügbar bleibt aber nicht mehr aktuallisiert wird.

Ich werde versuchen es relativ regelmäßig upzudaten. Eine finale Version kann es aufgrund der Komplexität natürlich niemals geben.

http://propstmatthias.bplaced.net/LinuxWissen/