Linux copy and clone USB stick including partitions command

Originally published at: https://www.cyberciti.biz/faq/linux-copy-clone-usb-stick-including-partitions/

I need to copy and clone existing data from a USB stick. How do I clone a bootable USB key/pen drive on Linux? How do I clone a USB stick including partitions on Linux operating system?

I worry this is a very dangerous operation, as I found out the hard way the 32GB is not always 32GB. I was using this to make copies of a microSD card, with the purpose of being bootable. But the number of 512k blocks was subtle in a small way. The result was massive headeaches. If you clone from a “big” one to a ‘lttle’ one, no problem.
So I don’t know if the classic USB stick is any different, i see no reason why… The process of creating them probably has a small number of defects, and the firmware them masks them out? That way you’re always getting a different number of blockcount?

1 Like

Hi, i found in the blog/post an error in the line:
To clone a usb stick named /dev/sdb to ~/usb-opensuse-current.img, run:
$ sudo dd if=/dev/sdv ~/usb-opensuse-current.img bs=4M

it should be:
To clone a usb stick named /dev/sdb to ~/usb-opensuse-current.img, run:
$ sudo dd if=/dev/sdv of=~/usb-opensuse-current.img bs=4M

1 Like

@Peter_Soulfly Thanks for the heads up!