Create Recovery Partition in LInux / Ubuntu


I am distributing customised Linux Solutions to clients & want to create hidden Recovery Partition in Linux, similar to windows in branded Laptops. The Recovery Partiton will have full image back of installed Linux OS (Mostly Ubuntu) & in case of corruption of Linux OS, the user should be able to restore the Linux OS (Similar to Factory Restore option in windows Laptops ). The restore option should be user friendly and basic user non conversant with linux commands should be able to restore the OS.

Any suggestion on how to create recovery partition.


Ravi Modi.



Actually according to my view there is no system restore option in linux which is same like Factory restore in windows. But you can use live cd to bring back your linux corrupted machine.

And also by using some tools like timeshift you can restore you linux machine same like as windows for this you have to install timeshft and you have to create an snapshot which is useful for you in restoring your linux machine.

Many years ago I had an Assus EeePC notebook with Xandros Linux. It already had this feature that you are looking for, I could restore the original system from a Recovery Partition. So, I am sure that Linux has all the tools to do that, you need just a bit of imagination.

If you think about it, a simple tgz backup can do the job. Suppose that you have configured the GRUB menu so that it has an entry for Backup/Restore. This entry boots the system on the Recovery Partition, but this system is customized so that it runs only the backup-restore program and then exists. This backup-restore program gives you only two options: one for backup and one for restore.

When you do a backup, an archive of the main system is made and is saved on the recovery partition, for example like this:

rm -rf system-backup.tgz
mount /dev/sda1 /mnt/sda1
tar --create --preserve --absolute --gzip --file=system-backup.tgz /mnt/sda1/

When you do a restore, everything on the main system is erased and the system is restored from the archive, like this:

mount /dev/sda1 /mnt/sda1
rm -rf /mnt/sda1/*
tar --extract --preserve --absolute --gunzip system-backup.tgz

Then you can disable the backup option and leave only the restore for the users.
If you do it properly, I think that it will work.

Look also this:
It creates ISO files that can be used for restore. But it should be possible to store these ISO files in a recovery partition and to boot them from GRUB.

Let us know if it works, because other people may be interested about this (for example me).

1 Like