Force cloned hard-disk image upon a smaller hard-disk
Solution 1:
Clonezilla relies on Partclone to save and restore filesystems. Although it's useful, even if you use the -icds
option, that alone isn't enough. When restoring the original filesystem on the smaller disk, Partclone will encounter a seek error trying to write beyond the disk boundary. So this is a limitation of not only Clonezilla, but the underlying tools it uses.
What you can do however, is to restore the image temporarily on a 160GB disk, use a filesystem resize tool such as ntfsresize
(for NTFS) or resize2fs
(for ext3/4) to shrink the filesystem, say to 25GB. Resizing the partition table, which GParted does, isn't necessary. Use Clonezilla again to create a new image using the "savedisk" option.
When restoring the image on the smaller disk, use the -icds
option to skip Clonezilla checking if the disk is the same or larger than the original disk. Since you shrunk the filesystem, Partclone won't encounter a seek error and your data will be restored on your smaller disk.
If you used the option to restore the partition table proportionally (-k1
), Clonezilla will create a proper partition table and resize (expand) the original filesystem so that all the free space on the new disk becomes available.
EDIT: The The bug has been fixed.-icds
option isn't passed to ocs-expand-mbr-pt
, so this step currently fails. A bug report has been filed about this with the project.
Solution 2:
Restore the image to a 160GB or larger harddrive ... could be virtual.
Boot that machine with PartedMagic Live CD.
Resize down the partition with parted.
Put drive in as a secondary drive in windows or Linux,
and resize using parted, gparted, or windows disk manager.
Solution 3:
I solved it with a Windows 10 image as follows
- Temporarly move some files if your source drive is nearly full.
- A drefragmented drive leaves more space for shrinking, so defrag
c:\
through right clicking on the drive -> tools - shrink
c:\
through windows disk management as small as possible - start Clonezilla, expert, device-device, local, select
-icds
and finally the-k1
option - switch off and disconnect old drive
- restart with the new drive and hold shift on windows login, select restart -> troubleshooting -> startup repair
In the past the 4th step failed, but since 2015 clonezilla supports GPT with the -k1
option so I think this is the reason why this works, now:
http://clonezilla.org/downloads/stable/changelog.php
Clonezilla live 2.4.2-38 ... Proportition GPT partition layout could be created by the option
-k1
.
The 6th step is needed because Windows does not recognize the boot drive in the optimization tool (SSD trim) and will try to repair the drive randomly so something seems to be wrong in the boot sector/partition table but startup repair will fix it.
EDIT: I uploaded a video of the the complete process (German):
https://www.youtube.com/watch?v=GJ2LVY5ja-o