-
dd to multiple USB drives at once?
Hello,
First I want to thank you all for having a very informative and helpful forum. Now a summary of what I am doing and where I am trying to get with it. Summary: I am attempting to capture an image / file which contains the entire contents of a flash drive. I then want to write those contents to another flash drive, with the ultimate goal being writing to multiple flash drives at once. Details as follows:
A. Capture the image as a single file
1. Insert a drive that functions correctly and contains the image.
2. Find out what drives are present on the system
3. Open the terminal and run
sudo fdisk -l
4. Check out the sizes and the mount points to determine which
drives are USB drives, and which drive is the system hard drive.
Note: the USB drives should be 60 GB or less, and generally the first
usb drive in the system would be /dev/sdb
5. Given /dev/sdb is the drive I want to make into a file, I run the following command:
sudo dd if=/dev/sdb of=~/Usb_Image
This works fine. The file Usb_Image contains a copy of the data that was on the flash drive.
B. Write the file to a blank USB drive
1. Insert a blank 64 gb USB drive.
2. Find out what drives are present on the system
3. Open the terminal and run
sudo fdisk -l
4. Check out the sizes and the mount points to determine which
drives are USB drives, and which drive is the system hard drive.
Note: the USB drives should be 60 GB or less, and generally the first
usb drive in the system would be /dev/sdb
5. To copy the image data to the flash drive, run the following command:
sudo dd if=~/Usb_Image of=/dev/sdb
This also works fine. I end up with a bootable drive that is an exact copy of the original source drive.
And here is where I get lost... what I would like to to do is something like:
sudo dd if=~/Usb_Image | of=/dev/sdb | of=/dev/sdc | of=/dev/sdd
My goal is to copy the Usb_Image to multiple USB devices at once. I know the speed will be split among them as that is the way the USB hardware works. I have tried various commands found using Google, but so far no success. Consensus seems to be the tee command would be the way to go but I haven't been able to get the syntax to work. I am running Ubuntu 16.
I also tried running two terminal windows at the same time. One with
sudo dd if=~/Usb_Image of=/dev/sdb
and one with
sudo dd if=~/Usb_Image.drive of=/dev/sdc
Note that both Usb_Image and Usb_Image.drive are separate files but contain exactly the same data.
After both of the above commands completed , the usb at sdb had created correctly, while the usb at sdc only had 800 some MB on it... the Usb_Image file is almost 30 gb.
Thanks for your help.
-
for installing ubuntu you could only use one usb bootable at time, it can't be done multiple in one usb, it is done with windows os like windos 7 and 8.
-
dd has an output on completion. Could you capture the screen its message and post it here?
I believe dd in the absence of block size specification would use a default of 512 byte per record of transfer. The number of records executed is always reported plus and a message if an error is detected.
I recently did something similar and ran into the problem of sizes. In order for dd to work the target (or output) drive must be exactly or just larger than the source (or input) device. By that I mean down to the exact number of byte! I have 4 USB drives all 32GB but the sizes were slightly different, two were from the same manufacturer but different models. I failed because the input device was slightly larger than all of them.
If you dd a smaller input device to a larger output device the excess capacity will be treated as unallocated space.
dd copies the partition table which is part of the first record to be transferred. If the copied size discovered later by the OS to be different from the hardware size the drive will be rejected by the OS as it doesn't know what to do.
Lastly I normal do a if=/dev/sdb of=/dev/sdc in one terminal and then if/dev/sdb of=/dev/sdc in a separate terminal. You can have as many terminals as you wish. To execute all the dd commands in one terminal is also possible in Ubuntu or other Linux but the 2nd command can only be executed on completion of the 1st so the rest of commands can be left in a queue.
I would stick to Linux when using dd . All Winoows OSes treat a USB as giant floppy that cannot have more than one partition. If one inserts a USB drive with more than one partition a Windows would only read/write the first primary partition it could recognises and disregards the rest.
-
With regard to the command
Code:
sudo dd if=~/Usb_Image | of=/dev/sdb | of=/dev/sdc | of=/dev/sdd
it may work if you include if=~/Usb_Image in every follow-on command. However I would recommend dd one input with one output in each terminal.
In dd you copy the binary data sector by sector and should be absolutely clear with the instructions. A wrong move can destroy both drives!
-
What do you mean by "destroy both drives" exactly, Saikee? Literally?
-
FrederickM,
If you make a mistake about which is the source and the target you will copy the target on the source so your original data will be destroyed.
-
Just throwing out a suggestion, even though this is a pretty old thread:
If you have a file called driveImg.img, and wanted to write to both /dev/sdb and /dev/sdc, you could do:
Code:
(dd if=driveImg.img of=/dev/sdb) & (dd if=driveImg.img of=/dev/sdc)
...And that should copy simultaneously.
If you had more than those, you could use a for loop:
Code:
drives=("/dev/sdc" "/dev/sdd" "/dev/sde" "/dev/sdf")
for $drive in $drives; do (dd if=driveImg.img of=$drive &) ; done
...That would start all of the dd commands simultaneously, creating a background job for each.
But of course, as was mentioned in the OP, you may saturate your USB bus and have poor performance. In fact, it might not be 4x slower; it could be even slower than that, potentially.
Registered Linux user #230403! Since March 2001! YAY.
Try doing a forum search or a google search before asking a question. And please don't use HELP! in the topic of your post... it's so lame... Please don't PM me for help-- post a question in the forum instead.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|