General UNIHIKER

How can I create a full image backup for the UNIHIKER?

userHead LL 2023-12-06 12:04:04 567 Views2 Replies

How can I create a full image backup for the UNIHIKER? 

For my project, I need the capability to restore it across multiple boards.

2023-12-06 12:23:20

Title: How to Backup Your Unihiker System to an IMG File?

 

Steps:

1. Insert a microSD card (16GB or larger, formatted to exFAT) into the microSD card slot of your Unihiker device.

2. The Unihiker will automatically mount this SD card under the `/media/` directory. Use the command `ls /media/` to check the directory name of the SD card, which might be something like `mmcblk0p1`. If it's not listed, check if the SD card is properly inserted or try replacing it with a higher quality one.

3. Delete some configuration files to allow the system to perform some initial settings when it is flashed onto a new Unihiker device:


```
rm /opt/unihiker/mac.conf
rm /opt/bdaddr
rm /opt/unihiker/firstRun
```

4. Use the following command to backup the current system to the SD card. This process may take a long time (possibly up to half an hour), so be patient and wait for it to complete. It will create a file named `unihiker_backup.img`. Here, `/dev/mmcblk1` is the address of the system's eMMC, `/media/mmcblk0p1/` is the address of the SD card directory found in step 2, and `emmc_dump.img` is the name of the backup file:


```
sudo dd if=/dev/mmcblk1 of=/media/mmcblk0p1/unihiker_backup.img bs=4M status=progress
```

5. Transfer the `unihiker_backup.img` file to your computer to complete the backup. Afterwards, you can use the Unihiker Burning tool(https://www.unihiker.com/wiki/burner#1.%20Burning%20tool) to burn this IMG file onto another Unihiker device.

 

 

 

userHeadPic LL
LL wrote:


You can append the date and MD5 checksum to your backup file name by using a combination of `date` and `md5sum` commands in a Bash script. Here is a step-by-step guide(calculating the MD5 on 'unihiker' might take a while, so you could also perform these operations on a PC):

1. First, grab the current date and time in the format YYYYMMDDHHMM:

```
current_time=$(date +%Y%m%d%H%M)
```

2. Next, calculate the MD5 checksum of your backup file and extract the first 32 characters, which is the actual MD5 value:

```
cd "/media/mmcblk0p1/"
md5_value=$(md5sum "unihiker_backup.img" | cut -d ' ' -f 1)
```

 

3. Construct the new file name by incorporating the current time and MD5 value:

```bash
new_filename="unihiker_backup_${current_time}.md5.${md5_value}.img"
```

 

4. Finally, rename your original backup file to the new file name:

```bash
mv "unihiker_backup.img" "$new_filename"

ls
```

 

By running these commands, your backup file will be renamed to include the current date and its MD5 checksum, which can be very helpful for both identifying the backup and verifying its integrity at a later time.

2023-12-06 13:12:27
1 Replies