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/

Samstag, 11. Juni 2011

removing U3 cd image from usb stick

Hi guys and girls,

i finally found out how i can get rid off this enoying U3 partition from those sandisk
Usb Sticks. Just get the u3-tool and issue

u3tool -p 0 E /dev/sdX

where X is you device. Be certain you have a backup since this could destroy your data.

Donnerstag, 14. April 2011

S.A.K.C introducing SUSE Automatic Kernel Compiler

hi girls and guys,

in one of my lasts posts i briefly wrote about how you actually can install the latest kernel from Kernel:HEAD repository for your current release of opensuse using just the kernels src.rpm file.

Especially the last steps where you actually install the kernel and have to create a proper initrd as well as proper entries into /boot/grub/menu.lst are quiet tricky and messing them up may result in a system which no longer boots.

Spending some time in the opensuse forums i found this script. I also packaged an rpm in my :home Repository. So all you have to do now is to simply apply the patches and retar bz2 the sources and run the script.

If you get the Scripts from my repository you will find the script sakc and klist in the /usr/bin directory. I've modified them a little. Go to the ~/Kernel directory (if you don't have one create it) and type:

sakc ~/Download/linux-2.6.39.rc3.tar.bz2



The Script will unpack the sourcefile for you and configuring your kernel using the /proc/config.gz file. If you want to configure the kernel before sakc compiles it, you can do so. The script will ask if you want to configure it and is using make menuconfig. So you can spend some time to configure the kernel properly according to your needs.

Leaving the kernels configuration menu begins sakc to compile the kernel. The good thing is that the script determines how many cores you currently have and according to this uses the -j option to optimize the kernel compiling process.



After compiling is done you will be prompted for the root password, so don't leave the computer unwatched, and the script will not just install the kernel and its modules but also will create a valid initrd and a entry in
the /boot/grub/menu.lst

Donnerstag, 24. März 2011

Putting users configuration under Git version control

Hi girls and guys,

today i want to show you something which a friend of mine
Reiner Herrmann pointed out for me.

There are two main reasons why you want to put your configuration under version control. You can document what you are changing and when you are changing files like ~/.bashrc or ~/.vimrc for example. At least those are the files which changes quite often on my machines. And the second reason is to simply providing an easy way to restore your configuration when things became messed up.

First make sure you have installed git. This should be in the main repository of your distribution. For Debian simply install it using apt-get install git.

I am now going to show you how you can put your ~/.bashrc under version control
using git.

If you are not familiar with git simply go to the website. You find all documentation
you will ever need on this website.

Let's assume for now i am under /home/matthias. Create a Directory ~/.local_gitrc

mkdir ~/.local_gitrc

and create the Git Repository by navigating in this particular directory you've just created. Here you can initialize your git Repository by typing:

git init

That's all. Your Git Repository have been initialized. Next you copy the original ~./bashrc to this
directory

cp ~/.bashrc bashrc

and add this to your git directory blob

git add bashrc

Make your first commit.

git commit -m " bashrc: initial commit"

Now as the final step link the Script in Your Git Repository to it's original location.

ln -sf /home/mattias/.local_gitrc/bashrc /home/matthias/.bashrc

There have been a lot of suggestions around the internet that you should be able to do this with the
/etc directory too. The result is a a script called etckeeper.



Thats it.