Partimage is a program that allows one to backup/restore the partitions of a disk. It is similar to Norton Ghost, the only difference being that the size of the restored partition must be greater or equal than the size of the saved partition. The goal of saving a partition is either for safety, in the event a disk failure, or to replicate it on several other computers.
For backing up a Linux system (without /home), it is necessary only four or five CDs, in general. As a consequence, in less than 30 min, everything is saved and the system can be upgraded safely, since it can be restored if the result of the upgrade is not adequate.
In order to make a backup, the partition can not be mounted. Therefore, the easiest way is using a live distribution, such as SystemRescueCd. Another possibility is just to umount it, if it is not being used.
The size of the partitions is important if a backup is necessary. The greater the partition, the greater the backup. For a Linux system running on a workstation, we suggest four partitions:/boot (100 MB) - 18% Used with 3 kernels installed
System Rescue CD is a live distribution with several tools for repairing file systems. It can be used through a CD-Rom, a pen-drive, or a floppy. In the case of a pendrive, boot from a USB device must be on in the BIOS. Furthermore, in some mobos, it is necessary to access the BIOS with the pendrive plugged in, select the tab Boot -> Hard Disk Drives, and set the pendrive to be the 1st drive. In any case, the pendrive must be made bootable.
During the boot, SystemRescueCd detects the hardware and allows the choice of the keyboard type. If the computer is on a network, it will use DHCP to get an IP. In case of fail, just type net-setup eth0 from the command-line, and configure the network.For creating partitions, run_qtparted used to start QtParted, a clone of Partition Magic. Newer versions, however, are shipping gparted, instead. In this case, xinit has to be run before calling gparted, because it only works in graphical mode. It is possible then to delete, create, or format partitions. It is never too much to remind people to backup important data before any attempt to modify partitions. There is always the risk of messing the partition table, although, in general, this does not happen. Partimage can be used for backing up a partition, and its usage is straightforward. Just highlight the partition to be saved, choose a name for its backup, and optionally another machine on the network, running a partimage server, to receive the image. In the server, the file /etc/sysconfig/partimaged should contain options like this:
OPTIONS="--port=4025 --nologin --dest /your_image_dir/images"
The client must always be run as root, and it can optionally use a password for accessing the server. However, the client must have been compiled with "login" enabled, in this case. In fact, the client compilation options, and the server options, must match, e.g., ssl or login. Otherwise, a "version mismatch" error occurs. Should your client use "login", the users allowed to connect to the server must be listed in the file /etc/partimaged/partimagedusers, one per line. If, besides using login, pam support is also enabled, the authentication is done based on a db4 database created by the script /usr/share/partimaged/partimaged-passwd. The database entries are pairs of (user,password). Please, read man partimaged-passwd for getting all the options on how to add/delete users from the database.
For using the ssl capability, the certificates have to be created by running /usr/share/partimaged/create_certificates.sh. The file /etc/partimaged/partimage-certs.cnf can be customized, in order to change information, such as, Country, State and Location. The client supplied with SystemRescueCd is not compiled with ssl or login enabled. However, for security reasons, the partimage package was created with pam and login enabled. Please, note that, for disabling login in the server, it is enough to add the option --nologin to its configuration file, and restart the server. To check which compilation options have been chosen, just type partimaged -i.
Another point is that the client and server architectures must be the same. Therefore, if you use a CD with a 32 bit client, the server must be a 32 bit version too, even if it is running on a 64 bit platform.
The backup files should be named using mnemonics easy to remember, such as, boot-hostname-Fx or root-hostname-Fx. There is also an option to break the image in parts, so they fit on a CD. Generally, 690MB is a good choice, which will produce root-hostname-Fx.000, root-hostname-Fx.001, etc... If you do not want to save the image on another computer, then just mount another partition on the same computer to receive the image.
To restore a backup, just do the reverse, highlight the partition to be restored, and type the name of the first file of the backup: root-hostname-Fx.000.Remember that the size of the partition to be restored must be greater or equal than the size of the saved partition. If it is greater, then the corresponding file system should be enlarged to occupy all of the available space. For an ext3 file system, use: e2fsck -f /dev/sdan
After restoring a partition, if it is the / from another computer, it is necessary to edit some configuration files. Any Fedora installation CD or DVD is enough. Boot the computer using it and type linux rescue at the prompt line. Then, choose the language, the keyboard type, and do not activate the network. The first thing to do is to change:chroot /mnt/sysimage After that, it is possible to access any file as if it were mounted on an ordinary Fedora system. For instance, vi /etc/fstab. A word of caution: any file can be written this way with root privileges.
The list of files that might have to be changed correspond to those that would have to be edited in a normal installation. We suppose you know what changes to make in each file. The most important file is fstab, which informs how partitions should be mounted. In case the restored partition is going to be on a different place, the new one has to be known. Therefore, before restoring any partition, save the output of the command more /proc/partitions or df. If the root partition is going to be restored in say, /dev/sda2, it should be listed in /etc/fstab, otherwise it will not be mounted and the system may be unusable, until someone fix fstab. Trial and error can take a long time ... RedHat is using, by default, the UUID of the partition to identify it in fstab. As a consequence, the two lines below are equivalent:LABEL=/ / ext3 defaults 1 1