# Full backup of system (image)

Make a full backup of your system (as an image) which you can flash whenever something goes wrong.

# Create a backup image from recovery

### Step 1: Enter recovery mode

(see also [here](https://docs.sailfishos.org/Support/Help_Articles/Recovery_Mode/#preparing-xperia-10-ii-or-xperia-10-iii-to-the-recovery-mode))

**Step 1.1:** Turn your phone completely off and disconnect any USB cables

**Step 1.2:** Install fastboot drivers on your computer (for instructions see [here](https://docs.sailfishos.org/Support/Help_Articles/Recovery_Mode/#preparing-xperia-10-ii-or-xperia-10-iii-to-the-recovery-mode))

**Step 1.3:** Force your phone to the fastboot mode

- Hold the Volume Up key down and connect a data-connected USB cable (a charging cable would not work)
- Ensure that the LED at the top of the display area is lit in BLUE colour (if not, disconnect the cable, release the key and try again)

**Step 1.4:** Boot into recovery with the recovery image you got when you downloaded SailfishOS.

<p class="callout warning">**Attention:** This should be of the same SailfishOS version as your phone </p>

Execute the following commands in the same directory as your recovery image (on Linux and macOS with sudo):

For Xperia 10 II and Xperia 10 III:

```bash
fastboot flash boot_a hybris-recovery.img
fastboot flash boot_b hybris-recovery.img
fastboot reboot
```

For Xperia X, Xperia XA2 or Xperia 10 :

```bash
fastboot boot hybris-recovery.img
```

**Step 1.5:** Connect to your device with

```bash
telnet 10.42.66.66
```

**Step 1.6:** Type in "3" to open a shell. You will be asked for the security code/password of your phone

### Step 2: Mount microSD-card

Mount your microSD card with the following command. Your SD-card needs to have at least 105GB of free space.

```bash
mount /dev/mmcblk0p1 /mnt
```

### Step 3: Do the backup

Execute:

```bash
dd if=/dev/sda79 of=/mnt/backup.img bs=1M
```

<p class="callout info">**Note:** This can take 40+ minutes. During this time, no progress is shown. If you would like to see progress, open a second telnet connection and execute <span style="text-decoration: underline;">*watch -n5 'kill -USR1 $(pgrep ^dd$)',*</span> which will show progress (in the original telnet session) every 5 seconds.  
</p>

### Step 4: Unmount the memory card

Once the backup is finished, unmount the microSD-card with:

```bash
umoumt /mnt
```

###  Step 5: Exit recovery mode  


After unmounting, first, exit the shell environment by typing

```bash
exit
```

 This will bring you back to the recovery menu. Here, now select "6" (Exit) which will close the telnet session.

Next, disconnect the USB cable from the phone. After that, you need to force power-off your device by pressing the Vol Up key down, keeping it pressed and pressing the Power key, too. When you feel the vibrator play once and soon after three (3) times (this should happen in about 20 seconds), release both keys. In this way, we ensure that the phone is completely turned off before we proceed to the next step.

### Step 6: Reverting the phone back to normal (For Xperia 10 II and Xperia 10 III only, other Sony phones don't need this step)  


(see also [here](https://docs.sailfishos.org/Support/Help_Articles/Recovery_Mode/#reverting-the-phone-back-to-the-normal-state))

**Step 6.1:** Force your phone to the fastboot mode

- Hold the Volume Up key down and connect a data-connected USB cable (a charging cable would not work)
- Ensure that the LED at the top of the display area is lit in BLUE colour (if not, disconnect the cable, release the key and try again)

**Step 6.2:** Reflash the normal boot image

<p class="callout warning">**Attention:** This should be of the same SailfishOS version as your phone </p>

Execute the following commands in the same directory as your boot image (on Linux and macOS with sudo):

```bash
fastboot flash boot_a hybris-boot.img
fastboot flash boot_b hybris-boot.img
fastboot reboot
```

# Restore backup from an image

### Step 1: Enter recovery mode

For instructions, look [here](https://sailfishos.wiki/books/system/page/create-a-backup-image-from-recovery) and [here](https://docs.sailfishos.org/Support/Help_Articles/Recovery_Mode/#setting-up-the-recovery-mode-on-the-phone)

### Step 2: Mount microSD-card

Mount your microSD card with the following command. Your SD-card needs to have at least 105GB of free space.

```bash
mount /dev/mmcblk0p1 /mnt
```

### Step 3: Restore the backup

Execute:

```bash
dd if=/mnt/backup.img of=/dev/sda79 bs=1M
```

<p class="callout info">**Note:** This can take 40+ minutes. During this time, no progress is shown. If you would like to see progress, open a second telnet connection and execute <span style="text-decoration: underline;">*watch -n5 'kill -USR1 $(pgrep ^dd$)',*</span> which will show progress (in the original telnet session) every 5 seconds.  
</p>

### Step 4: Unmount the memory card

Once the backup is finished, unmount the microSD-card with:

```bash
umoumt /mnt
```

### Step 5: Exit recovery mode  


For instructions, see [here](https://sailfishos.wiki/books/system/page/create-a-backup-image-from-recovery#bkmrk-%C2%A0step-5%3A-exit-recove) and [here](https://docs.sailfishos.org/Support/Help_Articles/Recovery_Mode/#reverting-the-phone-back-to-the-normal-state)