Backup Guide: Difference between revisions

From AsteroidOS
m (get rid of a leftover backslash)
(→‎Manual backup method: Add alternate debug ramdisk method)
 
(One intermediate revision by the same user not shown)
Line 10: Line 10:
#* Backup using SSH and <code>dd</code>
#* Backup using SSH and <code>dd</code>
#: Navigate to a folder where you want to store the backup. Or add a full path before the image name (after <code>of=</code>) in the next command.
#: Navigate to a folder where you want to store the backup. Or add a full path before the image name (after <code>of=</code>) in the next command.
#:    <code>ssh root@19#16##15 "dd if=/dev/mmcblk0" | dd "of=watch-backup.img" bs=4096 status=progress</code>
#:    <pre>ssh root@192.168.2.15 "dd if=/dev/mmcblk0" | dd "of=watch-backup.img" bs=4096 status=progress</pre>
#* Backup using ADB
#* Backup using ADB
#:    <code>adb pull /dev/mmcblk0 watch-backup.img</code>
#:    <pre>adb pull /dev/mmcblk0 watch-backup.img</pre>


The copy process might take up to an hour on watches with 8GB of storage.
The copy process might take up to an hour on watches with 8GB of storage.


Mind that taking multiple backups during runtime will result in different checksums. This is expected, because the live AsteroidOS system continuously writes to files, logs and other data on the block device while the dump is running.
If you want consistent backups, the debug ramdisk method may work on some watches. Boot the debug ramdisk with the following command (replace <code>zImage-dtb-dory.fastboot</code> with the correct image for your watch):
<pre>fastboot --cmdline debug-ramdisk boot zImage-dtb-dory.fastboot</pre>
The debug ramdisk is booted when the manufacturer logo is standing/hanging. You can then run the normal <code>adb pull /dev/mmcblk0 watch-backup.img</code> command and repeated dumps will have identical checksums.


= Scripted backup and restore=
= Scripted backup and restore=
Line 22: Line 29:
# Clone asteroid-hosttools
# Clone asteroid-hosttools
#: Clone the asteroid-hosttools using the following command:
#: Clone the asteroid-hosttools using the following command:
#: <code> git clone https://github.com/beroset/asteroid-hosttools </code>
#: <pre>git clone https://github.com/beroset/asteroid-hosttools</pre>
#: And change into the asteroid-hosttools directory:
#: And change into the asteroid-hosttools directory:
#:<code> cd asteroid-hosttools </code>
#:<pre>cd asteroid-hosttools</pre>
# Temporarily install AsteroidOS
# Temporarily install AsteroidOS
#: Adapt <code><watch-codename></code> in the following commands according to your watches codename listed on the [https://asteroidos.org/watches/ Watches page]. I.e <code>dory</code> for the LG G Watch or <code>sturgeon</code> for the Huawei Watch.
#: Adapt <code><watch-codename></code> in the following commands according to your watches codename listed on the [https://asteroidos.org/watches/ Watches page]. I.e <code>dory</code> for the LG G Watch or <code>sturgeon</code> for the Huawei Watch.
#:<code> ./flashy <watch-codename> --temp --nightly </code>
#:<pre>./flashy <watch-codename> --temp --nightly</pre>
# Backup the entire watch
# Backup the entire watch
#: Following command will create a file called <code>original-<watch-codename>.img</code>.
#: Following command will create a file called <code>original-<watch-codename>.img</code>.
#:<code> ./watch-image <watch-codename> --save </code>
#:<pre>./watch-image <watch-codename> --save</pre>
# Restore a backup
# Restore a backup
#: To restore the backup image created in step 3, make sure the <code>original-<watch-codename>.img</code> file exists.
#: To restore the backup image created in step 3, make sure the <code>original-<watch-codename>.img</code> file exists.
#:Then issue the restore command:
#:Then issue the restore command:
#: <code> ./watch-image <watch-codename> --restore </code>
#: <pre>./watch-image <watch-codename> --restore</pre>

Latest revision as of 23:34, 18 March 2026

Before flashing AsteroidOS to your watch to replace WearOS, we advise to make a complete backup.

Manual backup method

  1. Temporarily install AsteroidOS
    Follow the install instructions for a temporary installation. Once booted into AsteroidOS, we can enable SSH or ADB with root access to all partitions on the internal storage.
  2. Enable SSH or ADB
    Open the settings app and the USB page. Select SSH Mode to enable SSH. Or ADB Mode to use ADB connection.
  3. Copy mmcblk0 into a local image file
    • Backup using SSH and dd
    Navigate to a folder where you want to store the backup. Or add a full path before the image name (after of=) in the next command.
    ssh root@192.168.2.15 "dd if=/dev/mmcblk0" | dd "of=watch-backup.img" bs=4096 status=progress
    • Backup using ADB
    adb pull /dev/mmcblk0 watch-backup.img

The copy process might take up to an hour on watches with 8GB of storage.

Mind that taking multiple backups during runtime will result in different checksums. This is expected, because the live AsteroidOS system continuously writes to files, logs and other data on the block device while the dump is running.

If you want consistent backups, the debug ramdisk method may work on some watches. Boot the debug ramdisk with the following command (replace zImage-dtb-dory.fastboot with the correct image for your watch):

fastboot --cmdline debug-ramdisk boot zImage-dtb-dory.fastboot

The debug ramdisk is booted when the manufacturer logo is standing/hanging. You can then run the normal adb pull /dev/mmcblk0 watch-backup.img command and repeated dumps will have identical checksums.

Scripted backup and restore

Beroset has written a set of tools to make working with watches from a Linux computer very convenient. This backup guide will only cover the backup and restore features of asteroid-hosttools. Please be sure to read the asteroid-hosttools documentation to make use of the full capabilities they provide.

  1. Clone asteroid-hosttools
    Clone the asteroid-hosttools using the following command:
    git clone https://github.com/beroset/asteroid-hosttools
    And change into the asteroid-hosttools directory:
    cd asteroid-hosttools
  2. Temporarily install AsteroidOS
    Adapt <watch-codename> in the following commands according to your watches codename listed on the Watches page. I.e dory for the LG G Watch or sturgeon for the Huawei Watch.
    ./flashy <watch-codename> --temp --nightly
  3. Backup the entire watch
    Following command will create a file called original-<watch-codename>.img.
    ./watch-image <watch-codename> --save
  4. Restore a backup
    To restore the backup image created in step 3, make sure the original-<watch-codename>.img file exists.
    Then issue the restore command:
    ./watch-image <watch-codename> --restore