LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-01-2010, 09:10 AM   #1
macdons
LQ Newbie
 
Registered: Jun 2010
Posts: 7

Rep: Reputation: 0
can dd be used to copy one disk to many


Does anyone know if this is possible? I am attempting to copy one "master" hard drive to two or more "destination" drives. I hope to use the DD command because the master drive is encrypted and I need to make exact copies to "destination" drives.

I have used dd if=/dev/sda of=/dev/sda and it works for one-to-one operations. I tried dd if=/dev/sda of=/dev/sdb of=/dev/sdc but the command skips the of=/dev/sdb and copies to sdc....I knew that was going to be too easy :-)

Any help would be appreciated. We currently use a hardware disk duplicator to perform the function but they tend to be expensive.
 
Old 06-01-2010, 09:13 AM   #2
amani
Senior Member
 
Registered: Jul 2006
Location: Kolkata, India
Distribution: Debian 64-bit GNU/Linux, Kubuntu64, Fedora QA, Slackware,
Posts: 2,766

Rep: Reputation: Disabled
use the parted magic or clonezilla live cd for that
 
Old 06-01-2010, 09:39 AM   #3
macdons
LQ Newbie
 
Registered: Jun 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Reviewed Documentation - doesn't seem like solution

I reviewed the doc's on the two suggested solutions. It doesn't seem like either is capable of taking one disk and making multiple copies at the same time. I may be missing something though.
 
Old 06-01-2010, 10:07 AM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
How about dd if=/dev/sda | tee /dev/sdb | tee /dev/sdc > /dev/sdd
 
Old 06-01-2010, 10:17 AM   #5
cola
Senior Member
 
Registered: Sep 2007
Posts: 1,045

Rep: Reputation: 65
Quote:
Originally Posted by catkin View Post
How about dd if=/dev/sda | tee /dev/sdb | tee /dev/sdc > /dev/sdd
What does it mean tee ?
 
Old 06-01-2010, 10:19 AM   #6
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by cola View Post
What does it mean tee ?
From the tee man page
Code:
TEE(1)                                                          User Commands                                                         TEE(1)

NAME
       tee - read from standard input and write to standard output and files
 
Old 06-01-2010, 11:14 AM   #7
macdons
LQ Newbie
 
Registered: Jun 2010
Posts: 7

Original Poster
Rep: Reputation: 0
returned error msg

Thanks catkin,

I put in a master drive and 2 destination drives and attempted the command dd if=/dev/sda | tee /dev/sdb | tee /dev/sdc > /dev/sdd

The command ran for about 20 minutes and then returned the following error:

tee: standard output: No space left on device

I booted each of the destination drives and found that the securedoc boot loader was copied, but the encrypted part of the disk was not copied. Is it possible that this is because the "tee" option tries to process what is being read and written and, because the disk is encrypted, it is unable?

This definitely brings me closer to my final goal
 
Old 06-01-2010, 11:41 AM   #8
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by macdons View Post
I booted each of the destination drives and found that the securedoc boot loader was copied, but the encrypted part of the disk was not copied. Is it possible that this is because the "tee" option tries to process what is being read and written and, because the disk is encrypted, it is unable?
The encyption should not matter. The info coreutils 'tee invocation' command gives examples of tee usage including processing a .iso file and a tar file. I figure tee is agnostic about what it's copying.

Is it possible that the error message is correct and that one or more of the destinations really wasn't big enough?

How did you determine that "the encrypted part of the disk was not copied"? If you did it by trying to browse the file system it could be that incomplete encrypted data is unusable. How about using dd to copy the securedoc boot loader and a few MB of the encrypted part to a file for both the original and one of the targets and then checking for similarity/difference with md5sum?

Last edited by catkin; 06-02-2010 at 01:47 AM. Reason: Fixed [/QUOTE]
 
Old 06-01-2010, 01:17 PM   #9
macdons
LQ Newbie
 
Registered: Jun 2010
Posts: 7

Original Poster
Rep: Reputation: 0
verifying copy success

In terms of lack of space...My master is an 80GB drive and the two destination drives are 160GB.

I used an external caddy attached to a secure-doc'd computer to check what was copied. I am able, on a successfully copied drive, to read the contents of the disk. When I put in the drive that gave me the tee: error, I see an 80GB partition, but am unable to browse it without getting errors. Also, the dd if=/dev/sda of=/dev/sdb command that works took almost 2 hours to complete, where the more recent command with "tee" only took about 20 minutes.

I will attempt again with all drives exactly the same just to eliminate different drive sizes/geometries.
 
Old 06-04-2010, 04:42 AM   #10
macdons
LQ Newbie
 
Registered: Jun 2010
Posts: 7

Original Poster
Rep: Reputation: 0
using tee doesn't work at all

I have tried copying both encrypted and non-encrypted hard drives using the dd if=/dev/sda | tee /dev/sdb |tee /dev/sdc > /dev/sdd command and nothing gets copied. I believe what was happening before when it looked partially successful is that the destination hard drives had not been wiped and the file table got copied back during the process and it "looked" like the files were copied. I am not even able to copy disk-to-disk using this command....minus the |tee /dev/sdc and replacing > /dev/sdd with > /dev/sdc

I will keep plugging away. Any other suggestions from readers of the forum?
 
Old 06-04-2010, 07:09 AM   #11
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by macdons View Post
I have tried copying both encrypted and non-encrypted hard drives using the dd if=/dev/sda | tee /dev/sdb |tee /dev/sdc > /dev/sdd command and nothing gets copied.
I'm sorry it did not work and can't understand why.
 
Old 06-04-2010, 09:34 AM   #12
macdons
LQ Newbie
 
Registered: Jun 2010
Posts: 7

Original Poster
Rep: Reputation: 0
how should I prepare destination drives

Is there anything I should do to prepare the destination drives? Maybe I am missing something basic.
 
Old 06-04-2010, 10:08 AM   #13
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by macdons View Post
Is there anything I should do to prepare the destination drives? Maybe I am missing something basic.
Not that I can think of; dd simply starts at the first block addressable via the driver and writes to successive blocks until finished; I had hoped that tee would not alter anything except to bifurcate the data stream to successive disks.
 
Old 06-04-2010, 01:07 PM   #14
macdons
LQ Newbie
 
Registered: Jun 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Tried master to 2 destination usb memory sticks

It didn't work when attempting a copy of a master usb memory stick to 2 destination memory sticks of same size and manufacture either. I did notice that, even though they looked identical on the outside, they had different geometries. The copy process does work when doing a one-to-one operation.
 
Old 06-04-2010, 01:32 PM   #15
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
A quick inspection of the tee source code shows it using read(2) to read from stdin and and fwrite(2) to write to each output file (I did not realise several were possible or would have suggested dd if=/dev/sda | tee /dev/sdb /dev/sdc /dev/sdd). I have some doubt about the O_BINARY on line 144 (what is it's value? Where is it set?) but netsearching it suggests it is ineffective on UNIX and Linux anyway.

Apart from that slight doubt the tee source code supprts my original concept that tee simply copies stdin to its output verbatim ...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy of IBM Server hard disk data to Another USB External Hard disk mazharcdn Linux - Server 2 09-02-2009 12:41 AM
System collapse without kernel panic when copy file to a sata-disk or usb-disk JammyWei Linux - Embedded & Single-board computer 0 12-25-2008 08:21 PM
use dd to copy a disk ubuntu-norm Linux - Software 1 07-28-2005 02:43 PM
copy linux installation from old disk to new disk rmanocha Linux - Software 4 07-20-2004 06:21 AM
Disk copy bfloeagle Linux - Hardware 4 11-16-2002 05:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration