Pin Me

Cloning CDs and DVDs in Linux with Free Tools

written by: Pranav Thadeshwar•edited by: Lamar Stonecypher•updated: 9/2/2009

If you've worked with Windows, you will be aware that almost all disk-cloning applications for Windows are proprietary and some of them paid. Unlike Windows, Linux achieves these tasks with basic commands which are built-into it. Learn how to clone, mount and burn CD/DVDROM images in Linux!

  • slide 1 of 4

    Linux and the dd command

    Surprising as it may sound, Linux comes built-in with a basic application which can clone just about anything that you can connect to the computer. The 'dd' command is a basic application which can do low-level copying and conversion of raw data. It can read and write 1-to-1 copies from and of CD-ROMs, disk partitions, complete hard-disks, magnetic tapes and lots more. It is used for purposes ranging from forensics to completely destroying data on storage mediums, and everything in between. In this article though, we take a look at how you can use the 'dd' command to clone any CD/DVD-ROM and make an exact 1:1 copy of it using nothing but freely available tools for Linux

  • slide 2 of 4

    Copying raw data

    The holy grail of any data cloning job is 1:1 replication of the source. In simpler words, cloning is different from copying because copying data only works and is applicable for storage mediums which have a working filesystem and you only need the visible data. Cloning, on the other hand, will copy each and every byte of the storage medium, without caring if that particular storage area is blank or filled with data. While it obviously takes up more space than a normal copy, you get an exact representation of the filesystem/data on the storage medium. It is useful in cases like data recovery, where you would rather work with a 1:1 copy to recover data rather than risking further corruption of the medium. It is also useful when you want to clone drives and discs to make perfect backups.

    The basic structure of the 'dd' command is as follows:

    dd if=/dev/source of=/mnt/disk/destination.iso

    While it does accept other parameters like bootsector size and so on, this small snippet is enough to create a 1:1 copy of the source and place it at the destination. In our case, we will be copying from a CDROM. In Linux, the CD-ROM can be found at many different places inside the /dev folder, so a small part of the command will have to be changed by you to what your computer's CD drive reflects:

    dd if=/dev/cdrom of=/media/cdclone.iso

    Replace the 'cdrom' with whatever location your computer's CDROM holds. It might be /dev/hdX or /dev/sdX. The command will take a few minutes and will make an exact copy of the CD and store it inside the /media folder with the filename cdclone.iso.

  • slide 3 of 4

    Mounting ISO files in Linux

    Unlike Windows, where you normally need an application (most of them being proprietary and expensive) to mount ISO images to a virtual CD drive, you can mount disc images in Linux by typing a single command.

    mount -t iso9660 -o loop,ro /media/cdclone.iso /mnt/cdrom

    This command will take the file cdclone.iso and mount it in the /mnt/cdrom folder, provided that the folders exist. The -t iso9660 parameter tells the mount command to read the file as a iso9660 disc image format, which is generally used on CDROMs. The -o loop,ro command tells it to mount the disc image as read-only and specifies the default loop device (/dev/loop0, not needed). You wil then be able to browse the /mnt/cdrom folder as if the exact CD was mounted.

  • slide 4 of 4

    Writing ISO files to discs

    If you want to write this exact CD image to another empty cd, that's also the work of a free application present in Linux. This single command will take the path of the disc image and the destination CD/DVD writer as parameters and then write the data to the disc as a 1:1 copy.

    If you have an IDE CD/DVD burner (if your CDROM is found at /dev/hdX), then this is the command to use:

    cdrecord -dev ATAPI:/dev/hdc -data /media/cdclone.iso

    Substitute the hdc with wherever your CD/DVD burner is located. In case of SCSI/SATA CD/DVD burners, you can find the bus ID with the following command first:

    cdrecord -scanbus

    Once you have the relevant data, type the command like this:

    cdrecord -v dev=0,Y,0 -data /media/cdclone.iso

    Replace the 0,Y,0 with whatever the previous command tells you. In a few minutes, you should have a freshly burnt 1:1 copy of the original CD you copied!