Taking a system image in Linux


I have been playing around this week trying to find the best way to take a system image of a linux system.  The are loads of ways to achieve this but this tutorial will concentrate of using the tar package.

The command is:

BACKUP

tar cvpzf mint.tgz –exclude=/proc –exclude=/lost+found –exclude=/mint.tgz –exclude=/mnt –exclude=/sys —exclude=/media /

RESTORE

tar xvpzf mint.tgz -C /

Ok lets explain this a bit.  The above commands must be run as root.  Your backup will be stored in the directory in which you run the first command.  For example if you want to backup to a network share mount the share and run the command in the root of the share.

Cvpzf stands for compression (vzf), permissions (p) and create achive (c) while mint.tgz is your backup name.  We have also excluded some directories which you don’t really need to copy.  You should definitely exclude media and mnt as any partitions mounted here will also be copied, along with the backup itself (in this case mint.tgz).  If you copy the backup you are making you will get some weird results!!  Finally the / at the end of the command specifies that you are copying the root directory.  If you only wanted to copy your home directory you could change this to /home.

To restore your backup run the second command from the directory in which the backup is stored.  Be warned that once run the backup will overwrite the relevant directories on your system.  For example if you backed up the root directory your root directory will be overwritten once the command is executed.

All that is left is store your backup some place safe, away from your system, ready for future use.

About the Author

Hi I am Chris the owner of ComTech. I provide IT Support, Laptop repairs and Computer repairs to both personal and business clients in and around Stirling. For a list of what I can offer you why not visit my website www.comtech247.net where you will find my blog, testimonials, services and much more.  Start supporting a local business today so I can start supporting you.

If you found this blog useful then why not sign up to my RSS Feed for news, tutorials, views and general techie stuff!!

 

This entry was posted in Blog and tagged backup, computer repair, image, IT Support, laptop repairs, linux, stirling, tar. Bookmark the permalink.

3 comments on “Taking a system image in Linux

  1. Very good written post. It will be supportive to anybody who employess it, as well as yours truly :). Keep up the good work – i will definitely read more posts.

  2. Saved as a favorite, I love your site! :)

  3. Hi there I stumbled upon your site by mistake when i searched Google for this concern, I need to point out your blog is really valuable I also really like the layout, its superb!

Leave a Reply

Your email address will not be published.

50,832 Spam Comments Blocked so far by Spam Free Wordpress

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>