Monday, February 13, 2012

Mondo Rescue: Using the post-nuke script

Quoting from their site
"Mondo Rescue is a GPL disaster recovery solution"
and have been used in several installations we have performed for our customers. One of the useful option is to exclude some directories (for example /var/log) and this means that all files and sub-directories will not be saved into the archive. This is good as it will save a lot of space but not very good to your system trying to write into an non-existent folder (like /var/log/asterisk).
The way to work around this problem is to use the "post-nuke" phase, when the control is transferred to a post-nuke script. If you will try to find some information about this feature the result is very disappointing as it is mentioned briefly only in the mondoarchive man page
-P tarball
Post-nuke tarball. If you boot into Nuke Mode and everything is restored successfully then the post-nuke script will be sought and executed if found. This is useful for post-restore customization. It is assumed that the tarball (.tar.gz format) will contain not just the post-nuke script (or binary, or whatever it is) but also any files it requires.

The way to solve the dilemma is to create (just before running mondoarchive) an archive with the hierarchy for the needed directories (for example for all of the directories you have excluded with -E). The hierarchy is obtain with find command and should provide a safe way to save all your sub-directories (including the symbolic links). The archive is created using tar command, which will save their owner, group and mode bits.
You could find here here an archive with the post-nuke script (to be placed in /root for example) and an example for the backup script.
The work was based on the post-nuke sample script (located in /usr/share/mondo/post-nuke.sample) and the information found in the Mondo-Devel mailing list archive (mainly this post).

Update #1: location for the archive example have been changed