This has been working very well for me with Arch Linux on my netbook. Check that your flavor uses Grub before proceeding. This example tutorial uses a system with the following partition scheme:
- sda1: /boot
- sda2: /
- sda3: swap
- sda4: /home
Linux System Backup
Before backing up, it’s a good idea to put any relevant dotfiles into /etc/skel
also check that the system does not use uuid’s for rc.conf or menu.lst. If it does, you’ll have to correct those files manually (I leave it to you.)
- boot on a live-usb-disk
- mount the partitions of the HD each in separate folders in /mnt/
- plugin an external drive
- in each partition:
- # tar cvfp partitionname.tar . –exlude=partitionname.tar
- copy it to the external
- backup mbr and partition table
- # dd if=/dev/sda of=MBR-backup bs=512 count=1
now when you do this last step, remember that the mbr backup also backed up the partition table.
Restore a system
- boot on a live-usb-disk
- restore mbr and partition table
- # dd if=MBR-backup of=/dev/sda bs=512 count=1
- write the partition table
- # cfdisk
- format the partitions like this:
- / ext3
- /boot ext2
- /home ext3
- mkswap swap
- mount the / partition in /mnt/sys/
- # tar xvf root.tar -C /mnt/sys
- mount the /boot partition in /mnt/sys/boot
- # tar xvf boot.tar -C /mnt/sys/boot
- reinstall grub
- # umount /dev/sda1 /dev/sda2
- # reinstall grub to the harddrive
- # mount -t ext3 /dev/sda1 /mnt
- # mount -t proc proc /mnt/proc
- # mount -t sysfs sys /mnt/sys
- # mount -o bind /dev /mnt/dev
- # chroot /mnt /bin/bash
- # mount -t ext2 /dev/sda2 /boot
- # grub-install /dev/sda
- unmount everything and reboot
NOTE.1: i have duplicated effort by both restoring the mbr and then writing it with grub-install. this is not a mistake.
NOTE.2: how to format
ext2: mke2fs /dev/sdXX
ext3: mke2fs -j /dev/sdXX
swap: mkswap /dev/sdXX
fat16: mkdosfs -F 16 /dev/sdXX
fat32: mkdosfs -F 32 /dev/sdXX