Backup Linux Hard driver image

Linux does not restrict you from copying anything so use TAR to archive all files in one directory. (next time I will try Ghost)

1: Backing-up
sudo su [become a super user]
cd / [ mvoe to the root directory)
tar cvpzf backup.tgz --exclude=/proc --exclude=/lost+found --exclude=/backup.tgz --exclude=/mnt --exclude=/sys /
[c: to create a new archive; v: print verbose info on screen; p:preserve permissions'(to keep the same permissions on everything the same); z for file compress, it might not be a good idea to compress files, use it for non critical applicatons. f: file name]
[make sure you don’t include the file itself, or else you’ll get weird results. You might also not want to include the /mnt folder if you have other partitions mounted there or you’ll end up backing those up too. Also make sure you don’t have anything mounted in /media (i.e. don’t have any cd’s or removable media mounted). Either that or exclude /media.]
[At the end of the process you might get a message along the lines of ‘tar: Error exit delayed from previous errors’ or something, but in most cases you can just ignore that.]

2: Restoring
Make sure you are root and that you and the backup file are in the root of the filesystem.
WARNING: this will overwrite every single file on your partition with the one in the archive!
tar xvpfz backup.tgz -C /

3: Re-create the directories that were excluded:

  • mkdir proc
  • mkdir lost+found
  • mkdir mnt
  • mkdir sys
  • etc…

And when you reboot, everything should be the way it was when you made the backup!

4: GRUB restore
If you installed windows or your GRUB was damaged. then

  1. Pop in the Live CD, boot from it until you reach the Desktop.
  2. Open a terminal window or switch to a tty.
  3. Type “grub”
  4. Type “root (hd0,6)”, or whatever your harddisk + boot partition numbers are (my /boot is at /dev/sda7, which translates to hd0,6 for grub).
  5. Type “setup (hd0)”, ot whatever your harddisk nr is.
  6. Quit grub by typing “quit”.
  7. Reboot.

Leave a Reply

Your email address will not be published. Required fields are marked *