Clone a bootable usb key

Written by
Date: 2013-01-15 10:50:13 00:00

If you have a bootable usb key, or a ssd bootable memory, that you want to store for backup purposes, or you want to clone to another usb media or ssd disk, follow this guide.

First be sure to know where your media is located by Linux or Mac. I use df instead of fdisk, because it is easier.

First run df with the usb key not inserted, you will see something like this:

Filesystem                        512-blocks      Used Available Capacity  Mounted on
/dev/disk0s2                       623463232 358680744 264270488    58%    /
devfs                                    367       367         0   100%    /dev
map -hosts                                 0         0         0   100%    /net
map auto_home                              0         0         0   100%    /home
localhost:/C62iTGV_5XeelNQUPuE2no  623463232 623463232         0   100%    /Volumes/MobileBackups

Then insert the key and run df again:

df

You will now see this:

Filesystem                        512-blocks      Used Available Capacity  Mounted on
/dev/disk0s2                       623463232 358727728 264223504    58%    /
devfs                                    371       371         0   100%    /dev
map -hosts                                 0         0         0   100%    /net
map auto_home                              0         0         0   100%    /home
localhost:/C62iTGV_5XeelNQUPuE2no  623463232 623463232         0   100%    /Volumes/MobileBackups
/dev/disk1s1                        31250400    614240  30636160     2%    /Volumes/NO NAME

As you can see there a new device at /dev/disk1s1. That is on my Mac, on Linux is very similar:

With no usb inserted:

Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/sda2      201585632 29185432 162160200  16% /
udev              981796       12    981784   1% /dev
tmpfs             396400      832    395568   1% /run
none                5120        0      5120   0% /run/lock
none              990996      980    990016   1% /run/shm
none              102400       20    102380   1% /run/user

With the usb key inserted:

Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/sda2      201585632 29185452 162160180  16% /
udev              981796       12    981784   1% /dev
tmpfs             396400      844    395556   1% /run
none                5120        0      5120   0% /run/lock
none              990996      980    990016   1% /run/shm
none              102400       20    102380   1% /run/user
/dev/sdc1       15625200   307216  15317984   2% /media/admin/389A-DA08

You can see the usb is located at /dev/sdc1.

Now to copy the contents of it to the hard disk run:

dd if=/dev/sdc of=/home/admin/backup-usb.dd conv=notrunc

To copy the image again to a usb disk

dd if=/home/admin/backup-usb.dd of=/dev/sdc conv=notrunc

Be sure that your usb key is again at /dev/sdc, and keep in mind that all contents of the usb key will be deleted