View previous topic :: View next topic |
Author |
Message |
xibalban n00b

Joined: 27 Jan 2015 Posts: 3
|
Posted: Thu Jan 29, 2015 9:47 am Post subject: Bootable system-backup |
|
|
Fellas,
So, I have finally finished customising my gentoo and it is a perfect distro for my requirements. Phew!! I did take more than a week's time to reach where I am today, and it was a great learning experience.
Now, that I have a working system - what if one fine day (ironically), my hard drive dies?
Well, is it possible to build my own bootable disk which will restore my system to exactly how it is now, after a hard drive replacement?
How?
Cheers!! |
|
Back to top |
|
 |
thomai n00b

Joined: 05 Jan 2015 Posts: 10
|
Posted: Thu Jan 29, 2015 11:53 am Post subject: |
|
|
I wrote a script which basically justs tar's root to an archive at an external hard drive.
Code: |
$BACKUP=/path/to/stage4.tar.gz
tar -czpf $BACKUP \
--directory=/ --exclude ./proc/* \
--exclude ./sys/* --exclude /dev/pts/* \
--exclude ./media/* --exclude ./mnt/* \
--exclude ./home/* --exclude ./data/* \
--exclude ./proc/* --exclude ./run/* \
--exclude ./var/sys/* \
--exclude ./temp/* --exclude ./usr/portage/* .
|
To verify the backup, I connect the drive to a virtualbox host, boot from the gentoo minimal installation cd and execute a script (also on the HD) which does basically just:
- partition hard drive (fdisk can do this from shell)
- create fs
- mount the fs
- extract the stage4 tarball
- chroot into the new fs
- mount /dev and /proc
- grub2-mkconfig -o /boot/grub/grub.cfg
- grub2-install /dev/sda
Reboot and see if everything worked.
After that you just have to emerge --sync and you have a running system.
If you want I can post the full two scripts. |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|