post icon

Backing up your Linux home directory in a flash

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.

  • Share/Bookmark
Read full story »

9 Comments

Leave a comment
  1. Arsento
    29. Nov, 2009 at 7:29 pm #

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

  2. Jens
    29. Nov, 2009 at 11:56 pm #

    Thank you, i will save this :)

  3. Andreas Marschke
    30. Nov, 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!

  4. infernus_crusher
    30. Nov, 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.

  5. rogerrulez
    06. Apr, 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 ??

  6. rogerrulez
    06. Apr, 2010 at 3:42 am #

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

  7. rogerrulez
    06. Apr, 2010 at 9:12 pm #

    Am I allowed to post questions or comments here ??

Trackbacks/Pingbacks

  1. Backing up your Linux home directory in a flash | TuxWire : The Linux Blog - 30. Nov, 2009

    [...] Full Article [...]

  2. Tweets that mention Backing up your Linux home directory in a flash | AllForLinux.com -- Topsy.com - 30. Nov, 2009

    [...] This post was mentioned on Twitter by linuxcanuck, Larry King. Larry King said: Backing up your Linux home directory in a flash | AllForLinux.com: This is a quick and dirty metho.. http://bit.ly/82RfDd #Linux #News [...]