Using Clonezilla Restore

I have read the instructions on cloning an image from one drive to another, where the new drive must be bigger than the one cloned. It is my understanding that is when you are doing the transfer at the same time in CZ.

But is it possible to have a smaller drive (that is more than large enough to hold the restored image) and just use restore to place it one the new drive? Would I need to partition or format it prior to restoring?

I am redoing the internal drives in my main Linux Mint computer as saving the image to an ext HDD took way too long for 200 gb of data. I am not sure as I have not used the smartctl tool yet, but I recently encountered the Disk Not Good (Bad) error before making the image, so I had it check everthing and test that the image was restorable. But the SATA SDD is 6 years old and am not sure about its lifespan or how much I’ve written to it, but probably a lot. So rather than it fail later, I decided I had better get new disks now.

I have installed a 512 gb M.2 NvME (previously used in my Windows 11 laptop) and have ordered a new 1 tb M.2 NvME to install in the second slot. The current 1 TB SATA drive slot will be disabled upon inserting the M.2 disk in slot 2. Since that is the only initial drive I had, that won’t matter and the 512 M.2 will not disable any thing in use.

I would like to put my LM OS on that smaller drive and use the larger one for /home directory, games and backups/clones. This will free up my ext HDD for my home server I am currently building, plus give me the speed to do the snapshots & images internally.

Thanks for any input.

Sheila Flanagan

1 Like

If you restore from an image, yes it can be smaller as long as the data fits, and yes you need to partition and format it first.

If you clone, no, it has to be the same or larger.

If you only want to move stuff to another disk, you can use
rsync as long as both disks are on the computer simultaneously.

1 Like

So just format/partition it the same as the current drive LM is installed on: EFI, boot & swap?

Thanks,
Sheila

Never done it, but I would think for Clonezilla make it as similar to the original disk as you can.

So I tried using Clonezilla to restore the image to the new disk but after all selections got the error that the “destination disk is too small” “destination disk size 512.1 GB” “source disk size from the image: 1000.2 GB”

So either there is something in the selections I chose that are wrong (all of them were apparent to me), or as my research had found, you cannot do this. I saw some conversations as recent as 2022 that said whether restoring clone or image, target disk must be larger than source disk of image.

Thoughts?

Thanks,
Sheila

Hi Sheila, :wave:

have you already taken a look at the Q&A section provided by the clonezilla website :question:

There are two instances dealing with the topic of restoring to a smaller disk:

and

I don´t know whether it helps, though. :neutral_face:

Many greetings from Rosika :slightly_smiling_face:

3 Likes

Thanks @Rosika I will check it out.

Sheila

1 Like

Okay, I had enabled -k0, but I don’t recall “enable -icds” in expert mode (which is what I used).

Will try again. If that fails, will try the workaround.

Sheila

Hi Sheila, :wave:

Hmm, in the Q&A it says:

yes, it’s possible to make that with the options “-k1” and “-icds” enabled in the expert mode

Not sure about the “-k1” “-k0” difference though… :thinking:.

2 Likes

I read at the bottom:
The only difference is, just remember to choose expert mode, and enable “-icds” (Remember to choose “-k0”, i.e., use the partition table from source).

Which I think is the use partition table from source. I chose that as it seemed illogical to create a new one.

But if you read:
For image to disk, follow this

It shows -k0 using the partition table from the image rather than -k1 which is to create partition table proportionately.

This is, of course, method 2, under Image to Disk.

We will see if it works. If not, I will try method 1.

Thanks,
Sheila

3 Likes

Hi again, :wave:

I just remembered having discussed this very problem with ChatGPT last December.
For some general information, here´s the main part of the the discussion:

me:

Once a month I make a disk-backup with the help of clonezilla live. On Linux Lite I have 3 partitions: 1. root: size 25 GB, used 18.7 GB 2. home: size 38 GB, used 30.4 GB 3. data partition: size 420 GB, used 265 GB.

Linux Lite is running from a HDD, which is 1 TB in size. Now: what if I´d want to restore the operating system to another drive, which is just 500 GB in size. Can clonezilla do that at all?
On its homepage it says: “The destination partition must be equal or larger than the source one.”, which seems to suggest it can be done. The data used on all three partitons is about 314 GB altogether. The rest of the HDD is empty.

ChatGPT:

Clonezilla generally requires the destination partition to be equal to or larger than the source partition because it needs enough space to accommodate all the data from the source.
However, in your case, since the used space on your current partitions is around 314 GB, which is less than the size of your target drive (500 GB), it is possible to restore your system to a smaller drive.

Here are a few steps to consider:

  • Resize Partitions on the Source Drive (Optional):

Before creating the Clonezilla backup, you can resize your partitions on the source drive to ensure that the used space is well within the limits of your target drive. You can use tools like GParted for this purpose. Make sure to leave some unallocated space at the end of the drive.

  • Create Clonezilla Backup:

Use Clonezilla to create a backup of your Linux Lite system as you usually do.

  • Restore to Smaller Drive:

When restoring, Clonezilla will try to fit the data into the target drive. Since the used space is smaller than the target drive, it should work. During the restore process, Clonezilla will prompt you to resize the file system to fit the new partition size.
Just make sure to follow the on-screen instructions.

  • Adjust Partition Sizes (if necessary):

After the restore is complete, you might need to adjust the partition sizes manually on the target drive if Clonezilla doesn’t automatically resize them. You can use tools like GParted for this task.

Keep in mind that while this process is generally feasible, there’s always a risk when working with disk partitions and data. Make sure you have a backup of your important data before performing any disk operations.

Additionally, the success of this process may depend on the specific configurations of your system, so it’s a good idea to test the procedure in a controlled environment or have a backup plan in case anything goes wrong.

me:

I see. Clonezilla itself says: “This is always a challenge to Clonezilla because it’s a block-based tool, not file-based one. If you are sure the used data blocks on the source disk are within the disk boundary of destination one, yes, it’s possible to make that with the options “-k1” and “-icds” enabled in the expert mode.”

ChatGPT:

Yes, that’s correct. The challenge with Clonezilla being a block-based tool is that it copies data at the block level rather than understanding the file system at a higher level. This is why it usually requires the destination partition to be equal to or larger than the source one.

The options “-k1” and “-icds” mentioned in the expert mode are related to handling this specific scenario. Here’s a brief explanation:

  • -k1 (repartition):

This option tells Clonezilla to allow the destination partition to be smaller than the source partition, and Clonezilla will try to resize the file system during the restore.

  • -icds (Ignore cylinder size in the destination disk):

This option is used to ignore the geometry/cylinder size of the destination disk, which is useful when the destination disk is smaller.

So, if you’re confident that the used data blocks on the source disk can fit within the disk boundary of the destination one, and you’re willing to use the expert mode with these options, you can proceed with the restore process.
Always be cautious when dealing with disk operations and have a backup of your important data to be on the safe side.

me:

I see. But the problem is:
how can I know that the used data blocks on the source disk can fit within the disk boundary of the destination one? Is there a way of measuring the amount or size of data blocks on the source disk?

ChatGPT:

Determining whether the used data blocks on the source disk can fit within the disk boundary of the destination one involves assessing the used space on each partition.

You’ve already provided information about the sizes and used spaces of your partitions, so we can use that to estimate whether the data can fit.

Here’s a quick calculation based on the information you provided:

Root partition: Used 18.7 GB
Home partition: Used 30.4 GB
Data partition: Used 265 GB

Total used space: 18.7 GB + 30.4 GB + 265 GB = 314.1 GB

Since the total used space is 314.1 GB, and your target drive is 500 GB, it seems like you have enough space to fit the data.

However, it’s important to note that this is a rough estimation. The success of the operation can also depend on the specifics of your file system, the actual allocation of data on the disk, and the efficiency of the resizing algorithms used by Clonezilla.

Before proceeding, it’s advisable to:

  • Backup Important Data: Ensure you have a backup of any critical data, just in case something goes wrong during the process.

  • Test the Procedure: If possible, try the procedure in a controlled environment or on a test system to verify that it works as expected.

Remember, whenever you’re dealing with disk operations and resizing, there’s always a risk involved, so caution and preparation are key.

Not much new to be learned by it, I guess. I just wanted to provide the info anyway. :wink:

Cheers from Rosika :slightly_smiling_face:

1 Like

Well, I did find the icds option which I had not used last attempt. And by default it chose -k0, but I changed it to -k1.

It went farther this time, but ultimately failed. Here is the image of what I encountered:

I had done as @nevj suggested and repartitioned to target drive to have exactly what the source drive has (and what was in the image) so not sure if that had anything to do with the failure. But I did see an option before starting that might have applied, though it was not mentioned in the Clonezilla help instructions. It is the final option in the image below and relates to the NvME target disk via partclone, but I did not think that would apply since we are not restoring “parts” although if Method 2 fails, we might try that.

I have previously read the discussion here on ItsFOSS where you and @nevj found you could use an image and restore parts. Not sure of the steps, but maybe we could restore the boot/efi partition to same partition I created on target disk and same with the / and swap.

I will attempt again, this time choosing -k0 and see if that succeeds.

Thanks,
Sheila

3 Likes

Following the instructions for method 2 exactly, this time I did choose to check that the image was restorable. Previously, I had not, as I already checked it after the image was created as part of that process.

So that took a while. But although the checking passed–the restore still failed. See images below:

The “failed to create a partition table on this disk” makes me think the -k0 and -k1 do not work in this situation. And it looks like the EFI partition worked as the #2 partition is where the issue was, and that is the main partition.

I will try again by first using gparted and wiping the disk and not making the identical partition and see if CZ can do it. But unless I am misunderstanding, it is the main partition size of the image that is conflicting with the main partition size of the target drive that is causing all the trouble.

Thanks,
Sheila

2 Likes

When I went into Gparted, all my partitions were gone and only one unallocated one remained with no partition table. So I created gpt and a single ext4 partition.

I ran it again and saw it create the partition table and this time, the error was it could not find partition 1. Sheesh. So I will go back and create just the first EFI partition and see if that works.

Sheila

1 Like

So after creating the EFI partition and / partition in gparted, I ran CZ but this time, despite any directions to do so, I chose the last option for "Enable the IO mode of partclone for NvME SSD.

This then gave me (for the first time) the option of selecting both partitions to restore to and began restoring image as seen below:

As it is still processing, it remains to be seen if this will be successful. I will update once it completes.

Sheila

1 Like

I wonder what is so special about NvME?
Does it need different drivers?

1 Like

I have no idea. I saw it before and wondered, but the part about IO mode did not make sense, so I had left it unchecked. But it is the only item in the long list that pertains to NvME, so I figured it couldn’t hurt.

By this point I should be able to do this in my sleep…lol. I think this is the 5th time today. At this point, seeing will be believing.

Sheila

So here is the final result without errors, but some messages (in yellow). The only one I am not sure about is:
“Failed to create initrd in the restored OS due to different system architecture”
Meaning different disk architecture? i686 vs x86-64…

Unless something in those yellow messages indicate it did not restore, I guess it did. However, next I have to be able to boot it; I gather I need to edit fstab on the new disk but update-grub on the old?

Thanks,
Sheila

UPDATE: It did not restore. The only thing on the disk is lost & found. So I will need to do further research before attempting again.

Thanks,
Sheila

1 Like

I would setup all the disk partitions, then try and restore just the root filesystem ext4 partition. (ie restoreparts)
If you can get that, you can remake the others