dd to multiple USB drives at once?


Results 1 to 5 of 5

Thread: dd to multiple USB drives at once?

Hybrid View

  1. #1
    Join Date
    Aug 2018
    Posts
    1

    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.

  2. #2
    Join Date
    May 2019
    Location
    houston,texas
    Posts
    7
    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.

  3. #3
    Join Date
    Jun 2004
    Location
    Newcastle upon Tyne
    Posts
    2,983
    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!
    Linux user started Jun 2004 - No. 361921
    Using a Linux live CD to clone XP
    To install Linux and keep Windows MBR untouched
    Adding extra Linux & Doing it in a lazy way
    A Grub menu booting 100+ systems & A "Howto" to install and boot 145 systems
    Just cloning tips Just booting tips A collection of booting tips

    Judge asked Linux "You are being charged murdering Windoze by stabbing its heart with a weapon, what was it?" Replied Linux "A Live CD"

  4. #4
    Join Date
    Sep 2019
    Posts
    1
    What do you mean by "destroy both drives" exactly, Saikee? Literally?

  5. #5
    Join Date
    Jun 2004
    Location
    Newcastle upon Tyne
    Posts
    2,983
    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.
    Linux user started Jun 2004 - No. 361921
    Using a Linux live CD to clone XP
    To install Linux and keep Windows MBR untouched
    Adding extra Linux & Doing it in a lazy way
    A Grub menu booting 100+ systems & A "Howto" to install and boot 145 systems
    Just cloning tips Just booting tips A collection of booting tips

    Judge asked Linux "You are being charged murdering Windoze by stabbing its heart with a weapon, what was it?" Replied Linux "A Live CD"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •