Top 6 Open Source Disk Cloning and Imaging Softwares

by on August 25, 2012 · 17 comments· LAST UPDATED August 28, 2012

in Open Source, Storage

Disk cloning is nothing but the process of copying the contents of one hard disk (or partition) to another disk or to an "image" file. I make backup regularly using rsnapshot tool, but I also clone my hard disk once or twice a month. This option allows me to restore my OS and installed software quickly. Linux comes with various utilities for performing disk cloning. In this post, I'm going to list my favourite open source disk cloning softwares that has saved my butt multiple times.

#1: Old good dd command

The dd command allows you to make the low-level copying and conversion of data in raw format. It copies the standard input to the standard output. It can also be used for backing up the boot sector (MBR) of a hard drive or destroy data using /dev/zero or /dev/random.

Examples

To clone /dev/sdb3 partition to another partition called /dev/sdc3, enter:
# dd if=/dev/sdb3 of=/dev/sdc3 bs=4096 conv=noerror
You can clone a hard disk /dev/sdc to /dev/sdd:
# dd if=/dev/sdc of=/dev/sdd bs=1M conv=noerror
You can duplicate a disk partition called /dev/sda1 as a disk image file called backup.sda1.mm.dd.yy.img file:
# dd if=/dev/sda1 of=/path/to/safe/location/backup.sda1.07.28.12.img bs=4096 conv=noerror
OR
# dd if=/dev/sda1 of=/nfs/backup/images/backup.sda1.07.28.12.img bs=1M conv=noerror
To restore an image, run:
# dd if=/nfs/backup/images/backup.sda1.07.28.12.img of=/dev/sda1 bs=1M conv=noerror
The dd command can make backup of any partition regardless of an operating system. You can use it with FreeBSD / OpenBSD / Mac OS X / MS-Windows and so on:

(Video.01: dd clone hard disk demo)

Say hello to ddrescue

The ddrescue command copies data from one file or block device to another, trying hard to rescue data in case of read errors. The dd command will fail but ddrescue will continue:
# ddrescue /dev/sda /dev/sdb

#2 partimage - Backup partitions into a compressed image file

The partimage command backs up disk partitions into image files and restores them (much like Ghost). You can use the apt-get command under Debian / Ubuntu Linux to install the same:
# apt-get install partimage
If you are using RHEL / Fedora / SL / Red Hat / CentOS Linux, turn on EPEL repo and type the following yum command:
# yum install partimage
Type partimage as follows to see various options:
# partimage
Sample outputs:

Fig.01: partimage in action

Fig.01: partimage in action

You can now follow on screen instructions to backup or restore images.

Examples

Create an image of /dev/sda2 (make sure /dev/sda2 is not mounted):
# partimage -z1 -o -d save /dev/sda2 /nfs/backup/laptop.wks01.sda1.home_07_08_2012.gz
You can restore it as follows:
# partimage restore /dev/sda2 /nfs/backup/laptop.wks01.sda1.home_07_08_2012.gz.000
See how to use this fast software to backup and restore images:

(Video.02: partimage command demo)

Please note that partimage will only copy data from the used portions of the partition. This is done for speed and efficiency, free blocks are not written to the image file. Since the partition is processed on a sequential sector basis disk transfer time is maximized and seek time is minimized.

A note about server software

Partitions can be saved across the network using the partimage network support, or using Samba / NFS (Network File Systems). This provides the ability to perform an hard disk partition recovery after a disk crash. You need to install partimage-server package which provides server daemon for remote imaging, much like Ghost. See documentation for more info.

#3: Clonezilla

If you are looking to replace Norton Ghost Corporate Edition, try Clonezilla. It provides the following features:

  1. Disaster recovery
  2. Disk cloning
  3. Disk imaging
  4. Deployment solution
  5. Free and Open source

This software allows you to do bare metal backup and recovery. Clonezilla works in any one of the following mode:

  • Clonezilla live - Use this at home or for single machine backup and restore.
  • Clonezilla server edition - Use this at office or data center for massive deployment, it can clone many (40 plus!) computers simultaneously. Clonezilla saves and restores only used blocks in the harddisk. This increases the clone efficiency.
Fig.02: Clonezilla in action

Fig.02: Clonezilla in action

=> Download clonezilla software.

#4 Mondo rescue

Another good free disaster recovery software that I use frequently. It works with Linux /FreeBSD and supports clone tapes, disks, USB devices, network and CD/DVD as backup media, multiple filesystems, LVM, software and hardware RAID. Restoration may be done from a physical media including OBDR tape support, or CD/DVD/USB media, or from the network through PXE.

This software used by Lockheed-Martin, Nortel Networks, Siemens, HP, IBM, NASA's JPL, the US Dept of Agriculture, dozens of smaller companies, and tens of thousands of users around the world.

Fig.03: Mondo Rescue in action

Fig.03: Mondo Rescue in action

=> Download Mondo Rescue software.

#5 Redo backup and recovery

Redo backup and recovery is a free backup and disaster recovery software. It runs from a bootable Linux CD image, features a GUI, and is capable of bare-metal backup and recovery of disk partitions. It can use external hard drives and network shares. It is the simplest point and click open source backup and recovery solution available. You can store images on an external drive or network shares such as nfs based shared folders.

Fig.04. Redo backup and recovery software in action

Fig.04. Redo backup and recovery software in action

=> Download redo backup and recovery software.

#6 Trinity Rescue Kit

Trinity Rescue Kit or TRK is a free live Linux distribution that aims specifically at recovery and repair operations on MS-Windows systems, but is equally usable for Linux recovery issues such as as rescue, repair, password resets and disk cloning. Some features:

  1. Reset windows passwords with the improved winpass tool.
  2. 5 different virusscan products integrated in a single uniform commandline with online update capability.
  3. Full ntfs write support thanks to ntfs-3g
  4. Winclean, a utility that cleans up all sorts of unnecessary temporary files on your computer.
  5. Clone computers over the network via multicast.
  6. Contributed backup utility called "pi", to automate local machine backups
  7. Easy script to find and mount all local filesystems
  8. Recovery and undeletion of files with utilities and procedures
  9. Recovery of lost partitions
  10. Evacuation of dying disks
  11. 2 rootkit detection uitilities
  12. And much more
Fig.05Trinity Rescue Kit in action

Fig.05Trinity Rescue Kit in action

=> Download trinity rescue kit software.

My favorite software

For bare metal restore I prefer dd command (gziped images) as it includes copy of the boot sector, boot partition and the root partition. The dd command works well for small setup or home users. But, for a large setup and data center, I prefer to use either clonezilla or mondo rescue softwaee due to ease of use and reliability.

Have a favorite open source disk cloning and disaster recovery software? Got an alternative? Let us know your preferred app in the comments below.

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

  • 6r00k14n

    I have used the Clonezilla Live disc, which is fantastic, but if you are not so certain about what you are doing, try PartedMagic (trust me, you do not want to pick the disc you want to copy as the target).

    It is a bootable Linux CD, that includes several disc tools, including Clonezilla, in a terminal window (so that you can use other tools to validate your decisions).

  • FX

    Ha, dd is still the best for quick and easy cloning :)
    Once, I even piped dd to netcat to remotely clone a partition, best hack I ever did, and it just took a few seconds!

  • Bubba

    For the longest time, we used PING (http://ping.windowsdream.com/) as a very capable replacement for Symantec Ghost. We even went as far as building a custom boot/recovery CD for use by our remote users to restore a default image from a hidden partition on the hard drive. It worked very well.

  • deepak

    target disk should be equal or more size in clonezilla, this is the drawback i have seen, eg. i have 10G data on 50G disk to clone my target disk should be equal or more that 50G

  • Flo

    Very good article (as usual…)

    For more complex network backup, there is also Bacula :
    http://www.bacula.org/fr/

    Otherwise, I always use Clonezilla / DRBL (http://drbl.sourceforge.net/) since several years without any problem.

  • ilion1250

    Partimage is my choose, easy, secure and reliable, I have been used it; to clone the system partitions of my PC and laptop and I never had any issue.
    To backup the /home partitions I prefer rsync.

  • DontForget

    SystemIMager? http://sourceforge.net/projects/systemimager/ Has a bunch of different features, like torrenting, and “updating” installed images.

  • PNA Prasanna

    I used to run dd command for creating junk files for checking user quota.

    But these are very good stuff.

  • Esteban

    I use FOG, is a free, open source computer cloning solution

  • m.ardito

    filesystemarchiver is also a useful tool, as it saves one or more partitions at the filesystem level, in compressed archives. it can then restore them also on smaller disks, if the case. i find it useful, too.

  • http://www.cyberciti.biz/tips/about-us Vivek Gite

    Hey all,

    Thanks for sharing additional tools :)

  • xandry

    > Fig.01: partimag in action

    “partimage”, not “partimag”

    > from the used portions

    “partition”, not “portion”

    > Redobackup in action

    Keep space sympols

  • ask derrr

    Is there a utility available that would do daily whole disk image snapshots. while the OS is running?

    and then I could just restore it from there if anything happens?

  • Hari

    Wow

  • vms_cat

    When I wanted to make a full copy of Linux system (bootable) disk from Fujitsu 18 GB disk to Seagate 18 GB disk using dd, I got a message at the end of the process that the last 100 sectors were not copied because the Seagate disk was full.
    Did I lost some important data, or there were just empty sectors, I do not know.
    Today I copied Seagate 72 GB Linux system disk to 72 GB HP disk again using dd:
    dd if=/dev/sdc of=/dev/sdd and got a message:
    dd:writing to ‘/dev/sdd': No space left on device
    142264001+0 records in
    142264000+0 records out
    Again there is a problem of a smaller disk! And what about partition boundaries and partition table? Clonezilla is also reported not to support copy to a smaller disk.
    I wonder: Why UNIX programming community is unable to develop a disk copy tool of superior functionality, such as one have on OpenVMS. For example, to copy a VMS system disk I just type something like backup/image dkb100: dka300:
    and I receive full functional copy of the system disk even if the target disk is smaller than the source one. What does backup/image do: (1) boot block is included in the copy so that the target disk is bootable exactly as the source one; (2) copy is performed on “per file” basis so that target files become contiguous; (3) the contents of scratch files (page,swap,dump) is not copied to save time; (4) if the target is a tape or a sequential file then it can be read back on “per-file” basis if necessary.
    So, where are you, UNIX programmers?

  • Leszek

    I was recently looking for a similar solution to mksysb implemented in IBM AIX. It is used for creating a bootable image of the system. Then it can be used to do a full or selective restore. It is really versatile and useful. I’ve found REAR and Mondo Rescue for Linux and am now testing it.

  • debianman

    fsarchiver seems to be most versatile and simplest. It can store linux partition to windows partition.

Previous post:

Next post: