Backup: Difference between revisions

From OLPC
Jump to navigation Jump to search
No edit summary
 
(33 intermediate revisions by 6 users not shown)
Line 1: Line 1:
''In information technology, a backup or the process of backing up is making copies of data which may be used to restore the original after a data loss event.'' -- [http://en.wikipedia.org/wiki/Backup Wikipedia:Backup]
This page is intended 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.


Here we describe backup for the OLPC XO, from an individual standpoint. For school based backup solutions, refer to the School Server.
This backup technique uses the 'save-nand' command in OpenFirmware. If you know of alternate techniques, please write them into this wiki.


An XO internal storage contains:
=== What you will need (besides an XO laptop) ===
* your Sugar Journal,
* your GNOME files,
* the Sugar activities installed,
* the GNOME, Sugar and Linux operating system.


To backup and restore your Journal only, either drag and drop entries to a [[USB drive]], or use the Sugar [http://activities.sugarlabs.org/en-US/sugar/addon/4326 Backup] and [http://activities.sugarlabs.org/en-US/sugar/addon/4327 Restore] activities available from the [http://activities.sugarlabs.org/ Sugar Activity Library].
* a 1 GB (or larger) USB flash memory device (priced under Cdn$10 per GB as of Sep-2008)
* a [[Developer key#Getting a Developer Key for your Running XO Laptop|Developer Key]] (software access code) that lets you use OpenFirmware (OFW)
* 10 minutes to 3 hours (depending on your luck and skill)


=== To backup your XO ===
To backup and restore your GNOME files only, drag and drop to a USB drive.


To backup everything on the internal storage, use this page. This is called a full backup, or an image backup. By making a backup of everything on the XO, you can later restore to recover from a mistake or disaster. However, everything changed since the last full backup is lost.
Some of these steps are optional, included to boost reliability and confidence. Press the (enter) key after typing commands at the 'ok' prompt.


Backup is also useful for testing of different software builds; make a backup, test the other build, restore the backup.
# Ensure the USB memory device is formatted as FAT or FAT32 or VFAT. Factory-formatted devices are apparently preferred or least troublesome.
# Ensure there is at least 1 GB (1024 MB) of free space available on the USB memory device.
# 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.
# Insert your USB memory device into one of the USB ports on the XO.
# (optional) At the OFW 'ok' prompt, type: <tt>probe-usb</tt>
# (optional) Ensure your USB device shows up as a USB2 device. USB1 is too slow. (Compare the output of <tt>probe-usb</tt> with and without the USB memory plugged in.)
# (optional) Type: <tt>dir u:</tt>
# (optional) From bytes used, deduce that there is at least 1 GB of available free space.
# Type: <tt>save-nand u:backup.img</tt><br>(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.)
# 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'.
# Type: <tt>dir u:</tt> (if you wish to see the final contents of USB memory).
# Remove the USB memory device. Your backup is now complete.
# 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.


Backup is not an easy method for cloning, because there are unwelcome [[Imaging/Side_effects|side effects]] of restoring a backup on another laptop.
=== To restore your XO ===


Backup is not an easy method for reversion to as-installed state, because it is so slow compared to the alternatives. See [[Tiny_Core_Linux/Reversion|Reversion]].
# 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.
# Insert your USB memory device into one of the USB ports on the XO.
# At the OFW 'ok' prompt, type: <tt>probe-usb</tt>
# Ensure your USB device shows up as a USB2 device. USB1 is too slow.
# Type: <tt>dir u:</tt>
# Verify that your desired '.img' and '.crc' files are there.
# Type: <tt>copy-nand u:backup.img</tt>
# Wait til done, then remove the USB memory device, then restart your XO!


XO internal storage has changed over time, to keep costs down. There are sections below depending on what model of XO you have:
=== Notes ===


* [[#XO_1|XO-1]],
This procedure becomes easy after you have done it 3 times.
* [[#XO-1.5.2C_XO-1.75_and_XO-4XO_1.5|XO-1.5, XO-1.75 and XO-4]].


= XO-1 =
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. Ext2 filesystems with small filesystem block sizes are particularly inefficient. Also, OFW releases Q2E15 and earlier have bugs in the ext2 write support, so expect problems and slow operation if you use ext2.


== Ingredients ==
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.


You will need:
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?).
* an unsecured XO-1 laptop to be backed up, (if your laptop is secured, get a [[Developer key]] and disable security),
* a [[USB drive]] with at least 1GB free space,
* from 10 minutes to 3 hours.


== Recipe - Backup ==
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!

To make an image backup:

* [[Upgrading_firmware|Upgrade the firmware]], for the best USB support,
* Ensure the USB drive is formatted as FAT or FAT32. Factory-formatted devices are least troublesome.
* Ensure there is at least 1 GB of free space available on the USB drive.
* Insert your USB drive into one of the USB ports on the XO.
* Start your XO, and get to the [[Ok]] prompt, then type:
save-nand u:\backup.img
* Wait anywhere from a few minutes to a few hours as the XO copies its internal storage over to the USB drive. A graphical display of blocks will be shown, with the current block indicated. Below the blocks is a hexadecimal block count, which will count from 0 to no more than 1FFF, at a varying speed. When finished it will report 'Done' and report the name of a CRC file such as 'backup.crc'.
* Remove the USB drive. Your backup is now complete.
* You may copy the two files 'backup.img' and 'backup.crc' from the USB drive onto some other media, such as another computer, for redundant backup or to free your USB drive for other uses. Always keep the two files together.

== Recipe - Restore ==

Warning: restoring a full backup erases everything that is on the XO, restoring it to the state it had when the full backup was made.

* Insert your USB drive into one of the USB ports on the XO.
* Start your XO, and get to the [[Ok]] prompt, then type:
copy-nand u:\backup.img
* Wait until done, then remove the USB drive, then restart your XO!

== Notes ==

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

Some USB drives work better than others. USB hard drives are the best. USB flash drives vary considerably, across brands and based on age. Backups in the 10-minute range for half-full XO's are achievable. If save-nand is too slow, then try a different USB drive. Default factory-formatted USB flash drives are reported to work better than devices that have been reformatted. If you have a USB flash drive 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.

There are variations possible, for example using an SD card (use sd: instead of u: for the OFW commands). But a USB drive is usually more convenient.

Accessing individual files from a backup.img file generally requires you to restore the entire backup to your XO. Albeit complicated, you could also access individual files using the procedure described on the [[Image forensics]] page, to mount your image and recover individual files.

Open Firmware 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!

== Timings ==

Made with Q2F05.

* USB hard drive, ''save-nand'', 177sec,
* USB hard drive, ''copy-nand'', 245sec,

== Another approach ==
You can boot a different [[:Category:Linux distributions|Linux distribution]] from a USB drive, mount the XO-1's NAND file system, then use a backup utility such as the '''tar''' command to back up its files.

This is similar to what the xo-backup command in the XO version of [[Tiny Core Linux]] does, and this is described in the next section.

= XO-1.5, XO-1.75 and XO-4 =

An image backup and restore can be done using the [[Firmware/Storage|fs-save and fs-load commands]] but these are very slow.

The [[Tiny_Core_Linux|Tiny Core Linux build]] contains three scripts for backup and restore. These are described below.

== Ingredients ==

You will need:
* an unsecured laptop to be backed up, (if your laptop is secured, get a [[Developer key]] and disable security),
* a [[USB drive]] with enough free space for the backup,
* from 10 minutes to 1 hour.

== Prepare USB drive ==

*select a USB drive of at least 128 MB, which will contain Tiny Core Linux,
*[[Tiny_Core_Linux|download and install Tiny Core Linux]] on the USB drive,

== Shutdown ==

[[Shutdown]] the laptop in the usual way. This is so that it can be booted from the USB drive.

== Start Tiny Core Linux ==

*insert the USB drive into the laptop,
*start the laptop, you will see a white screen, then a black screen with a penguin, then a prompt;
root@box:~#
At this point you may remove the USB drive if you do not need it for the next step.

== Backup ==

*insert a USB drive of at least 4 GB capacity, (the backup should not be larger than the size of the internal storage, which in most cases is 4 GB, but may be as small as 1.4 GB if there is very little added content or activities on the laptop),
*start the backup by typing ''xo-backup'' then press enter;
root@box:~# xo-backup
ok
root@box:~#
*when the ''ok'' is displayed, it means the backup has completed properly.

It usually takes ten minutes for a USB flash drive, and five minutes for a USB hard drive. It will take longer if you have added activities, downloads or documents to the laptop.

Remove the USB drive, and look at it with another computer; the backup is in a file ''xo.tar''. You may wish to copy it to other media for safekeeping. Also copy Tiny Core Linux and these instructions, since you may need both to restore.

== Restore ==

'''WARNING: this destroys all data on the internal storage.'''

*either leave the USB drive in place, or insert another USB drive instead, one with an ''xo.tar'' file on it from the backup step above,
*start the restore by typing ''xo-restore'' then press enter;
root@box:~# xo-restore
ok
root@box:~#
*when the ''ok'' is displayed, it means the restore has completed properly.

It usually takes between 22 and 40 minutes to restore, depending on the size of the backup, and the speed of the internal storage, which is usually much slower at writing than reading.

== Repartition and Restore ==

'''WARNING: this destroys all data on the internal storage.'''

This creates the partition table again on the internal storage. This should only be necessary if the partition table on the internal storage is incorrect. Do this before ''xo-restore''. Like so:
root@box:~# xo-repart
ok
root@box:~# xo-restore
ok
root@box:~#

[[Category:Procedures]]
[[Category:HowTo]]
[[Category:OS]]

Latest revision as of 06:23, 20 August 2013

In information technology, a backup or the process of backing up is making copies of data which may be used to restore the original after a data loss event. -- Wikipedia:Backup

Here we describe backup for the OLPC XO, from an individual standpoint. For school based backup solutions, refer to the School Server.

An XO internal storage contains:

  • your Sugar Journal,
  • your GNOME files,
  • the Sugar activities installed,
  • the GNOME, Sugar and Linux operating system.

To backup and restore your Journal only, either drag and drop entries to a USB drive, or use the Sugar Backup and Restore activities available from the Sugar Activity Library.

To backup and restore your GNOME files only, drag and drop to a USB drive.

To backup everything on the internal storage, use this page. This is called a full backup, or an image backup. By making a backup of everything on the XO, you can later restore to recover from a mistake or disaster. However, everything changed since the last full backup is lost.

Backup is also useful for testing of different software builds; make a backup, test the other build, restore the backup.

Backup is not an easy method for cloning, because there are unwelcome side effects of restoring a backup on another laptop.

Backup is not an easy method for reversion to as-installed state, because it is so slow compared to the alternatives. See Reversion.

XO internal storage has changed over time, to keep costs down. There are sections below depending on what model of XO you have:

XO-1

Ingredients

You will need:

  • an unsecured XO-1 laptop to be backed up, (if your laptop is secured, get a Developer key and disable security),
  • a USB drive with at least 1GB free space,
  • from 10 minutes to 3 hours.

Recipe - Backup

To make an image backup:

  • Upgrade the firmware, for the best USB support,
  • Ensure the USB drive is formatted as FAT or FAT32. Factory-formatted devices are least troublesome.
  • Ensure there is at least 1 GB of free space available on the USB drive.
  • Insert your USB drive into one of the USB ports on the XO.
  • Start your XO, and get to the Ok prompt, then type:
save-nand  u:\backup.img
  • Wait anywhere from a few minutes to a few hours as the XO copies its internal storage over to the USB drive. A graphical display of blocks will be shown, with the current block indicated. Below the blocks is a hexadecimal block count, which will count from 0 to no more than 1FFF, at a varying speed. When finished it will report 'Done' and report the name of a CRC file such as 'backup.crc'.
  • Remove the USB drive. Your backup is now complete.
  • You may copy the two files 'backup.img' and 'backup.crc' from the USB drive onto some other media, such as another computer, for redundant backup or to free your USB drive for other uses. Always keep the two files together.

Recipe - Restore

Warning: restoring a full backup erases everything that is on the XO, restoring it to the state it had when the full backup was made.

  • Insert your USB drive into one of the USB ports on the XO.
  • Start your XO, and get to the Ok prompt, then type:
copy-nand u:\backup.img
  • Wait until done, then remove the USB drive, then restart your XO!

Notes

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

Some USB drives work better than others. USB hard drives are the best. USB flash drives vary considerably, across brands and based on age. Backups in the 10-minute range for half-full XO's are achievable. If save-nand is too slow, then try a different USB drive. Default factory-formatted USB flash drives are reported to work better than devices that have been reformatted. If you have a USB flash drive 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.

There are variations possible, for example using an SD card (use sd: instead of u: for the OFW commands). But a USB drive is usually more convenient.

Accessing individual files from a backup.img file generally requires you to restore the entire backup to your XO. Albeit complicated, you could also access individual files using the procedure described on the Image forensics page, to mount your image and recover individual files.

Open Firmware 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!

Timings

Made with Q2F05.

  • USB hard drive, save-nand, 177sec,
  • USB hard drive, copy-nand, 245sec,

Another approach

You can boot a different Linux distribution from a USB drive, mount the XO-1's NAND file system, then use a backup utility such as the tar command to back up its files.

This is similar to what the xo-backup command in the XO version of Tiny Core Linux does, and this is described in the next section.

XO-1.5, XO-1.75 and XO-4

An image backup and restore can be done using the fs-save and fs-load commands but these are very slow.

The Tiny Core Linux build contains three scripts for backup and restore. These are described below.

Ingredients

You will need:

  • an unsecured laptop to be backed up, (if your laptop is secured, get a Developer key and disable security),
  • a USB drive with enough free space for the backup,
  • from 10 minutes to 1 hour.

Prepare USB drive

Shutdown

Shutdown the laptop in the usual way. This is so that it can be booted from the USB drive.

Start Tiny Core Linux

  • insert the USB drive into the laptop,
  • start the laptop, you will see a white screen, then a black screen with a penguin, then a prompt;
root@box:~# 

At this point you may remove the USB drive if you do not need it for the next step.

Backup

  • insert a USB drive of at least 4 GB capacity, (the backup should not be larger than the size of the internal storage, which in most cases is 4 GB, but may be as small as 1.4 GB if there is very little added content or activities on the laptop),
  • start the backup by typing xo-backup then press enter;
root@box:~# xo-backup
ok
root@box:~# 
  • when the ok is displayed, it means the backup has completed properly.

It usually takes ten minutes for a USB flash drive, and five minutes for a USB hard drive. It will take longer if you have added activities, downloads or documents to the laptop.

Remove the USB drive, and look at it with another computer; the backup is in a file xo.tar. You may wish to copy it to other media for safekeeping. Also copy Tiny Core Linux and these instructions, since you may need both to restore.

Restore

WARNING: this destroys all data on the internal storage.

  • either leave the USB drive in place, or insert another USB drive instead, one with an xo.tar file on it from the backup step above,
  • start the restore by typing xo-restore then press enter;
root@box:~# xo-restore
ok
root@box:~# 
  • when the ok is displayed, it means the restore has completed properly.

It usually takes between 22 and 40 minutes to restore, depending on the size of the backup, and the speed of the internal storage, which is usually much slower at writing than reading.

Repartition and Restore

WARNING: this destroys all data on the internal storage.

This creates the partition table again on the internal storage. This should only be necessary if the partition table on the internal storage is incorrect. Do this before xo-restore. Like so:

root@box:~# xo-repart
ok
root@box:~# xo-restore
ok
root@box:~#