Backup: Difference between revisions

From OLPC
Jump to navigation Jump to search
(→‎What you will need (besides an XO laptop): . Added information about the developer key folder path)
m (→‎What you will need (besides an XO laptop): it's USB flash drive, not "memory device" or "stick")
Line 5: Line 5:
=== What you will need (besides an XO laptop) ===
=== What you will need (besides an XO laptop) ===


* a 1 GB (or larger) USB flash memory device (priced under Cdn$10 per GB as of Sep-2008)
* a 1 GB (or larger) USB flash drive
* a [[Developer key#Getting a Developer Key for your Running XO Laptop|Developer Key]] (software access code) that lets you use OpenFirmware (OFW). '''and you can save it in <tt>security/develop.sig</tt> on the USB stick'''.
* a [[Developer key#Getting a Developer Key for your Running XO Laptop|Developer Key]] (software access code) that lets you use OpenFirmware (OFW). '''and you can save it in <tt>security/develop.sig</tt> on the USB flash drive'''.
* 10 minutes to 3 hours (depending on your luck and skill)
* 10 minutes to 3 hours (depending on your luck and skill)



Revision as of 07:00, 30 September 2008

This page is for XO users who want to 'backup' the entire storage memory state of their OLPC XO, that is, the internal 1 GB NAND flash memory, so that they can do a later 'restore' if needed to recover from a software disaster. Backup and restore are also useful for development testing of different software builds.

This backup technique uses the 'save-nand' command in OpenFirmware. If you know of alternate techniques, please write them into this wiki.

What you will need (besides an XO laptop)

  • a 1 GB (or larger) USB flash drive
  • a Developer Key (software access code) that lets you use OpenFirmware (OFW). and you can save it in security/develop.sig on the USB flash drive.
  • 10 minutes to 3 hours (depending on your luck and skill)

To backup your XO

Some of these steps are optional, included to boost reliability and confidence. Press the (enter) key after typing commands at the 'ok' prompt.

  1. Ensure the USB memory device is formatted as FAT or FAT32 or VFAT. Factory-formatted devices are apparently preferred or least troublesome.
  2. Ensure there is at least 1 GB (1024 MB) of free space available on the USB memory device.
  3. Insert your USB memory device into one of the USB ports on the XO.
  4. Start or restart your XO, while holding down the (X) Escape key at upper-left of the keyboard. This should get you to the OpenFirmware 'ok' prompt. (This won't work if you don't have the developer key)
  5. (optional) At the OFW 'ok' prompt, type: probe-usb
  6. (optional) Ensure your USB device shows up as a USB2 device. USB1 is too slow. (Compare the output of probe-usb with and without the USB memory plugged in.)
  7. (optional) Type: disk-free u: to see if there is enough free space. A full NAND requires 1 GB space on the USB device. A half-full NAND requires about 500 MB. You can estimate that amount of space you need by typing scan-nand and looking at the relative percentage of green (used) vs. blue (unused) squares. If you need to free up some space, you can delete files from OFW with, for example, rm u:\myfile.xyz. You can also use wildcards, as in rm u:\*.img
  8. Type: save-nand u:\backup.img
    (The filename 'backup.img' may be something else such as 'my759bak.img'; use a short 8.3 format filename, and stay with the .img extension.)
  9. Wait anywhere from a few minutes to a few hours as the XO copies its internal NAND flash memory contents over to the USB memory device. The displayed hexadecimal block count will count from 0 to 1FFF, at a varying speed, then OFW will report 'Done' and report the name of a CRC file such as 'backup.crc'.
  10. Type: dir u: (if you wish to see the final contents of USB memory).
  11. Remove the USB memory device. Your backup is now complete.
  12. You may copy the two files 'backup.img' and 'backup.crc' from the USB memory onto some other media, such as a Windows PC, for redundant backup or to free your USB memory device for other uses. Always keep the two files together.

To restore your XO

  1. Start or restart your XO, while holding down the (X) Escape key at upper-left of the keyboard. This should get you to the OpenFirmware 'ok' prompt.
  2. Insert your USB memory device into one of the USB ports on the XO.
  3. At the OFW 'ok' prompt, type: probe-usb
  4. Ensure your USB device shows up as a USB2 device. USB1 is too slow.
  5. Type: dir u:
  6. Verify that your desired '.img' and '.crc' files are there.
  7. Type: copy-nand u:\backup.img
  8. Wait til done, then remove the USB memory device, then restart your XO!

Notes

This procedure becomes easy after you have done it 3 times.

Some brands of USB memory work better than others. Backups in the 10-minute range for half-full XO's are achievable. If save-nand is too slow, then try a different brand of USB memory. Default factory-formatted USB memories are reported to work better than devices that have been reformatted, for example by a Windows PC. If you have a USB memory device that is working well with your XO, try to avoid ever reformatting it; delete files using file delete commands rather than device format commands. FAT filesystems with large cluster sizes (like 16 KiB) are particularly efficient for this purpose. (Don't use ext2 filesystems if your OFW version is Q2E15 or earlier; the OFW write support for ext2 in those versions is buggy and inefficient.)

There are variations possible, for example using an SD flash memory device (use sd: instead of u: for the OFW commands). But a USB memory device will generally be more convenient.

Accessing individual files from a backup.img file generally requires you to restore the entire backup to your XO. But perhaps there is some utility software that can access individual files from an .img file (does anyone know?).

OpenFirmware is designed to be simple, reliable, and powerful, but not idiot-proof. Using the recipe given above will usually work well. Deviations could make trouble or confusion unless you know what you are doing. You have been warned!