June 08, 2010

Backing Up Your Linux Data and Keeping Your Programs Durring Upgrades

Alternate Ubuntu logo. Derived from a GPL logo...Image via Wikipedia

By The Computer Doctor:

As many of you may have read in my past posts, I have always had difficulty with upgrading from one Ubuntu version to the next. With the exception of the transition from Karmic Koala 9.10 to Lucid Lynx 10.04 I have never successfully upgraded using the graphical installer.

So I was left backing up my personal data, installing the new OS, restoring my personal data and then going through the repositories and re-installing the programs that I use the most. What a pain!

Fast forward a few years and we now are blessed to have a great friend home from the mission field who gave us this tip for backing up your data and also restoring data which is particularly helpful when we upgrade the OS.

Step One: The Backup.
If you want to back up all your hidden files, then you'll have to be root to do this.
To become Root in Ubuntu type Sudo and then Enter. Now enter your password when prompted.
Also note that gene is our guru's name and you should replace gene in this example with your own home directory name.
To back up /home/gene, become root, and use this code:
cd /home tar -cvf gene.tar gene
That will create a file in /home with the name "gene.tar". If you have a lot of data, it will be a pretty big file. Hopefully it will be less than 700MB so you can fit it on a blank CD. If not, burn it to a DVD. You can make it a little smaller by using compression - the command for this is almost the same:
tar -zcvf gene.tar.gz gene

Step Two: Restoring The Data Into The Home Directory
After you've installed your new OS, create a user gene. Then you'll have to erase gene's home directory, copy the tar file to the home directory and untar it with this code:
cd /home rm -fr gene cd /media/cdrom cp gene.tar /home cd /home tar -xvf gene.tar
If you used file compression, the command would be:
cd /home rm -fr gene cd /media/cdrom cp gene.tar /home cd /home tar -zxvf gene.tar.gz
I'm assuming in the above that the OS mounts the cdrom at /media/cdrom (that's where Ubuntu puts it). It could be /mnt/cdrom, or perhaps a different location if you used a USB flash drive.

What does this do?
The home directory stores your documents, pictures and music. Equally important are the hidden files in the home directory that stores all of your installed programs and settings. I used to find it amazing that Linux programs could be so small, but now I'm more amazed that Windows programs could be so bloated.
So by backing up this home directory, you are in essence preserving all of your personal data and programs so if anything happens you will just need to install the OS and restore your home directory to get back to where you needed to be.

Reblog this post [with Zemanta]

No comments:

Hex Converter

Hex To ASCII Converter



Integer to Byte converter

This is a tool to practice converting between decimal and binary representations. After you have practiced for a while and feel that you know how to do the conversions, take the quiz.
Decimal number to convert:
Binary representation:

Binary number to convert:
Decimal representation: