Backing up your Linux home directory in a flash

by infernus_crusher on November 29, 2009

in Ubuntu

This is a quick and dirty method of backing up each and every directory that you have in your home folder. Most of you would probably know this anyway, but I thought I might just repost it here.

tar cvpf backup.tar `ls`

Perhaps a better way is to create an incremental backup each time.

tar cvpf backup.tar -g snapshot `ls`

This command compares the timestamps of files in the current directory with that of snapshot, and the resulting differences are written into backup.tar. This method ensures that you only write incremental changes and not the whole directory over and over again.

If there is any particular file/folder you do not want to backup, you can specify the –hide option in ls as follows:

tar cvpf backup.tar -g snapshot `ls --hide=Desktop`

That will ensure that the Desktop folder is not backed up.

Related Posts Plugin for WordPress, Blogger...

{ 7 comments… read them below or add one }

Arsento November 29, 2009 at 7:29 pm

I added your blog to bookmarks. And i’ll read your articles more often!

Jens November 29, 2009 at 11:56 pm

Thank you, i will save this :)

Andreas Marschke November 30, 2009 at 2:35 am

This is wrong the filesystem is not meant to be mounted on the ~/Desktop/ directory the only thing contained in there should normally be *.desktop files which refer to the filemanager to open the directory at which the mounted device is actually mounted.

If you really are that insane and want to mount a a device in your ~/Desktop/ directory execute the following:

mkdir ~/Desktop/MountedFS
sudo mount /dev/sd** /home//Desktop/MountedFS
where /dev/sd** stands for the (USB or SCSI) Device you want to mount. In case you have a IDE harddrive you want to mount the command would be /dev/hd** .

The FHS(http://proton.pathname.com/fhs/) is very clear and strict about where you actually can/should mount devices!

infernus_crusher November 30, 2009 at 7:11 am

Hi Andreas Marschke,

Thanks for the feedback. I’ll edit the post to reflect the changes. But no, I did not mean that one should try mounting their file systems on the Desktop.

rogerrulez April 6, 2010 at 3:41 am

That’s a great way !! I’m running the backup now and I’m new to linux so how do I do a restore ??

rogerrulez April 6, 2010 at 3:42 am

Btw, I just found this site and it’s great !!

rogerrulez April 6, 2010 at 9:12 pm

Am I allowed to post questions or comments here ??

Leave a Comment

{ 2 trackbacks }

Previous post:

Next post: