Backing up and Restoring your Home folder


If you are into “distro hopping” i.e. playing with different Linux distributions, but wish to retain the contents of your Home directory, as well as keeping your Home directory in a separate partition, it’s a very good idea to back it up regularly to a removable USB storage device (pen drive, usb hard disk).

In my case I was just about to upgrade from Kubuntu 8.10 to 9.04 on my Dell laptop and decided that if the upgrade went wrong, protecting my data would be a very good idea!

A really easily way to do this is to use rsync http://www.samba.org/rsync/. rsync is a command line utility and therefore runs in Terminal/ Konsole.

I found some really simple instructions on http://www.cyberciti.biz/faq/use-rsync-to-backup-directory/. The first thing you need to do is mount the device, this is easily done by just opening the removable device in the normal way.

However, following the instructions I discovered a problem. Ubuntu does not mount removable devices to the mnt directory, but uses a directory called media.

So for Ubuntu users the command to backup your home directory to a external USB disk called (mounted as) disk would be:


$ rsync -au /home/
homefolder /media/disk

If you are not sure what your removable backup media is a called, from Terminal/ Konsole enter:

cd /media

and then to display the contents enter

ls

this will display your mounted devices and in my case my removable hard disk is called disk.

To restore all of your backed-up files back to their original folder enter:

$ rsync -au /media/disk /home/homefolder

basically the is the reverse of the earlier command.

The article also explains how to delete files in a backup directory which no longer exist in the source. Again a slight adjustment is required for Ubuntu users for the mnt command:

$ rsync -au –delete /home/homefolder /mnt/disk

=-=-=-=-=
Powered by Bilbo Blogger

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s