Clonezilla - extend partition


Missatge d'estat

You are not a member of this team. If you want to be part of this team, click on 'Subscribe to this team'.

Hi all,

I am trying to restore one of the default images with the -k1 and the -r option which should lead to the partition being expanded and the filesystem to be resized.

I have tried that on a way bigger disk (320GB) but the / partition is created with 24GB only.

How have you managed to extend the partition/filesystem?



imatge de Rhein-Ruhr-Hub
Enviat per Rhein-Ruhr-Hub el dt., 09/22/2015 - 21:05

Use the GPARTED tool to expand the partition / filesystem, as described in the wiki and video tutorials. It is recommended to use the Parted Magic iso (as linked in the wiki) as this collection comes with a lot of helpful tools (e.g. GSMART, GPARTED, Clonezilla etc).
German video tutorials:


If you use the shell (terminal) I am not sure, if I am able to answer your other questions in your mail, as I have only experience using Parted Magic and the graphical user interface, not terminal.

Using Clonezilla myself (by GUI) it tells me these options were set:
/opt/drbl/sbin/ocs-sr -g auto -e1 auto -e2 -c -r -icds -j2 -p true restoredisk PAE64_14_04_LTS sda
Does that help you?

imatge de MarcusMoeller
Enviat per MarcusMoeller el dc., 09/23/2015 - 05:18

Yes, but I do not want to manually resize the partition afterwards because I am working on a fully automated installation via PXE. Your ocs-sr option also shows that you try to resize the filesystem but not the partition (which would be the -k1 option).

imatge de Rhein-Ruhr-Hub
Enviat per Rhein-Ruhr-Hub el dc., 09/23/2015 - 06:12

ok, you have to find out by yourself, as I am not so deep into Linux details. Maybe another Labdooer can help, "ich bin raus". I can only contribute what was already published in wikis and tutorials. 3 ways of installation are tested and documented 1. manual, 2. by scripts, 3. by cloning. If you want to add a 4. way via PXE work it out, test and document it. Either you can add it yourself to the wikis or send a German and English text to be published to Labdoo-DACH (at), thanks.

Please keep in mind the nearly all Labdooer have no deep Linux knowledge, so if you offer a complete and more easy way, go ahead.

imatge de MarcusMoeller
Enviat per MarcusMoeller el dc., 09/23/2015 - 06:22

Ok, I can work around by using parted in ocs_prerun. During my observation I have noticed that the partition layout of the default image is a bit strange: /dev/sda1 = / & /dev/sda3 = swap. Is there a reason for not using /dev/sda2 as swap? Or even better, use the fixed partition at the beginning (e.g. /dev/sda1 = swap) and the dynamically growing one afterwards (/dev/sda2 = root). Are there any other images available than the one on e.g. German specific ones?

imatge de Rhein-Ruhr-Hub
Enviat per Rhein-Ruhr-Hub el dc., 09/23/2015 - 06:35

When producing a new image this is done by an Lubuntu installation plus running scripts and manual settings. But sda2 (swap) is kept in a kind of "container" and not easy to move and adapt to each laptop by GPARTED at the end of cloning. As the images should be easier to handle sda2 (swap) is taken and placed outside of the container and the container object was removed (sorry, I am a Linux layman, hope I can explain it good enough). That is why partition is named sda3.

There are only those images available. Some hubs produce specific images for an edoovillage, if a large number of computers will be shipped to minimize installation. Or the produce VMs. As it causes much work and time to update and upload the images there are only 2 official images (Lubuntu based PAE32 serving PAE and nonPAE architecture and PAE64), Mint-based image was just a test.

imatge de MarcusMoeller
Enviat per MarcusMoeller el dc., 09/23/2015 - 06:38

I am not sure what you mean with container. I have created a minimal image using clonezilla with a partition layout like /dev/sda1 = /boot; /dev/sda2 = swap; /dev/sda3 = root without any problems. /boot is not necessarily needed. Could we please give it a try and create an image where swap is /dev/sda1 and / consumes the rest? You could also point me to the resources on how to build it on my own.

imatge de MarcusMoeller
Enviat per MarcusMoeller el dc., 09/23/2015 - 08:29

I have been able to set up a basic installation of lubuntu with /dev/sda1 -> swap; /dev/sda2 -> root and could restore it with extending the partition using parted.

In the meanwhile I have found : so I am going to check if I can also automate the creation of the master using preseed and puppet.

imatge de Rhein-Ruhr-Hub
Enviat per Rhein-Ruhr-Hub el dc., 09/23/2015 - 08:42

Please read and the chapters, here it is explained and linked.

I still do not understand why you do not use cloning the prepared images? Your PXE-way plus running the scripts will last estimated 3 - 6 hours! And cloning images 20 minutes. I cannot see any advantage using PXE and scripts.

imatge de MarcusMoeller
Enviat per MarcusMoeller el dc., 09/23/2015 - 08:53

I am using PXE to run Clonezilla. This way I take advantages of fully automation and speed of Clones. I am just using preseed/puppet to prepare the master image, as I think it's way more comfortable than manuall running a bunch of scripts.

imatge de MarcusMoeller
Enviat per MarcusMoeller el dc., 09/23/2015 - 08:55

On the next build of the official images, I would kindly like to ask you to partition as described earlier : /dev/sda1 -> 512 MB swap; /dev/sda2 / for the rest of the disk. This will allow us to make use of those images for our fully automated setup as well.

imatge de Rhein-Ruhr-Hub
Enviat per Rhein-Ruhr-Hub el dc., 09/23/2015 - 11:04

There is a reason, why the partitions are set-up as they are. For other users it is easier to move swap at the end of the disc and to enlarge sda1 partition up to the end. And the image are always "shrunk" to the minimum size, so they fit to smaller discs. So adjusting swap space and software / data partition for each laptop is needed and that should be kept as simple as possible.

"as it is" sequence
1. move sda3 (swap) to the end of the disc and enlarge swap if needed at the same time
2. enlarge sda1 (data), done

Bringing the partitions in the sequence you ask make it more complicated for these users, following your request:
1. move sda2 (data partition) in case swap has to be enlarged
2. enlarge sda1 (swap) if needed
3. re-move sda2 (sda2) next to sda1 (swap)
4. enlarge sda2 (data) to the end of the disc

If I misunderstood and it is not so complicated let me know. But in case it is that way, I am sorry to say that I cannot fulfil your request. But you are free to use the existing images and re-structure them the way you want them and to keep them local.

imatge de MarcusMoeller
Enviat per MarcusMoeller el dc., 09/23/2015 - 11:09

Is there really a use case for enlarging swap partitions? Shouldn't there be a good default that fit's every use case? I assume that every laptop now has a 40GB hard drive. On such a device one can always set up e.g. a 2GB swap. Even on larger drives that might be a good default. The only reason I see for larger swap space is if you want to support hibernate.

imatge de Rhein-Ruhr-Hub
Enviat per Rhein-Ruhr-Hub el dc., 09/23/2015 - 11:37

After having received a large number of IT donations - there is a huge variety of CPUs (e.g. P4 -> i7), RAM (e.g. 256 MB -> 4 GB), disc-size (e.g. 20 GB -> 320 GB), production date from 2002 up to today.

As swap should be close or equal RAM size how should we predict or define a standard swap size? It is changing with every laptop being donated and has to be adapted individually.

Following your suggestion and having a 20, 30 or 40 GB disc we would loose disc space setting swap to 2 GB, if 512MB RAM would be installed (every GB counts in such a case). Helpers of Labdoo Hub Rhein-Ruhr have worked on close to 2.500 IT donations - and they had a huge variety.

imatge de MarcusMoeller
Enviat per MarcusMoeller el dc., 09/23/2015 - 12:12

Where do you take the formula from that swap size has to be equal to ram size? This only matters on hibernation.

I am not sure if today you still receive a lot of P4 laptops with 20GB RAM so that case might be very rare. Assuming you have at least 40GB disk space available 2GB should be a good choice.

imatge de Rhein-Ruhr-Hub
Enviat per Rhein-Ruhr-Hub el dj., 10/01/2015 - 15:10

Thank you for your contribution. As is a grass-root initiative many Labdooers can contribute in various ways.

Please keep in mind that I am just the administrative contact for the German speaking countries, not the technical person to decide any new suggestions. We discussed your suggestion in the Labdoo Hub Rhein-Ruhr and we decided not to use your way of installation. The main reasons are that you need deep technical skill, which most Labdooers do not have, all our helpers are used of cloning and we cannot see any advantage.

One general aspect of is to keep the project simple. So some Labdooer only install a basic (L)Ubuntu OS. Some use cloning, some use scripts, some might use your way of installation. But your access ask for a Gigabit-switch, an IPv6 network etc. - equipment with none or only very few Labdoo helpers own.

In case you want to add your way of installation to our wiki please ask Jordi to give you the role of a wiki editor.