How do I backup my Linux system disk

Posted in June 25th, 2007
by peorex in How to

In my operating system I have divided disk space generally with two independent purposes: system data and user data.
When I do potentially dangerous tasks, such as change important system settings, re-install all system, re-partition disk and so on I used to backup data. This is done as root:

#tar -cvPf /home/root/Backups/backup.tar /bin /boot /etc /lib /opt /sbin /usr /var /initrd.img /vmlinuz

This way essential system directories are saved in one file. The /home directory is not backed up because it contains my user data, including backups itself.

Further, if I need to restore the previous state, I do it this way as root:

#tar -xvPf /home/root/Backups/backup.tar

If the system is seriously damaged and can not boot, then I boot from another partition or bootable CD, generally from another media. Then mount the partition to be restored and extract the .tar archive. As root:

#mount /dev/hda2 /mnt
#cd /mnt
#tar -xvf /home/root/Backups/backup.tar

If the archive is restored to non-original partition some changes may need to be done, such as mount point for / in file /etc/fstab, settings on LILO, GRUB, etc.

My Linux distribution is Debian, but this kind of doing things is expected to work equally well with any distribution because it relays on basic tools such as tar.

Tags:
Follow-up responses to this entry through the RSS feed, Leave a Reply or Trackback from your own site.

Leave a Reply

 Username (*required)

 Email Address (*private)

 Website (*optional)