shabtek said:
Thanks Monte. I am not a computer person-- I tried dd before i asked here--but was unsure about what I am doing.
What you said about copy the whole thing makes sense.
Do I need to format or partition the destination or does dd take care of that?
The beauty is that you're copying the device block by block, so however it's formatted or partitioned, whatever's in the boot block, all of that, will be copied faithfully by dd. This is why dd is nice - it deals with the source and destination disk as raw blocks, completely uninterpreted, and thus makes a completely faithful copy. You could copy a linux filesystem for that matter - none of this matters.
I’m going into huge detail here, but you need to know what’s going on sufficiently, or else you can do some serious damage with dd.
You're on a Mac, so Disk Utility can help you to identify the devices and see how large they are in their raw state. I'm using El Capitan, so what I write is relative to that, but dd hasn’t changed for decades, and Disk Utility is probably consistent over a number of MacOS versions. I’ll try to condense this, so here we go.
Plug in the source flash drive that you want to copy and then open Disk Utility. On the left side of the Disk Utility window, you’ll see a hierarchical listing of all of the drives in your system, and the partitions from each that the OS has found. The topmost will probably be your boot drive and its partitions (aka volumes), and somewhere below will be your flash device. If the Mac has decided to mount partitions from the flash drive, they will appear below the raw flash device. If any partitions appear below the raw flash device, click on the partition and then press the ‘unmount’ button at the top of the Disk Utility window. Do this for all of the flash partitions so that only the raw flash device is mounted.
Then, click on the raw flash device and press the ‘Info’ button, next to the ‘Unmount’ button. This will bring up a window with a lot of information in it. What you want is the ‘BSD device node’, which will be something like disk2 or something like that.
If you can attach both flash devices at once, don’t remove the source flash, and then plug in the destination flash and see what address it comes up with in the same way. Then, you can copy directly from one device to the other.
Let’s say the source flash is disk2 and the destination flash is disk4. The command you want is:
dd if=/dev/disk2 of=/dev/disk4
That’s it. This assumes a blocksize of 512 bytes, but even if that’s not the case, it won’t matter. It might take longer, but maybe not.
If you can’t have both flash drives on your machine at once, then you need to copy to a file and then copy the file to a drive. This is the command to read the source flash to a file:
dd if=/dev/disk2 of=./flash-contents
This makes a file ‘flash-contents’ in your home directory with the device contents. It’s not a .dmg file, it’s just a file. Delete it after the copy is done.
When that finishes, remove the flash drive and plug in the destination. If the destination device is formatted and the OS mounts volumes, do the unmount thing using Disk Utility and the Info button thing as before. Then use this command, assuming that the destination flash also comes up as disk2:
dd if=./flash-contents of=/dev/disk2
The only gotcha is that the destination flash must be the same size (or greater) than than the source flash drive. Flash media that is ‘8GB’ for example is not actually 8GB, and among all things labeled ‘8GB’ they may be off by a few blocks or more from other ‘8GB’ media. Buy two of exactly the same media, or just verify in Disk Utility with the Info button to make sure that the ‘Volume Capacity’ of the destination is as big or larger than that of the source. You could also just buy a larger size destination - e.g. a 16GB flash to copy an 8GB flash. The extra at the end will just sit there, inaccessible until you reformat the flash.
In theory, every block from the source device will get copied to the destination, and they will appear to be the same drives, with the same formatted capacity, partitioning etc. A block for block clone.