Backup
From Openmoko
Catholicon (Talk | contribs) m (failed rootfs backup can be mounted and read) |
(Tidy up instructions, add note on USB hub, add backup script) |
||
Line 21: | Line 21: | ||
You will need the [[Dfu-util]] to make a backup of your existing image. | You will need the [[Dfu-util]] to make a backup of your existing image. | ||
− | As when [[Flashing_the_Neo_FreeRunner|flashing]], you will need to be in [[Booting_the_Neo_FreeRunner#Log_into_U-Boot_in_the_NOR_Flash|U-Boot in the NOR Flash]]. Log into the NOR uBoot menu and select ''Set console to USB'' (for NRF just stay in NOR uBoot menu, do not select or enter anything). Now you will be able to flash, make backups of your Freerunner or query the Freerunner with [[Dfu-util|dfu-util]]. | + | As when [[Flashing_the_Neo_FreeRunner|flashing]], you will need to be in [[Booting_the_Neo_FreeRunner#Log_into_U-Boot_in_the_NOR_Flash|U-Boot in the NOR Flash]]. Log into the NOR uBoot menu and select ''Set console to USB'' (for NRF just stay in NOR uBoot menu, do not select or enter anything). Now you will be able to flash, make backups of your Freerunner or query the Freerunner with [[Dfu-util|dfu-util]]. Backup is fairly slow; it took over ten minutes to back up a 247 MB rootfs. |
+ | |||
+ | It is important that you connect the USB cable directly from your computer to your phone. If there is a hub between them, backup (and flashing) will mostly likely fail. | ||
{{note|On a Windows host, omit the "./" or "sudo ./" that precedes the commands listed on this page}} | {{note|On a Windows host, omit the "./" or "sudo ./" that precedes the commands listed on this page}} | ||
− | |||
− | |||
<pre> | <pre> | ||
− | ./dfu-util -a kernel -R -U good-kernel.bin | + | sudo ./dfu-util -a kernel -R -U good-kernel.bin |
− | ./dfu-util -a rootfs -R -U good-rootfs.jffs2 | + | sudo ./dfu-util -a rootfs -R -U good-rootfs.jffs2 |
− | ./dfu-util -a | + | sudo ./dfu-util -a splash -R -U good-splash.bin |
− | ./dfu-util -a | + | sudo ./dfu-util -a u-boot -R -U good-u-boot.bin |
− | ./dfu-util -a u- | + | sudo ./dfu-util -a u-boot_env -R -U good-u-boot_env.bin |
− | + | ||
</pre> | </pre> | ||
− | Here is what | + | Here is what a successful dfu-util backup run looks like: |
on the host PC: | on the host PC: | ||
Line 53: | Line 52: | ||
Claiming USB DFU Interface... | Claiming USB DFU Interface... | ||
Setting Alternate Setting ... | Setting Alternate Setting ... | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Determining device status: state = dfuIDLE, status = 0 | Determining device status: state = dfuIDLE, status = 0 | ||
dfuIDLE, continuing | dfuIDLE, continuing | ||
Line 72: | Line 57: | ||
Resetting USB to switch back to runtime mode | Resetting USB to switch back to runtime mode | ||
</pre> | </pre> | ||
− | |||
− | |||
on the FreeRunner: | on the FreeRunner: | ||
Line 80: | Line 63: | ||
DEVICE_CONFIGURED: 1 | DEVICE_CONFIGURED: 1 | ||
Starting DFU Upload of partition 'kernel' | Starting DFU Upload of partition 'kernel' | ||
− | |||
− | |||
</pre> | </pre> | ||
− | + | If you plan on backing up frequently, this script will simplify the process: | |
+ | |||
+ | <pre> | ||
+ | #!/bin/sh | ||
+ | # | ||
+ | # Back up all partitions of the phone to a backup directory, | ||
+ | # adding today's date to the saved filenames. | ||
+ | |||
+ | DATE=`date +%Y-%m-%d` | ||
+ | DFU=./dfu-util | ||
+ | BACKUP_DIR=bak/ | ||
+ | |||
+ | ${DFU} -a kernel -R -U ${BACKUP_DIR}kernel-${DATE}.bin | ||
+ | ${DFU} -a rootfs -R -U ${BACKUP_DIR}rootfs-${DATE}.jffs2 | ||
+ | ${DFU} -a splash -R -U ${BACKUP_DIR}splash-${DATE}.bin | ||
+ | ${DFU} -a u-boot -R -U ${BACKUP_DIR}u-boot-${DATE}.bin | ||
+ | ${DFU} -a u-boot_env -R -U ${BACKUP_DIR}u-boot_env-${DATE}.bin | ||
+ | </pre> | ||
+ | |||
+ | A failed run of dfu-util looks like this: | ||
+ | |||
dfu-util - (C) 2007 by OpenMoko Inc. | dfu-util - (C) 2007 by OpenMoko Inc. | ||
This program is Free Software and has ABSOLUTELY NO WARRANTY | This program is Free Software and has ABSOLUTELY NO WARRANTY | ||
Line 102: | Line 103: | ||
dfu_upload error -110 | dfu_upload error -110 | ||
− | + | And shows errors demsg like this: | |
− | + | ||
− | + | ||
usb 5-2: usbfs: USBDEVFS_CONTROL failed cmd dfu-util rqt 161 rq 2 len 4096 ret -110 | usb 5-2: usbfs: USBDEVFS_CONTROL failed cmd dfu-util rqt 161 rq 2 len 4096 ret -110 | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
[[category:Guides]] | [[category:Guides]] | ||
[[category:Technical]] | [[category:Technical]] |
Revision as of 03:17, 9 August 2008
Backing up just /home/root
To backup the home folder (all your files personal files in theory).
From the desktop pc run:
ssh root@phone 'tar -cpz /home/root' > moko-home-`date +%Y%m%d-%H%M%S`.tar.gz
Where phone is the ip address of your phone (192.168.0.202).
Personally I added an entry to /etc/hosts so the above works for me. I also added the desktop key to /home/root.ssh/authorized_keys on the phone as per the instructions in USB_Networking#SSH_Keys.
If you want to check what is in the backup, run the following, replacing the filename with what was just created.
tar -tzf moko-home-20080802-203108.tar.gz | less
Backing up everything
You will need the Dfu-util to make a backup of your existing image.
As when flashing, you will need to be in U-Boot in the NOR Flash. Log into the NOR uBoot menu and select Set console to USB (for NRF just stay in NOR uBoot menu, do not select or enter anything). Now you will be able to flash, make backups of your Freerunner or query the Freerunner with dfu-util. Backup is fairly slow; it took over ten minutes to back up a 247 MB rootfs.
It is important that you connect the USB cable directly from your computer to your phone. If there is a hub between them, backup (and flashing) will mostly likely fail.
NOTE: On a Windows host, omit the "./" or "sudo ./" that precedes the commands listed on this page |
sudo ./dfu-util -a kernel -R -U good-kernel.bin sudo ./dfu-util -a rootfs -R -U good-rootfs.jffs2 sudo ./dfu-util -a splash -R -U good-splash.bin sudo ./dfu-util -a u-boot -R -U good-u-boot.bin sudo ./dfu-util -a u-boot_env -R -U good-u-boot_env.bin
Here is what a successful dfu-util backup run looks like:
on the host PC:
$ sudo ./dfu-util -a kernel -R -U good-kernel.img dfu-util - (C) 2007 by OpenMoko Inc. This program is Free Software and has ABSOLUTELY NO WARRANTY Opening USB Device 0x0000:0x0000... Claiming USB DFU Runtime Interface... Determining device status: state = appIDLE, status = 0 Device really in Runtime Mode, send DFU detach request... Resetting USB... Opening USB Device... Found Runtime: [0x1d50:0x5119] devnum=12, cfg=0, intf=0, alt=3, name="kernel" Claiming USB DFU Interface... Setting Alternate Setting ... Determining device status: state = dfuIDLE, status = 0 dfuIDLE, continuing Transfer Size = 0x1000 Resetting USB to switch back to runtime mode
on the FreeRunner:
DFU: Switching to DFU Mode DEVICE_CONFIGURED: 1 Starting DFU Upload of partition 'kernel'
If you plan on backing up frequently, this script will simplify the process:
#!/bin/sh # # Back up all partitions of the phone to a backup directory, # adding today's date to the saved filenames. DATE=`date +%Y-%m-%d` DFU=./dfu-util BACKUP_DIR=bak/ ${DFU} -a kernel -R -U ${BACKUP_DIR}kernel-${DATE}.bin ${DFU} -a rootfs -R -U ${BACKUP_DIR}rootfs-${DATE}.jffs2 ${DFU} -a splash -R -U ${BACKUP_DIR}splash-${DATE}.bin ${DFU} -a u-boot -R -U ${BACKUP_DIR}u-boot-${DATE}.bin ${DFU} -a u-boot_env -R -U ${BACKUP_DIR}u-boot_env-${DATE}.bin
A failed run of dfu-util looks like this:
dfu-util - (C) 2007 by OpenMoko Inc. This program is Free Software and has ABSOLUTELY NO WARRANTY Opening USB Device 0x0000:0x0000... Claiming USB DFU Runtime Interface... Determining device status: state = appIDLE, status = 0 Device really in Runtime Mode, send DFU detach request... Resetting USB... Opening USB Device... Found Runtime: [0x1d50:0x5119] devnum=20, cfg=0, intf=0, alt=6, name="rootfs" Claiming USB DFU Interface... Setting Alternate Setting ... Determining device status: state = dfuIDLE, status = 0 dfuIDLE, continuing Transfer Size = 0x1000 dfu_upload error -110
And shows errors demsg like this:
usb 5-2: usbfs: USBDEVFS_CONTROL failed cmd dfu-util rqt 161 rq 2 len 4096 ret -110