Power & Source of Big Ideas

Backup/Restore of EMMC

Moderators: chensy, FATechsupport

I have a NanoPI-RC5 4GB, I installed all the software I needed and then i wanted to create an eflasher image to burn it to other devices.

To do this I followed the following steps:

On the device:

Code: Select all

sudo su
cd /
tar --warning=no-file-changed -cvpzf /rootfs.tar.gz \
    --exclude=/rootfs.tar.gz --exclude=/var/lib/docker/runtimes \
    --exclude=/etc/firstuser --exclude=/etc/friendlyelec-release \
    --exclude=/usr/local/first_boot_flag --one-file-system /


On the host:

Code: Select all

scp pi@192.168.1.60:/rootfs.tar.gz ./rootfs.tar.gz

git clone https://github.com/friendlyarm/sd-fuse_rk3568 --single-branch -b master

mv rootfs.tar.gz sd-fuse_rk3568
cd sd-fuse_rk3568

# extract the backup rootfs into the rootfs folder
mkdir rootfs && tar xzf rootfs.tar.gz -C rootfs

# download the base image
wget http://112.124.9.243/dvdfiles/rk3568/images-for-eflasher/debian-bullseye-core-arm64-images.tgz
tar xzf debian-bullseye-core-arm64-images.tgz
# build the image with the backup of rootfs
sudo ./build-rootfs-img.sh ./rootfs debian-bullseye-core-arm64

# download eflasher image
wget http://112.124.9.243/dvdfiles/rk3568/images-for-eflasher/emmc-flasher-images.tgz
tar xzf emmc-flasher-images.tgz
# burn the previous image into the emmc-flasher image
./mk-emmc-image.sh debian-bullseye-core-arm64 autostart=yes
# this will create file under `out` folder
cd out
# compress the image
gzip rk3568-eflasher-debian-bullseye-core-5.10-arm64-20231016.img


Then I used the rpi imager tool to write the image to the sd card. At this point I mouynted the sd card on the NanoPI and let it write my image on the eMMC. All this steps completed successfully but when I removed the sd card and booted the device I got some errors on:

1. Interfaces are not detected, both LAN and WAN ports doesn't work, also running `nmcli device show` doens't show any interfaces, only loopback (lo)

2. sudo command is not working:

Code: Select all

$ sudo
sudo: /etc/sudo.conf is world writable
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set


The only working way I found to make a working backup is to use the backup tool of EFLASHER image, probelm with that is the backup created equals the EMMC size (in my case it is ~30GB) and that not very portable and also so slow to restore in another device. In case the first method don't work I could also suggest to add a shrink image utility that shirnks the image to only the occupied size and extends rootfs filesytem on first boot.

Thanks in advance
You could use a `dd` command, to create a backup from the first device and then to restore to another. Be careful to not wipe partitions by accident.
Another option might be creating a custom friendlywrt image (you can use github actions - see FriendlyWrt-Actions repo) with your changes and install it an all device. After configuring the first, just backup and restore settings only.

Who is online

In total there are 9 users online :: 0 registered, 0 hidden and 9 guests (based on users active over the past 5 minutes)
Most users ever online was 5185 on Wed Jan 22, 2020 1:44 pm

Users browsing this forum: No registered users and 9 guests