Depending on how large the USB sticks are this might take a while because you are copying and then writing out a lot of empty space.
There is a better way todo this using a bmap tools, which only writes used blocks in a disk image.
There are a number of tools that I use here which are packaged for Ubuntu / Debian but not installed by default to install them run
sudo apt-get install bmap-tools libguestfs-tools pigz
First you need to create the source image:
sudo dd if=/dev/source of=/path/to/source.img bs=1M
Sparsifying the image
Next you need to remove all the zero's from the image to make a sparse file:
cp --sparse=always /path/to/source.img /path/to/source.img.sparse
You might have noticed that this makes a copy of the image and takes up more space, fortunately we can use cp in a pipe:
sudo dd if=/dev/source bs=1M | cp --sparse=always /dev/stdin /path/to/source.img.sparse
bmap-tools
Now we need to produce some metadata about how the image file is laid out using bmaptool:
bmaptool create -o /path/to/source.img.bmap /path/to/source.img.sparse
Should you want to you can now compress the image file, bmaptool will automatically uncompress the image file. pigz is a parallel gzip compression tool.
pigz /path/to/source.img.sparse
To write the file out to a blank USB stick you can now do:
sudo bmaptool copy --bmap /path/to/source.img.bmap /path/to/source.img.sparse.gz /dev/sdX
https://source.tizen.org/documentation/reference/bmaptool
Guestfish
If you are feeling extra clever you can also use tools from the guestfish project to clean up the linux image before you clone it. This removes things like logfiles, server ssh keys etc.
Run these commands before you compress the image to clean up the image.
This command cleans up the image, removing logs, history files, ssh server keys etc
virt-sysprep -a /path/to/source.img.sparse
This command sets up ssh with new server keys on the first boot.
virt-customize --firstboot-command "dpkg-reconfigure openssh-server" /path/to/source.img.sparse
This command runs an fstrim on the image which deletes all unused blocks from the filesystem, just like trimming an SSD.
virt-sparsify --inplace /path/to/source.img.sparse
http://libguestfs.org/
dd
command is enough.sudo dd if=oldUSB of=newUSB
will suffice to copy all the partition tables, boot loader etc?