Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I'm new to Linux Questions and I have a question about cloning hard drives.
I've done some research and found that this command will clone /dev/sda to /dev/sdb:
sudo dd if=/dev/sda of=/dev/sdb
When I enter this command the terminal just kind of sits there. The cursor blinks but it shows no signs of progress and has taken a lot longer than I thought it should. I'm only cloning 40GB hard drives. I was wondering if this was normal. Is there any way to check it's progress? How long should it take for it to complete? If I let it sit for awhile will it complete?
Any help would be greatly appreciated. Thanks in advance.
Possibly it's already finished, and the question is now moot.
Start up a new tab in your terminal session (or go to another vt) and "man dd". Near the end is a description of how to get stats out of it.
BTW I'd suggest you research some more - "dd" is an abysmal option for this (in most cases).
Sending a USR1 signal to a running `dd' process makes it print I/O sta-
tistics to standard error and then resume copying.
$ dd if=/dev/zero of=/dev/null& pid=$!
$ kill -USR1 $pid; sleep 1; kill $pid
18335302+0 records in 18335302+0 records out 9387674624 bytes
(9.4 GB) copied, 34.6279 seconds, 271 MB/s
Note that the man page is killing the copy after demoing the statistics. You just want to "kill -USR1 pidOfddProcess", either after backgrounding the dd with a trailing & or issuing the kill -USR1 from another terminal.
Last edited by jamesf; 11-26-2011 at 04:50 PM.
Reason: further information
Check that you have discs recognised by the operating system by doing as su
To clone 1 disk to another you should be running the operating system from a live cd to avoid a disaster where you may overwrite the wrong disk.
To monitor progress use dc3dd e.g.
dc3dd progress=on progresscount=1000 if=/dev/sda of=/dev/sdb
It doesn't mean anything but gives output on the dd command.
What do you mean "get the PID from the result"?
Gets the process running dd so that if you wish to stop that process, you kill it.
If you want to get info, I believe the last line in the post by brak44 gives you that.
Also, did you follow through on his suggestion to run fdisk to see if your second drive is recognized?
Are you running this from a Live CD as suggested?
Did you check the connections to the second hard drive?
My SATA drives transfer at about 50MB/sec. That's twenty seconds per gb assuming the data path can handle 100MB/s aggregate, 40*20 is pushing fifteen minutes at that rate, but 40GB is _very_ small, which probably means old, which probably means slow. Half an hour or more wouldn't be very surprising.
Not every signal terminates a program. Only one (-KILL) is a forced kill (do not use this casually, ^C sends -QUIT), many have conventional meanings, but -USR1 and -USR2 are completely up to the receiving program.
Yes I know both drives are being recognized with the "lshw -c disk" command and I am running it from a Live CD (Ubuntu Rescue Me remix to be specific).
I used "ps -ef | grep dd" and got a table of info as a result, I do not know where to find the pid on this table of info though. What should it look like, or where can I find it on the table so I can use the "kill -USR1 pidOfddProcess" to get the statistics?
Here I'm doing it all from one terminal, just so you can follow what is going on. Note that when I background dd with & it tells me the new pid. Then, the grep dd gives the pid in the second column, parent pid in the third (I don't need it for this). Then, I use kill.
I just tried that trick sending a signal to dd while writing an image file to a SD flash card. It reported much higher progress than it should have, then stopped reporting progress way before it was done. I mention this because if you use this method to test 'done-ness', you may end up doing something to the target drive before the write is really done.
I used "ps -ef | grep dd" to get the PID of "dd if=/dev/sda of=/dev/sdb". The PID is 2412 in my case. So I used "kill -USR1 2412" to get the statistics, but instead I just got a blank line. What do you think is wrong?