Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 05-10-2012, 04:08 AM   #1
LQ Newbie
Registered: Oct 2007
Posts: 6

Rep: Reputation: 0
Hack Clonezilla image to work around "destination disk is too small"

Ok, so you resized your partitions on your old hard drive to fit a new hard drive, made a disk image with Clonezilla to an external disk and tried to restore it on the new disk but only to get a "destination disk is too small" message. A search on the internet suggests to backup individual partitions rather than the full disk (I guess that this means that you would have to clone the MBR manually), but anyway the new disk is already in the machine, you dont want to take it apart again, and making a new backup would take another hour. Here is what I did:

* start a Linux Live CD
* edit image file "sda-chs.sf" with new cylinders/heads/sectors from "fdisk -l"
* edit image file "sda-pt.parted" to match first few lines from "parted /dev/sda 'unit s' print" (drive-specific information from the new drive + partition-specific information from the old drive, including the partition type)
* sync / restart and restore image with Clonezilla

Warning: Be sure that no partition extends beyond the end of the disk as defined in the above 2 files. If in doubt, try applying the partitioning of sda-pt.parted manually with "parted".

Happy cloning,

Last edited by jowagner; 05-10-2012 at 01:02 PM. Reason: superficial grammatical error
Old 05-11-2012, 12:59 AM   #2
LQ Guru
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297

Thanks for sharing your solution. Off the Zero Reply List.

Kind regards,

Old 06-27-2012, 03:48 AM   #3
LQ Newbie
Registered: Jun 2012
Posts: 1

Rep: Reputation: Disabled
Talking -icds

Or you could just enable "-icds" in expert mode and it will get around it.....
Old 05-14-2013, 07:35 AM   #4
Registered: Aug 2008
Location: France
Posts: 658

Rep: Reputation: 35
I have the same issue: The size of the target partition changed since I saved the Ubuntu system in which it was installed.

So I read the image's sda-pt.parted (start/end sectors), resized the partition with fdisk, and told CZ to restore the image in Expert Mode so I could use the -idcs option, but no luck: When it tries to restore GRUB, it displays a warning:
Warning! Found grub partition (/dev/sda1) file system is ext4! Not all version of grub 1 supports file system ext4!
... and when rebooting, I'm stuck at the "grub>" prompt.

Next, I ran mkfs.ext4 /dev/sda1, even used fdisk to mark the partition as bootable, then used CZ to restore the partition, but I'm still stuck in the "grub>" prompt at the next reboot.

Since the target partition now has the same size it had when I saved the image, why is CZ still unhappy?

Thank you.
Old 08-25-2013, 08:38 AM   #5
LQ Newbie
Registered: Dec 2010
Distribution: Arch
Posts: 9

Rep: Reputation: 1
My full review on the topic

Originally Posted by bunnsnow View Post
Or you could just enable "-icds" in expert mode and it will get around it.....
I tried this with latest stable CZ.
This paragraph will be little bit off-topic (sorry), but contains backround informationm, which may be helpful for others. I had a 200 GB with Win7 in it. Win7 started to reporting that the disk is bad ("HD Tune" app. confirmed that, plus there were bad sectors). So I saved stuff from the disk + uninstalled what I didn't need. Later on I removed hiberfile (I found some windows command line for that, plus disabled the virtual memory). I did defragmenting with MyDefrag, from another computer. I planned to shrink the partition to 50 GB. I wanted to install it on a smaller, but working 120 GB HDD. Then, because of still problem with the unmovable files scattered fragmented accross the partition(MyD tries to help here (, but it's too difficult), I used "mini tools partition wizard home edition" to reduce the partition size (based on a comment at So finally I could shrink the partition and verified that it still boots up.
With CZ I needed to use some rescue option to be able to cope with the bad sectors when saving the disk.

So the disk contained some 100 MB partition (somehow created by Win7) plus the 50 GB system partition. At restoring I had the not so pleasant surprise that CZ refused to restore this 50 GB long stuff to a 120 GB HDD just because it was taken from a 200 GB HDD (how miserable). So *I tried the -icds option* (went up with shift + page up and copied the command advertised by CZ with the mouse, added the -icds and ran it in another terminal (Alt + F2) with sudo). About 1 hour later it spat out some red text ("Failed to restore partition image file ..."), but I didn't hit Enter yet (after that I realized that it started to fix the situation, I expected that it wouldn't, so it was very misleading!

Again, without pressing Enter, I went to another terminal (Alt + F3). In the /var/log/partclone.log file (Partclone 0.2.66) there was not much information (11 lines alltogether), the only the last line having some vague information about the error: "target seek ERROR:Invalid argument".

So I tried jowagner's approach, which I describe now in more detail, maybe it will be helpful. Again, at this point I didn't expect (due to red error message) that -icds could work, that's why I tried jowagner's approach. Also, I set up some flag which resulted the partition to be resized to 30.6 GB. I could have increaded the partition size (mini tool partition wizard), but from MyDefrag's analyze screen I remembered that there were unmovabe files scattered in the partition still (lots of red dots or short lines).

Still in CZ, in another terminal (no need to boot another distro) went to the saved stuff:

cd /home/partimag/2013-<...>

Backup original files (do not skip this step!):
cp -p sda-chs.sf sda-chs.sf.orig
cp -p sda-pt.parted sda-pt.parted.orig

'cat sda-chs.sf' shows (this is about the source disk):

'sudo fdisk -l /dev/sda' shows
"255 heads, 63 sectors/tracks, 14946 cylinders", so I modified sda-chs.sf accordingly (you can use vi or nano).

Now to sda-pt.parted. To get the disk information from parted in the same format (size in sectors, not in GBs).

sudo parted /dev/sda
Now in (parted) prompt execute the following commands:
unit s

Select the first 4 lines describing the HDD with your mouse.
For some reason I couldn't paste this information to vi, so I used nano:
nano sda-pt.parted

Delete the first 4 lines and paste (right click) the new information to the beginning of the file. Ctrl + o to write the file. Ctrl + x to exit nano.

Now cd to some other directory (not inside /home/partimag), as CZ will need to unmount that (see below). E.g. 'cd /'. You can also unmount that with 'sudo unmount /home/partimag'.

At this point I realized that the session with the -icds option was not complete (by not being able to unmount the /home/partimag). Also, it resized my partition, which I didn't trust (although Win7 booted up (and did some initial chkdsk on both partition)).

So I booted CZ again and did restore again now with the hacked HDD description text files. This time I unchecked -r ("Try to resize filesystem to fit partition size"), although now with the hacked disk info maybe it wouldn't have caused problems.
This time I got what I really wanted. Win7 booted up fine and didn't do chkdsk at the startup.
Old 08-30-2014, 06:50 AM   #6
LQ Newbie
Registered: Feb 2011
Posts: 1

Rep: Reputation: 0
Solved fsarchiver

I've been with the same challenge "clone HD to disk less" but to hinder my filesystem is xfs which allows not be reduced at the source.

And with tools that focus block as "clonezilla, dd and partimage or other" really is more complicated and unfeasible.

But I managed to fsarchiver, which backs up partitions in terms of preserving file permissions of all files and still brings the same UUID of the partition.

Made as follows:

1. Boot for a Live CD, can be in Rip Linux or System Rescue CD

2. I created partition table on the destination disk (sda1 /boot, sda2 swap and sda3 /)

3. Backup the file system other device
# fsarchiver -v savefs /media/folder-bkp/disco-source.fsa /dev/sda1 /dev/sda3

4. Restore the first filesystem from an archive (first = number 0)%uFEFF on the target device
# fsarchiver -v restfs /media/folder-bkp/disco-source.fsa id=0,dest=/dev/sdb1%uFEFF4. B]

Restore the second filesystem from an archive (second = number 1)%uFEFF on the target device
# fsarchiver -v restfs /media/folder-bkp/disco-source.fsa id=1,dest=/dev/sdb3

5. Boot checked on the destination disk, if you have problem just with grub or lilo recover%uFEFF



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] A "DropBox" / "Clonezilla" back up question... Robert.Thompson Slackware 2 03-18-2011 08:13 PM
Detect viruses inside the .vmdk(VMware "Virtual MAchine Disk Format") image? m4rtin Linux - Security 1 02-06-2011 04:42 AM
clonezilla clone disk to image, when restore from image to destination hdd problem. hocheetiong Linux - Newbie 3 05-06-2008 07:59 PM
Any way to get "Alice"; "Call of Duty" series and "Descent 3" to work? JBailey742 Linux - Games 13 06-23-2006 01:34 PM
What does "loop-mount the disk image" mean ? karans Linux - Distributions 1 10-29-2003 08:21 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:35 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration