My OpenSUSE setup has become quite complex and so I would like to back it up in order to shorten the time it takes to restore from backup and get the system running. I already have an excellent way to back my data (documents, photos, downloads, etc), so this need not be a solution for those.
What I want to be able to restore is:
Operating system (Using 11.2 64bits)
System settings (Things like the /etc/hosts file, services, apache2 setup)
Applications (Most installed through Yast, some from RPM and scripts from tar/gz files)
Application settings (things in /home/<username/.* for example)
Virtual machine for Parallels
What I care about is restoring my exact configuration efficiently. I do not mind not having every binary to do it stored. So I’m thinking something like this:
Installation of the OS from the DVD media.
Have a list of all packages on my system and a way to install/download all the needed ones and remove the unneeded ones.
Apply system configuration, basically all changed files from the point there were installed (except for logs)
Apply application configuration.
I expect to need different software to do this, so if you know even how to implement one of the above, please let me know.
Very easy method if you have enough spare disk space, on an external disk for example, and your system is partitioned well so the system is seperate from your data.
Simply using rsync -Sax, can update a copy of / filesystem. Repeat if you have /boot, /var or /usr seperate.
Then should you need to replace internal hard disk, you can simply copy it back, then you can run CD/DVD (Live or installer) and YaST Bootloader module to reinstall GRUB, should you require baremetal recovery.
A 8 or 16 GiB flash drive is an inexpensive and convenient backup solution for the whole system partition.
All the solutions proposed are quite good. I particularly like the simplicity of using rsync since I use a combination of removable drives and DVDs for my data backups anyways.
Now, I’d like to plunge a bit further into system backups. All the answers given cover the case of a hard-drive failing or corrupting, because the system restored should work 100% as the old one once the hard-drive is replaced, even if the exact size is not the same.
Another scenario I’d like to look at is the case where I must restore my backups on a different system. Say the system gets stolen or burns, or gets otherwise destroyed… It won’t be possible to get the same hardware if it is more than 2 or so years old, so I have to be able to get up and running as fast as possible on a possible different system.
Now, as I said before, I know how to get my data back efficiently, it is the “system” I’m consdered, although in such scenario it will most likely different. What still needs to be restored is all the packages (system or apps) and their configuration (generated via config options or edited manually).
How would one do this kind of thing?
Is there a way to export the list of packages from the system and list of modified configuration files? And a way to take a new fresh OpenSUSE install and give it this list and the modified files (as diffs most likely) to produce a system as close as possible to the original one? It should work with any config I’ve edited like the hosts file, apache config and service started status, etc.
You can always make an image of a partition, and restore that to a like-sized partition on another drive. dd and gzip are the relevant commands. Factors to consider: the partition image files take up space; and the imaged partition should be unmounted. But, disk space is too cheap these days to worry about, and you should have a bootable cdrom around anyway.
I use Puppy Linux, and keep a few / and /home partition image files around.
Then you do it in same way, but now you need to boot from DVD/CD-ROM and re-make the initrd for the kernel.
The reason is if you may well need different drivers to read the disk, with a different chipset, so different modules in the initrd are required to mount / successfully.
I have done this by chroot-ing into the on-disk installation (with Live CD for different distro), but you really need to understand things in depth, Gentoo install docs (installing from another distro) helped me do this successfully.
The solution for most users, is to do an install on new machine into a new partition, and then copy over the relevant kernel files.