The steps for the full dump & restore of a linux box are in following:
Tools and Environment:
- I have completed the tasks via Ubuntu Box but I think that it is valid for any box that has the capability of dump package.
- <dump> Package Installed. ( For Ubuntu Clones: apt install dump)
- Linux Live CD
Steps:
Create the Dumps of the Box:
# dump -0 -a -f - /boot | ssh -l <username> 192.168.56.1 dd of=/<Path to save the file>/backupbootfile
# dump -0 -a -f - / | ssh -l <username> 192.168.56.1 dd of=/<Path to save the file>/backuprootfile
As it can be seen, I am transfering the dumps to remote machine via ssh. “-0” is the representation of the full backup as parameter. Also, another point to notice is the filesystems. You can dump each filesystem seperately.
2- Boot the target System via Live CD
After boot system via livecd, install the “dump” package to the live system.
3- Restore the files & Required Changes
First you need to prepare the target dsk or storage area. I am assuming you have partitioned the disk and created a filesystem on top the partition. Sample Disk : /dev/sda and The partition: /dev/sda1
After this, mount the disk to a directory.
# mount /dev/sda1 /mnt # cd /mnt # restore -r -f <The file to restore:it needs to be present either as remote share or you need to copy the file local: like backuprootfile> # restore -r -f <The file to restore:it needs to be present either as remote share or you need to copy the file local: like backupbootfile> Now to install Grub to Disk # mount --bind /dev /mnt/dev && # mount --bind /dev/pts /mnt/dev/pts && # mount --bind /proc /mnt/proc && # mount --bind /sys /mnt/sys # chroot /mnt # grub-install /dev/sda # grub-install --recheck /dev/sda # update-grub # exit # Here leaving the chroot # umount /mnt/sys # umount /mnt/proc # umount /mnt/dev/pts # umount /mnt/dev # umount /mnt Now change the fstab. I have restored both root & boot filesystem to same filesystem. So if you had a systems with multiple filesystems before, now, you need to change the fstab accordingly. /dev/sda1 / ext4 defaults,errors=remount-ro 0 1
You can reboot your system.