LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Copying multiple iso to hdd (https://www.linuxquestions.org/questions/linux-software-2/copying-multiple-iso-to-hdd-930975/)

extr 02-23-2012 09:51 PM

Copying multiple iso to hdd
 
Hi,
I have a disk dump in multiple img files(dump1.img, dump2.img,...,dump150.img) . Is it possible to copy these all img files to hdd with ONE dd command? I mean something like:
dd if=dump*.img of=/dev/sda4 bs=512 conv=noerror

corp769 02-23-2012 11:40 PM

If those files already contain the dumped data, you can just copy them directly over using the cp command, unless not done already. If not, you can just use that command several times on one line using the semicolon, as such:
Code:

dd if=dump1.img of=/dev/sda4 bs=512 conv=noerror; dd if=dump2.img of=/dev/sda4 bs=512 conv=noerror
EDIT - This is just a rough example. It would have to be edited as needed.

It would need to be like this because using the wildcard, it would join them together as one large file.

extr 02-23-2012 11:57 PM

It looks like every image will be written to the same location.
How would dd command know where to jump without seek information.
Any other tricks?

Dark_Helmet 02-24-2012 12:27 AM

What is in each image? Is each image a partition (i.e. created with something like "dd if=/dev/sda2") or is it a full disk image (i.e. "dd if=/dev/sda")?

If they are partitions then do a loop:
1. mount each image one-at-a-time on a loopback file
2. copy the contents from the loopback device to the physical drive
3. unmount the loopback
4. go back to #1 until all images are done

I'm not sure how you would handle a full disk image. You would likely need to use some mount trickery or some other utility.

catkin 02-24-2012 12:32 AM

How about
Code:

cat dump*.img | dd of=/dev/sda4 bs=512 conv=notrunc,noerror


All times are GMT -5. The time now is 06:45 AM.