wiki:RestoreUSBStickImage
Last modified 11 months ago Last modified on 29.01.2018 16:05:36

Restore an Image onto a USB Flash Drive

First, download the image in question. For example, images for the RCLL Sim Stick. For the remainder of the document, we will assume the filename of the image is file.img.xz, change as necessary. Note that the instructions will slightly vary if a compression other than xz is used.

Make sure the USB stick has at least the size of the original one.

Graphical Restore

On Linux, we recommend to use the Gnome Disks tool (often simply called "Disks" in the application menu). Once opened, select the USB flash drive in the list on the left. Then click the Hamburger-Icon on the top right and select "Restore Disk Image". Select the image file and start to restore.

On Windows, you may want to thave a look at Etcher. Choose the image and USB flash drive and start writing.

Text Restore

To restore on the command line in Linux, use the following command. Replace /dev/sdc with the actual device file to your USB flash drive. Use dmesg to find what that is.

Make sure to use the proper device or you might kill data on your own machine!

  xzcat file.img.xz | sudo dd of=/dev/sdc

To get information about the progress, you may want to use pipeview (Fedora: sudo dnf install pv, Ubuntu: sudo apt-get install pv).

  pv -pbrta file.img.xz | xz -dc | sudo dd of=/dev/sdc

If you have a gzip image restore it with:

  pv -pbrta file.img.gz | gunzip -c | sudo dd of=/dev/sdc

Fix GPT Partition Table

GPT expects the backup partition table to be at the end of the device. However, we deliberately truncate the file to make it fit to slightly differently sized thumb drives. Therefore, we need to fix the partition table after restore.

  sudo gdisk /dev/sdc

Then issue the command w, followed by confirming twice with y.