Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Using 'dd' to clone a USB drive


resized the destination partition to be of same size

made the partition bootable

same 'type' ext3

ran 'mkfs.ext3' after exit cfdisk


dd if=dev/sda1 of=/dev/sdb1

result booting: Missing operating system.

The source USB device boots on multiple laptops

USB destination filesystem looks the same....

Any idears?

share|improve this question
Why are you gooing through all the effort to setup partitions and filesystems? Just copy the entire disk. dd if=/dev/sda of=/dev/sdb –  Zoredache May 12 '10 at 21:16
You are probably right, but this is the result...the 2nd USB is slightly smaller in size dd if=/dev/sda of=/dev/sdb dd: writing to `/dev/sdb': No space left on device 15654849+0 records in 15654848+0 records out 8015282176 bytes (8.0 GB) copied, 3430.66 s, 2.3 MB/s –  MentalBlister May 12 '10 at 23:47
then you have to first resize the partition on the originating drive soi that it won't end after the end of the device after clone, after that it's just simple dd if=/dev/sda of=/dev/sdb bs=8192 and ignoring the error –  Hubert Kario Jan 18 '13 at 11:48

3 Answers 3

You copied the partition, but not the MBR. Copy the first 446 bytes of the device itself.

share|improve this answer
Is this correct? dd if=/dev/sda of=/dev/sdb bs=512 count=1 –  MentalBlister May 12 '10 at 22:25
No, that will wipe the partition table as well. And I'm not psychic, so I don't know if those are the correct devices. You're definitely on the right track though. –  Ignacio Vazquez-Abrams May 12 '10 at 22:38
Everything past byte 440 is unique to the drive and should not be copied. And I speak not only from experience... en.wikipedia.org/wiki/Master_boot_record –  Ignacio Vazquez-Abrams May 12 '10 at 23:44
As the story goes....did dd if=/dev/sda of=/dev/sdb bs=512 count=1, tried booting from it...All I got was 'GRUB' So then tried example from first comment of Zoredache above: result --> cfdisk /dev/sdb "FATAL ERROR Bad primary partition 1: Partition ends after end-of-disk Press any key to exit cfdisk back to my Pretty good friend Google. –  MentalBlister May 12 '10 at 23:54
'should not' be copied? you're cloning the thumb drive, i've done similar things in the past, and granted it's been a long time, but i don't seem to remember any issues of two thumb drives sharing the same MBR, bit for bit. MentalBlister: DROP THE count=1 you're only copying the first 512 bytes with count=1 get rid of the count parameter completely. –  cpbills May 13 '10 at 0:38

If the drives are the same size, why not just clone the entire drive?

dd if=/dev/sda of=/dev/sdb bs=(whatever) count=(whatever)

I've used this to clone HP ThinState configuration disks for HP thin clients that "don't work" with devices over 2GB - so long as I have a small enough drive to use as a master, I can clone it onto e.g. a 4GB drive and the thin client will happily boot from it.

Edit: Reading the above on "unique" IDs in/near the MBR, I don't see a problem with cloning an identical device if it's truly a clone - as long as you don't try to copy things between the two.

share|improve this answer
The devices are not the same, though they are supposed to be the same size 8 GB. –  MentalBlister May 13 '10 at 3:34
Use the smaller of the two as the master and the unfilled space won't matter. Using the larger of the two as the master... could have problems. –  Andrew May 17 '10 at 2:46

You can use sfdisk to backup the partition table, then copy th boot sector (first block). Then restore the partition table with sfdisk. If you are using a DOS MBR, then the mbr program will write the MBR code onto the USB for you.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.