Just a follow up to say that I managed to restore to the new HDD the partition created earlier with Disks.
I made some errors at first attempt, then got the right idea and went on to success.
For restoration I used
Disks,
GPartEd and
Boot Repair from the Mint live disc.
First I tried to restore the image directly to the unformatted HDD, thinking Disks would be intelligent enough to automatically calculate partition size from the image and create a partition table that would fit that partition exactly, leaving the rest of the space unallocated. I was wrong. Disks made the whole 1TB drive a single partition and - surprisingly to me - marked both used space, free space
and unallocated space inside that partition. I never knew such combination could exist!
Anyway, all attempts to shrink that unique partition in order to make room for other primary partitions on the drive have failed. So I went on to a different approach.
- Blanked out the unique 1TB partition to return the drive to previous unformatted state.
- Created first partition at the beginning of the disk, making sure it had at least the same size as the image (53GB); I chose 80GB. File system EXT4 same as the image. Set the 'boot' flag to make it bootable.
- Created two other partitions in the unallocated space.
- Restored the image to that first partition (using Disks).
- Used GPartEd to Check the first partition in order to enlarge it to its new, greater size.
At this point partition was restored, all files were intact. However, the restored
etc/fstab
was pointing to the old partitions that had different UUIDs.
So I launched Nemo, opened the
etc folder as root, opened
fstab in Text Editor and replaced the UUIDs and names of the old partitions with the new UUIDs and names. Careful with file systems if different than previously, because they each have different arguments!
Dunno if all that was necessary - it might've been easier to just comment out the pertaining lines and let the system readd them after boot. But since I needed to check the root UUID - which due to some unknown previous operation was correct - I thought I should fiddle with those too, see if it works. And then I rebooted.
But it wouldn't boot. Remembered
Boot Repair and launched it. Looked through the options and selected
GRUB reinstall and the destination partition (
sda1 for me). There are other options there, such as
Unhide boot menu, and others - use as desired. There is also an option to edit the grub configuration file if needed.
- Applied the selected options in Boot Repair and rebooted to HDD. Success!
The only thing that would have to be adjusted later, if needed, is the boot menu which got hidden because I disabled
Unhide boot menu, but since it does start directly with the desired option it doesn't bother me much.
So, all in all I think
it is possible to restore a single partition from image - even a boot one, as proven above - but it may not be a simple, straightforward operation and would require manual intervention. Still, in desperate situations a single tool that could perform the necessary steps in at least a semi-automatic way would be very helpful. Maybe you could integrate such functionality in Foxclone.
BTW, creating an image of the new 80GB partition took almost an hour in Disks - imagine how long it would've taken the whole 500GB...