Linux (any distro) HowTo: Clone disks via the command line with dd
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
By Kenny_Strawn at 2011-02-20 14:52
I know many people who post here on LQ may think that the GUI is the only way to clone a CD or DVD, but it isn't. If you happen to be running a dumb terminal, you can clone with dd.
This command not just allows you to clone CDs or DVDs, but also hard disks and USB flash drives, creating exact 1:1 copies of these disks. But be warned: When you clone one hard drive onto another, you erase the contents of one drive with the contents of another. You can also use dd to create an image file with the contents of a hard drive, CD, DVD, or USB flash drive for later cloning. Let's get started!
Create an image of a hard drive for later use:
Code:
dd if=/dev/sda of=/mnt/hdd.img #be warned: the image created may be too large for your hard drive
Clone the image back onto another drive:
Code:
dd if=/mnt/hdd.img of=/dev/sda
Clone the contents of one partition onto another:
Code:
dd if=/dev/sda1 of=/dev/sda2
Clone the contents of a whole hard drive onto another completely different drive:
Code:
dd if=/dev/sda of=/dev/sdb
Clone one CD or DVD onto another in a separate drive:
BE WARNED!! Most of these commands will ERASE the contents of disks with new content! USE THESE COMMANDS WITH CAUTION! If you can heed the warnings, you can use this command very usefully, for example to create backups of drives onto external ones.
Sorry for the inconvenience regarding the duplicates; apparently my Chrome notebook froze and I ended up pressing "Post article" four times.
by corp769 on Mon, 2011-02-21 22:47
Nice. Hate when that happens.... well it doesn't happen to me, cause I don't use a laptop from google. LOL.... Speaking of which, how is that thing anyway? I am thinking about trying to get one.
by Kenny_Strawn on Mon, 2011-02-21 22:55
So far, I have experienced very few bugs, but it's not like I have none together. In particular, there's one bug where the screen resolution seems to constantly rise to a level so high that some themes fail to render...
However, no worries. I was able to create my own theme, and I was able to (via the Chrome Theme Creator) set the New Tab Page background to be repetitive so I don't have that problem.
Apart from this discussion thread straying from it's intended purpose, in your text you listed "dd if=/mnt/cdbackup.iso of=/dev/cdrom" as a way to burn an ISO to CDROM. Did you actually test that command writing a valid CDFS to an empty CDROM? Didn't you get any errors? Could you read slash verify the result for real?
by Kenny_Strawn on Tue, 2011-02-22 22:59
Quote:
Originally Posted by unSpawn
Apart from this discussion thread straying from it's intended purpose, in your text you listed "dd if=/mnt/cdbackup.iso of=/dev/cdrom" as a way to burn an ISO to CDROM. Did you actually test that command writing a valid CDFS to an empty CDROM? Didn't you get any errors? Could you read slash verify the result for real?
The command is provided that a CD is in the drive...
by TobiSGD on Wed, 2011-02-23 07:37
Have you tested that? I doubt that this will work.
by Kenny_Strawn on Wed, 2011-02-23 20:24
Quote:
Originally Posted by TobiSGD
Have you tested that? I doubt that this will work.
I have tried it with a CD in the drive, and it does work. First, with the CD mounted, you run 'fdisk -l' and then, when the device file for the CD or DVD drive is determined, you dd the image to it. It works for me, at least from an external CD ROM drive.
by Kenny_Strawn on Wed, 2011-02-23 22:44
And I didn't mention trying to dd "back" onto the CD it came from, I was referring to cloning one CD onto another via the use of an image so that you can copy the CD or DVD multiple times with just one CD or DVD drive.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
However, no worries. I was able to create my own theme, and I was able to (via the Chrome Theme Creator) set the New Tab Page background to be repetitive so I don't have that problem.
Take a look:
https://lh5.googleusercontent.com/_7...221-190507.png
I also reported the bug.
https://chrome.google.com/webstore/d...eneei?hl=en-US