Ubuntu, System/disk image to USB

1

2

It's simple. I have a 212GB pc with ubuntu 10.04 on it already configured for production environment. Only 4 GB are used out of 212GB.

I want a (possibly quick) way to put the system image on a smaller (8gb) usb stick to be able to install this preconfigured linux on many machine of the same kind (same hardware, model etc) and possibly also on different models if needed.

Clonezilla, dd, you name it all do a byte to byte copy, resulting in a 212gb image with mostly unused space.

How can I achieve this??? The more details the better

user3924708

Posted 2015-03-10T12:15:15.153

Reputation: 63

3You can use GParted to "shrink" the Ubuntu partition to, say, 5GB (so you've got some space to play with) and then use CloneZilla to copy the Ubuntu partition. When you restore the image it'll see the 8GB as perfectly enough space and the image applying step will work. You cant hen use GParted to grow the partition to the rest of the disk. – Kinnectus – 2015-03-10T12:26:39.940

I don't run ubuntu any more, but many of the answers here work for ubuntu. http://softwarerecs.stackexchange.com/questions/16376/software-that-will-do-an-online-clone-of-a-linux-system Remastersys would have been what I suggested, back in the day

– Journeyman Geek – 2015-03-10T12:33:01.710

@BigChris I've reduced the partition at 6500 MiB but when I booted it was 13,7 GB... Why? – user3924708 – 2015-03-10T18:43:50.313

Possibly swap partition. Reboot to a LiveCD and see what happens when you're not using a live system. – Kinnectus – 2015-03-10T20:02:53.763

Answers

2

There are a couple of ways to achieve this. We have done this but then found a product for "mass imaging" so our simple needs expired.

CloneZilla

To be able to clone a partition to a smaller disk using CloneZilla you can either use the -icds argument with your CloneZilla session (when deploying) or you can pre-shrink your Ubuntu partition using GParted before taking the image using CloneZilla.

If you use the -icds argument in your CloneZilla session to deploy your image then please be very careful as CloneZilla will apply the image and if the data exceeds the size of the disk then you will lose data. Use at your own risk. If the image data is less than the disk you are applying the image to then, in most cases, the image will be fine.

If you pre-shrink the Ubuntu partition so you can pre-empt the device sizes you are likely to apply the image to then the partitions will be in a safe state prior to cloning. The drawbacks of pre-shrinking the Ubuntu partition is that when the image has been applied to a device of much larger size you will need to go back in to GParted to grow the partition to the device size. You could probably script this once CloneZilla has completed but this is extra complication and will need some research.

FOG Project

An alternative solution to CloneZilla is a fairly evolved project called FOG. FOG is an imaging server solution that is Open Source and you install it on another Ubuntu machine with a large data storage. Once you configure the FOG server you register each machine on your network (by its MAC address) and you can assign each client to have an image. When you need to "capture" an image you simply log on to the FOG web interface and begin the capture process. To deploy an image you can either do this using the web interface or using the PXE menu at each client. This system is far more complicated to configure but offers the most flexibility and is really easy to use once configured. It allows imaging large numbers of machines simultaneously (CloneZilla with DRBL also allows this, but FOG is much better). The good thing about FOG is then when it is "capturing" an image (such as an NTFS - I don't know the other filesystems but there are more) it can resize the partition to the smallest it can be (the used data) which allows you to restore to different size disks without any individual machine configuration.

Kinnectus

Posted 2015-03-10T12:15:15.153

Reputation: 9 411

I've reduced the partition at 6500 MiB but when I booted it was 13,7 GB... Why? – user3924708 – 2015-03-10T18:44:28.890

I ended up doing it with clonezilla but not being able to reduce partition. Meh... – user3924708 – 2015-03-19T13:52:28.477