Operating systems

DIY: Image your drives for free with Clonezilla

Clonezilla makes disaster recovery possible, even for shops with little to no budget for such a process. Jack Wallen walks you through the steps of how to use Clonezilla for imaging drives.

In the consultancy where I work, Acronis is the tool usually used to image drives. It's a pretty reliable solution that comes with a pricetag that many small businesses simply cannot afford. When small businesses don't have the budget to afford such tools, their drives do not get imaged. Without an imaged drive, it makes recovery from disaster a significant, if not almost impossible, task.

For anyone with a tight budget (and a DIY nature) who needs an imaging solution, the best tool for you might be Clonezilla. The Free Open Source Software (FOSS) tool offers the ability to clone an image of a machine and restore that image to either a single machine or multiple machines (40+ machines simultaneously). Clonezilla's features include:

  • Free (GPL) Software.
  • Supports these formats: ext2, ext3, ext4, reiserfs, reiser4, xfs, jfs of GNU/Linux, FAT, NTFS of MS Windows, HFS+of Mac OS, UFS of FreeBSD, NetBSD, and OpenBSD, VMFS of VMWare ESX.
  • Support for LVM2 under GNU/Linux.
  • Support for Grub 1 and 2.
  • Unattended mode.
  • Support for Multicast in Clonezilla SE.
  • Local disk, ssh server, samba server, or NFS server support.
In this tutorial, I walk you through the process of how to use Clonezilla for imaging drives. Tip: I strongly encourage you to test this process (both the creation and the restoration of an image) on a non-production machine before attempting to do so on a production-level machine.

Step-by-step instructions on using Clonezilla

Step 1: Clonezilla is used as a Live CD, so the live ISO image must be downloaded and burned. Make sure the correct ISO for the architecture needed is downloaded. Step 2: Insert the burned ISO image into the disc tray of the machine to be cloned and reboot the machine. Make sure the machine boots from the CD. Step 3: When the Clonezilla Boot screen appears (Figure A), select Clonezilla Live and press [Enter]. This will start the boot process for Clonezilla. Figure A

You can also opt to boot from the install OS on the drive if you are not ready to run Clonezilla.

Step 4: Walk through the wizard to complete the Clonezilla boot process. In this wizard the language and keyboard keymap are selected. After that is complete, Clonezilla will prompt for which mode to enter. There are two choices: Start Clonezilla or enter the Clonezilla command line prompt. Only advanced users should use Clonezilla from the command line prompt. Step 5: Select the type of cloning you want to work with from Clonezilla's two options: device-image or device-device (Figure B). The device-image option will create an image of the source drive and device-device will copy the source to the target directly. The most common usage is device-image. Figure B

Click the image to enlarge.

If you choose device-device, make sure the target device is equal to or greater in size than the source device.

Step 6: Choose where the image will be saved. There are six choices: Local device, SSH Server, Samba Server NFS Server, enter shell, or skip. If a USB-connect drive is the target, you should choose Local device (Figure C). Figure C

Click the image to enlarge.

Make sure the USB drive is connected and ready before you make the choice.

Step 7: Now it is time to mount the partition to be cloned. All partitions on the drive will be available, so make sure the correct partition is selected. Remember, these partitions will be listed in the standard GNU/Linux naming convention (i.e., sda1, sdb1, etc.). Figure D shows the screen for these selections. Figure D

In this image, the source to be cloned is a Windows XP machine running in a VirtualBox VM. (Click the image to enlarge.)
Step 8: It's time to select where to save the image. The image is usually placed in the top directory (which will be labeled as "/") of the target device. After this selection is made, a summary of the file system disk space usage will be printed out, and Clonezilla will be waiting for user input (pressing Enter). Step 9: Choose the mode to run Clonezilla from the options Beginner or Expert. Step 10: Select the mode for Clonezilla. The choices are: savedisk (save the entire disk to an image), saveparts (save the partitions to an image), restoredisk (restore the entire disk from an image), restoreparts (restore partitions from an image), recovery-iso-zip (create a recovery ISO disk), chk-img-restorable (check to see if an image is restorable). (Figure E) Figure E

For cloning a disk, either the first or the second option will be selected. (Click the image to enlarge.)
Step 11: Name the image. I highly recommend including the date in the image name. Step 12: Choose local disk for the source. This screen (Figure F) will allow the choice of backup destinations. If more than one drive is listed, make sure the correct disk is selected. It will also be necessary that the disks chosen have enough room to store the image. Figure F

The naming convention will follow the Linux standards. (Click the image to enlarge.)
Step 13: It is important to have your image verified after creation. If this check completes successfully, the backup image is definitely valid; if the check fails, you need to re-do the Clonezilla process to make sure everything was selected properly. There will be one more confirmation, and then the creation of the image will begin. When the creation is complete, the image file will be on the target disk. Step 14: In order to restore the image, you need to go through the process again and select (at Step 10) Restore partitions from an image. The process is reversed, and the image will be restored.

Conclusion

Disaster recovery is a critical facet of IT, and there's no reason why small businesses should be left out due to budgetary constraints. Fortunately, Clonezilla is there to make disaster recovery possible, even for those with next to no budget for such a process.

More about Clonezilla on TechRepublic

About

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website getjackd.net.

24 comments
tracyweaver
tracyweaver

It was removed from FreeBSD and OpenBSD; the NetBSD implementation was nonfunctional until work leading up the 4.0 release made it viable again as a production file system.


Try:- http://www.filesrecoverytool.com/bsd-data-recovery.html

Software that easily recovers all your lost, deleted, or inaccessible data from Solaris Sparc-based hard drives/volumes.

emgub
emgub

The default 2GB limit is because that's the biggest file you can save on an older FAT32 formatted disk.

GooseNipples
GooseNipples

I would love to set this up using my Ubuntu 11.04 Server as a main backup point for my three Windows boxes, and have it all be totally automatic. I have scripts to wake the PC's up and shut them back down, and setting them to PXE boot is trivial. I follow on how to set up the PXE server on my Linux box, setting up DRBL, etc, but every tutorial I read on how to actually BACK UP the client has things like "Press Enter", select this, click that. I see that there is a command line option for CloneZilla and after you go through the process of selecting everything, I see it gives you command line output of what to put in next time. I suppose my question is, as I am a bit of a newbie here, how would one go about setting up a totally, utterly, completely unattended bare metal backup of three machines with multiple hard drives every single night? I know how to set up cron jobs and I have seen many articles on backup rotation and it shouldn't be too hard to modify a script to change the filenames of the backups, but how (is it possible) to configure something on the client end to do all of the above? Thank you all ever so much for writing such great articles. Chris

Chomps
Chomps

The family has 3 Netbooks (all drives under 200 gig). Can I back-up all the drives to a single 1 tb external drive as long as I name the back-up images differently?

startzp
startzp

I cloned a 250Gig drive onto a 1TB drive. I now need to extend the 250Gig partition to encompass the whole drive. Is there a piece of freeware to accomplish this and are there any additional steps after the actual extension that must be completed in order for the drive to boot and see the whole TB?

chris_black
chris_black

Acronis Backup and Restore is only $80 or so - hardly out of reach for small businesses.

BuckRogers
BuckRogers

Like a way I can access the image if needed without having to restore the entire image to grab a file or 2?

Octavian Szolga
Octavian Szolga

The tutorial that you've presented is somehow limited in scalability, meaning that it can't be applied when you have to deploy the same image on 100 PC's. For scenarios like these I recommend setting up a clonezilla server. In this case, you won't have to use a bootable CD, but rather you would use PXE boot that has to be supported by client's NIC. All you have to do is connect all the machines to the network, set PXE boot from BIOS or whatever, and they will get an IP address from clonezilla server (that is also a dhcp server), then by the means of TFTP protocol they will get a minimal kernel that will enable you to do the tasks that are done using that bootable CD that you've mentioned. For a complete tutorial over this solution I would recommend this link: http://packratstudios.com/index.php/2008/04/20/how-to-setup-clonezilla-on-linux-ubuntu-quick-start-guide/ Regars, Octavian Szolga

TheChas
TheChas

If you have Seagate or Western Digital drives, you can download disk tools from their websites that include a brand specific version of Acronis True-Image Home. The Seagate disk tools have worked well for me, as they only require that one of the drives in the system be a Seagate or Maxtor drive. I've used the tool mainly to image laptop drives onto larger drives for additional storage capacity, and it has worked well. Chas

Neon Samurai
Neon Samurai

This is probably a patent limitation rather than implementation issue but has NTFS support improved? Clonezilla is fantastic for doing well supported file systems where it can properly compress them. For doing a dualboot box or NTFS based system it was ugly the last time I looked at it; treats NTFS as a single giant blob unlike things like ext3 where it can record details to recreate the partitions while compressing and handling files within the storage space. A 1TB ext3 partition may result in a 300MB disk image where a 1TB NTFS is going to result in a 1TB disk image. For me with *nix systems though.. it's all about Mondo Rescue for on system generated disk images and Clonezilla LiveCD for externally generated disk images. (now if the good folks at Mondo would hurry up and ship a working Debian 6 set of packages.. it remains the one outstanding package to replicate my Debian 5 installs)

Paul G Taylor
Paul G Taylor

The how-to above shows things in reverse order. The first selection shows the selection of sda1 (In Vbox) which is what is to be cloned, but this will mount that partition as the repository for any image(s) created. This is incorrect. The first selection is that of the partition to be mounted as '/home/partimage', i.e. where the cloned image will be saved. After this choice has been made all other partitions will be unmounted before proceeding, making them available for choice as the Source for cloning. The second selection will be that of an unmounted partition(s) which is the Source from which the image will be created. You can choose one or more of the unmounted partitions to back-up to the image that is about to be created. It is worth noting that, if you run Clonezilla a second time you can choose the image that you have now created and convert it into an ISO file for burning to a DVD or alternatively to a compressed file for installing to a USB flash-drive or external hard drive, or to both the preceding. This will create a bootable image that can be used for restoring the system if there is a failure of the hard drive and the system becomes unbootable. One point to be aware of is that Clonezilla limits the size of images by default to 2000 MB, meaning that it will create a series of linked images of that size. If you want to burn the images to a DVD you should change that to 4500 MB, if you want to put the image onto an 8 GB USB flash-drive, then change to 8000 MB and for a single image use a value higher than the image will exceed, such as 100000 MB. Paul

Paul G Taylor
Paul G Taylor

By all means, yes. I would suggest creating separate folders in which to put the backup images for ease of recognition, calling the folder by a name that identifies the notebook uniquely - factory ID or model, or whatever you cannot mistake. Also I would suggest imaging the system on its own and keeping your data synchronised under an appropriately named folder rather than in an image. Under Linux I would use Grsync and set this up with job that periodically syncs the user's own data to the USB external drive. The first time it does this, it will copy everything over, taking quite a while. Subsequent times will only copy changed files and be fairly fast. If all netbooks are connected via a LAN you should be able to automate this process. The benefit of having the personal data synchronised is that it is easily readable with your normal file browser and you can recover one file or selected files as needed. You can also refer to these copies from other computers if you wish. Much more versatile, much easier to keep up to date and more easily automated. Paul

dan
dan

Another LiveCD called GParted will accomplish the task. Once loaded you will be able to extend the partition.

asics447
asics447

I have used Gparted with great success - and its free - used it on drives much bigger with terabytes of data - just make sure you plan enough time for the process - the bigger the size the longer it will take - GParted Rocks - coming from a Micr$oft guy

Octavian Szolga
Octavian Szolga

http://drbl.org/faq/fine-print.php?path=./2_System/43_read_ntfsimg_content.faq#43_read_ntfsimg_content.faq Method 1: Use Clonezilla live to restore the image to a virtual machine (e.g. VMWare workstation or Virtual Box). Then mount the restored partition to read the contents. Method 2: Prepare a large disk in Linux Say if your image is /home/partimag/YOURIMAGE/, if the image is like /home/partimag/YOURIMAGE/*-ptcl-img.* (e.g. /home/partimag/YOURIMAGE/sda1.ext4-ptcl-img.gz.aa), follow this to restore the image. If the the image is like /home/partimag/YOURIMAGE/sda1.ntfs-img.aa, sda1.ntfs-img.ab..., run "file /home/partimag/YOURIMAGE/sda1.ntfs-img.aa" to see it's gzip, bzip or lzop image. Say it's gzip, then you can run cat /home/partimag/YOURIMAGE/sda1.ntfs-img.* | gzip -d -c | ntfsclone --restore-image -o sda1.img - Then you will have a "sda1.img" which you can mount it by mount -o loop -t ntfs sda1.img /mnt Then all the files are in /mnt/ You can do the similar thing for the ext3, ext4 or reiserfs file system. Method 3: Use the tool partclone-utils to mount the image directly. (//NOTE// This program is not maintained by Clonezilla team. However, it will be included in the future release of partclone when the new release, e.g. 0.2 is released.).

dave
dave

I will check this out. I've used CloneZilla to deploy images, but have not done it beyond 20 desktops at a time. May have to deploy 50+ soon.

GregEB
GregEB

I've used the Maxtor MaxBlast 5 Acronis based disk tool, and the full retail Acronis True Image 10. They had been working very well. However, if you use a non-Windows OS like Linux, the newer Linux releases using newer file systems like ext4 are not supported by the older versions of Acronis and the Maxtor disk tools, and they will only perform a sector by sector disk copy, which increases the size of the backup image file. It is my understanding that Acronis can only read Linux file systems that use 128-byte inodes. Some Linux distributions use 256-byte inode size, which also results in a sector by sector disk copy, and larger sized backup image files. I've looked at the more recent versions of the Acronis, Maxtor, and the Western Digital products. According to their user manuals it looks like their non-Windows OS support has gone downhill from the products that I've used.

Paul G Taylor
Paul G Taylor

I wonder how long ago it is since you looked at NTFS support in Linux? These days support is flawless with ntfs-3g having full support of the NTFS file system. I have been using an Elements external drive as well as a shared internal partition, both formatted as NTFS, for some time without the slightest problem at all. Paul

gsinkinson@att.net
gsinkinson@att.net

I'm burning an image of a 120GB drive to a 300GB external drive. You suggest using 120000MB. Can you give me an idea of where/how to change the default image size of 2000MB?

BuckRogers
BuckRogers

Unless someone knows of a Windows utility that would allow the mounting of a Clonezilla image directly? Thanks,

Paul G Taylor
Paul G Taylor

I don't know why the default image size is set to 2000 MB as this does not accord with anything useful, asaik. I would have thought it would be either 700 MB for a CD or 4500 MB for a DVD. Any way, where you change the size is during the step-by-step process of selecting what to image and where to store the image, you come to a place where the default size is displayed and you simply type your changes into the edit-box. You can either add some zeros, to essentially make it one image, or change it to 4500 for a DVD or 8000 for an 8 GB USB flash-drive. Be sure to check the capacity of your target drive in MB and not MiB. Paul

BuckRogers
BuckRogers

7zip option didn't work for me. Since I am a Windows shop I purchased Image for Windows comes with Image for Linux and Image for Dos boot discs you create. Main reason light weight quick compressed images that I can mount and pull off files if needed. Can make image while in windows and out with boot discs. Same low cost license works with servers if needed.

Octavian Szolga
Octavian Szolga

I guess you could use 7zip to decompress it and try using a windows ordinary image mount utility (ie daemon tools, acetoneiso, etc) I've never tried it, but you might give it a go.

Editor's Picks