How to create bootable recovery USB Flash Drive

If you ever wanted to create bootable recovery USB Flash Drive then I have good news for you as it can be achieved in several simple steps using Clonezilla Live CD, external USB Hard Drive, and a target USB Flash Drive.

Beware. I assume that you have at least basic Linux knowledge.

Please take a note that this is not an ordinary backup solution as this procedure is geared towards an easy and automatic restoration process.

Step by step procedure

Step 1

Prepare USB Flash Drive, which needs to be bigger then expected backup size.

Depending on the used filesystem to boot USB Flash Drive will be used Grub (ext) or Syslinux (fat).

I will use ext2 filesystem but you are free to use whatever filesystem you want, within reason, of course.

Do not forget that you are not limited to one partition, so you can use hidden partition for quick restore purpose, and second regular partition which additional drivers or applications.

Step 2

Download and burn Clonezilla Live CD.

Check out the differences between i486, i686, and amd64 versions.

Step 3

Boot prepared Live CD.

Step 4

Select preferred graphics mode.

Step 5

Select language.

Language is not important here so you can safely stick with the default one.

Step 6

Select keymap.

Keyboard settings are not important here so you do not need to change anything.

Step 7

Start Clonezilla to perform backup.

Step 8

Select device to image mode.

Step 9

Select local device option as image will be stored on the external USB Hard Drive at first.

Step 10

Connect external USB Hard Drive to the target computer, wait couple of seconds and press Enter key.

Step 11

Select external USB Hard Drive. It will be used as intermediate backup storage before moving it to USB Flash Drive.

You will quickly notice that you do not need to use external USB Hard Drive but I will leave it you to discover.

Step 12

Select the top directory on the external USB Hard Drive that will be used to store backup image.

Step 13

You can use beginner or expert mode.

I suggest to use beginner mode if you use this utility for the first time, expert mode provides more detailed control over used parameters which can be useful when you want to choose compression method, skip checking NTFS integrity, or ignore bad blocks when reading source device.

Step 14

Select save local disk as an image.

Step 15

Provide a name for backup image.

Step 16

Select the source device - Hard Drive that will be backed up.

Step 17

Skip checking and repairing file systems on the source device.

This choice is up to you as it strongly depends on the used file systems.

Step 18

Decide if you want to check image integrity.

This process will take some time but you can later use chk-img-restorable action when using expert mode or execute ocs-chkimg command.

Step 19

You can note the command displayed on the screen as it reflects choices made in the previous steps.

$ ocs-sr -q2 -c -j2 -z1p -i 2000 -sc -p true savedisk notebook-backup sda

I will not elaborate on the used parameters as you can quickly read description and examples using ocs-sr --help command.

Step 20

Verify and confirm action before it is executed.

Step 21

Clonezilla will perform image creation.

Step 22

Exit to the command line after backup image is created.

Step 23

Connect the target USB Flash Drive.

I assume that it is recognized as the sdc device.

Step 24

To create bootable USB Flash Drive execute the following command.

$ ocs-live-dev -d /dev/sdc1 -t -g en_US.UTF-8 -k NONE -e "-g auto -e1 auto -e2 -r -j2 -p reboot restoredisk notebook-backup sdb" notebook-backup

Please take a note that USB Flash Drive will boot as the sda device, so the first Hard Drive will be sdb device, although you need to check this behavior.

Additional notes

You can add --batch parameter to perform fully automatic restore process.

$ ocs-live-dev -d /dev/sdc1 -t -g en_US.UTF-8 -k NONE -e "-batch -g auto -e1 auto -e2 -r -j2 -p reboot restoredisk notebook-backup sdb" notebook-backup

To modify startup menu you need to edit one of the following files (depending on the used boot loader): /boot/grub/menu.lst (Grub1), /EFI/boot/grub.cfg (Grub2), /syslinux/syslinux.cfg (Syslinux).

Clonezilla provides many more of interesting opportunities so I strongly encourage you to check it out.

Milosz Galazka's Picture

About Milosz Galazka

Milosz is a Linux Foundation Certified Engineer working for a successful Polish company as a system administrator and a long time supporter of Free Software Foundation and Debian operating system.

Gdansk, Poland