Clonezilla live allows restoring partitions using restoreparts onto a blank drive, but only when ocs-sr is invoked from the command line. The UI does not allow this, because it looks for the partition list on the target drive, rather than in the source image, as would be logical in this case. Not finding any partitions, the UI exists with an error. Since images made with saveparts can only be restored by restoreparts (at least in the UI), this renders such images unusable, unless one uses the command line or extra steps as described below.
Versions affected: all tested, including the current stable and testing releases:
Steps to reproduce the problem:
Assume that we have an external hard drive that contains an image made by saveparts, located in the root directory. Let's assume also that the image contains three partitions sda1, sda2 and sda3. We are attempting to restore this image onto a blank hard drive that does not contain any partitions. It is not relevant whether the partition table is missing or empty. The rationale of this scenario is that the image might contain system partitions, while other partitions (data) were backed up by other means. We want to recreate the partition table on the blank drive, restore the system partitions, and leave data partitions empty, to be restored later by other means.
1. Connect the external hard drive (source of the image) and the blank hard drive (target). The machine does not have any other drives.
2. Boot Clonezilla live CD, select English US keyboard.
3. Select "Start Clonezilla"
4. Select "device-image"
5. Select "local_dev"
6. Select the external drive containing the image
7. Select root directory
8. Select "Expert" mode
9. Select "restoreparts"
An error appears in red color:
Error! No existing partition(s) or no unmounted partition(s) are found! To use Clonezilla to save or clone a partition, the source partition must exist or be unmounted! If you are sure the partition exists in this machine, maybe the kernel is too old?
10. Press Enter until presented with the choice of poweroff / reboot / enter command line prompt / start over.
11. Select "Enter command line prompt"
12. Issue the command: cd /home/partimag
13. Issue the command: sudo /opt/drbl/sbin/ocs-sr -g auto -e1 auto -e2 -c -r -j2 -p true restoreparts image-file sda1 sda2 sda3
After this, the partition table and the partition contents is restored correctly.
(Note: The options given to ocs-sr are the defaults that would be generated by the UI, if it handled this scenario correctly, with the exception that the non-default option "Use the partition table from the image" is chosen. This command line was copied from UI's output when a workaround was applied as described below.)
After step 9 the program asks for the target drive and then presents the list of partitions obtained from the image, and then proceeds with the restore in the same way as after step 13.
If the user does not wish to use the command line, perhaps because he/she is not able to guess its correct syntax, it is still possible to restore the image using Clonezilla's UI, with a simple trick. The problem is that UI tries to obtain the list of partitions from the target, rather than from the source. We can then provide that list by creating dummy partitions on the target drive. The size of these partitions is not important, and neither is their contents. They can be left unformatted, or formatted to any filesystem (except swap). It is necessary to create as many partitions as many we want to restore complete with contents. For example, if the image contains partitions sda1, sda2, sda3 and sda4, but we only want to restore sda1-3, then we need to create 3 partitions. The fourth one will also be recreated by Clonezilla, but will be left empty. Note that the purpose of creating these dummy partitions is only to populate the list in the UI, the contents of the disk will be completely overwritten during the restore operation.
In addition I would like to point out that the wording of the error message displayed after step 9 is confusing. It appears to refer to the save operation, while it is displayed during a restore.
Log in to post a comment.