Skip to main content

System backup

1. TF Card System Backup

1.1 Full Card Backup

Backing up the entire TF card using Win32DiskImager is simple and convenient. However, the resulting image file from a full card backup will have the same capacity as the TF card, so when restoring, you must use a TF card with a larger capacity than the image.

  1. Create an empty luckfox.img file on a disk with sufficient disk space. Connect the TF card with the image to the computer using a card reader.

  2. Open Win32DiskImager and click on the folder icon①. Select the luckfox.img file you created earlier and confirm the drive letter② of the TF card. (To avoid confusion with other devices, remove any storage devices other than the TF card.)

  3. Click on the Read button③ and wait for the progress bar to complete. (The image obtained from the read process can be directly written onto a new TF card using Win32DiskImager).

1.2 Compressed Backup

Principle of Compressed Backup: Use the Gparted disk management tool on a Linux host or virtual machine to resize partitions. This reduces the size of the backup image, making it easier for re-flashing.

  1. Download the disk management tool:

    sudo apt-get install gparted 
  2. Once the download is complete, open the tool from System Tools->Gparted. You will need to enter your login password.

  3. Ignore the Libparted Warning.

  4. Open the Gparted disk management tool and switch to the TF card.

  5. Select the userdata partition to be shrunk, click on Resize in the upper left corner (green arrow pointing left). The minimum size for the userdata partition is 176MiB; we will adjust it to 182MiB.

  6. After making the adjustment, click on Apply (green button on the right) to apply the changes.


  7. Calculate the size of the image to be backed up (4+4+64+64+32+6x1024+128+182)MiB≈6622MiB. We can set the image size to 6650MiB.

  8. Backup the image to the hard drive and check if the hard drive is automatically mounted using the following command.

    linaro@linaro-alip:~$ lsblk
    NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
    sda 8:0 1 14.9G 0 disk
    ├─sda1 8:1 1 4M 0 part
    ├─sda2 8:2 1 4M 0 part
    ├─sda3 8:3 1 64M 0 part
    ├─sda4 8:4 1 64M 0 part
    ├─sda5 8:5 1 32M 0 part /media/linaro/L4T-README
    ├─sda6 8:6 1 6G 0 part /media/linaro/9abb78c6-ffcf-44fb-bbe9-35cd2d87a0d5
    ├─sda7 8:7 1 128M 0 part
    └─sda8 8:8 1 182M 0 part
    sdb 8:16 0 119.2G 0 disk
    └─sdb1 8:17 0 119.2G 0 part
    mmcblk0 179:0 0 29.1G 0 disk
    ├─mmcblk0p1 179:1 0 4M 0 part
    ├─mmcblk0p2 179:2 0 4M 0 part
    ├─mmcblk0p3 179:3 0 64M 0 part
    ├─mmcblk0p4 179:4 0 64M 0 part
    ├─mmcblk0p5 179:5 0 32M 0 part
    ├─mmcblk0p6 179:6 0 6G 0 part /
    ├─mmcblk0p7 179:7 0 128M 0 part /oem
    └─mmcblk0p8 179:8 0 430M 0 part /userdata
    mmcblk0boot0 179:32 0 4M 1 disk
    mmcblk0boot1 179:64 0 4M 1 disk
  9. Manually mount the hard drive and back up the image.

    sudo su 
    # Create a directory for mounting the USB drive
    mkdir -p /media/usb

    # Mount the USB drive
    mount /dev/sdb1 /media/usb/

    cd /media/usb/
    dd if=/dev/sda of=./luckfoxtf.img count=6650 bs=1024k conv=sync
  10. Monitor the progress of the image backup. In another terminal, enter the following command:

    watch -n 1 du -sh /media/usb/luckfoxtf.img

    # Refreshes the image size every second. Press Ctrl+C to exit.
    Every 1.0s: du -sh /media/usb/luckfox.img linaro-alip: Fri Aug 5 12:28:05 2023

    2.1G /media/usb/luckfoxtf.img
  11. Once the backup is complete, unmount the hard drive.

    root@linaro-alip:/media/usb# dd if=/dev/sda of=./luckfoxtf.img count=6650 bs=1024k conv=sync
    6650+0 records in
    6650+0 records out
    6973030400 bytes (7.0 GB, 6.5 GiB) copied, 486.854 s, 14.3 MB/s
    root@linaro-alip:/media/usb# cd /home/linaro
    root@linaro-alip:/home/linaro# umount /media/usb/

1.3 TF Card Image Burning

Whether it's a full card backup or a compressed backup, you'll need to use Win32DiskImager to write the image.

  1. Connect the TF card with the image to your computer using a card reader. Open Win32DiskImager and click on the folder icon①.

  2. Choose the previously backed-up file named luckfoxtf.img, and confirm the drive letter② of the TF card. (To avoid confusion with other devices, remove any storage devices other than the TF card.)

  3. Click on "Write"③ and wait for the progress bar to complete.

2. eMMC System Backup

To backup the system image from the eMMC, you'll need a Linux environment, and since the eMMC is non-removable on the board, we'll utilize the TF card to provide the required Linux environment since Core3566 prioritizes booting from the TF card.

2.1 Preparation

  1. Burn the image onto the TF card, then insert the TF card into the USB interface of the expansion board. Power on the system directly to ensure it boots from the TF card.

  2. Insert a USB flash drive or an external hard drive into the USB interface of the expansion board.

  3. Once the system successfully boots, use the following command to view:

    linaro@linaro-alip:~$ lsblk
    NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
    sda 8:0 0 119.2G 0 disk
    └─sda1 8:1 0 119.2G 0 part /media/linaro/24FC743CFC7409F6
    mmcblk1 179:0 0 14.9G 0 disk
    ├─mmcblk1p1 179:1 0 4M 0 part
    ├─mmcblk1p2 179:2 0 4M 0 part
    ├─mmcblk1p3 179:3 0 64M 0 part
    ├─mmcblk1p4 179:4 0 64M 0 part
    ├─mmcblk1p5 179:5 0 32M 0 part /media/linaro/L4T-README
    ├─mmcblk1p6 179:6 0 6G 0 part /
    ├─mmcblk1p7 179:7 0 128M 0 part /oem
    └─mmcblk1p8 179:8 0 8.6G 0 part /userdata
    mmcblk0 179:32 0 29.1G 0 disk
    ├─mmcblk0p1 179:33 0 4M 0 part
    ├─mmcblk0p2 179:34 0 4M 0 part
    ├─mmcblk0p3 179:35 0 64M 0 part
    ├─mmcblk0p4 179:36 0 64M 0 part
    ├─mmcblk0p5 179:37 0 32M 0 part
    ├─mmcblk0p6 179:38 0 6G 0 part /media/linaro/9abb78c6-ffcf-44fb-bbe9-35cd2d87a0d5
    ├─mmcblk0p7 179:39 0 128M 0 part
    └─mmcblk0p8 179:40 0 22.8G 0 part
    mmcblk0boot0 179:64 0 4M 1 disk
    mmcblk0boot1 179:96 0 4M 1 disk
    • Translation: "Where sda is a hard disk, mmcblk0 is onboard eMMC, and mmcblk1 is a TF card."

2. 2 Using Gparted Disk Management Tool to Resize Partitions

  1. Download the disk management tool:

    sudo apt-get install gparted 
  2. Once the download is complete, open the tool from System Tools -> Gparted. You will need to input your login password.

  3. For the Libparted Warning, choose to ignore.

  4. Open the Gparted disk management tool and switch to the eMMC disk.

  5. Select the userdata partition to be shrunk and click on the Resize option at the upper left corner (green arrow pointing left).

  6. Select the userdata partition to be shrunk and click on the Resize option at the upper left corner (green arrow pointing left).

  7. After making the adjustments, click on Apply (green button on the right) to apply the changes.

  8. Calculate the size for creating a backup image (4+4+64+64+32+6x1024+128+430)MiB≈6870MiB. We can set the image size to 6900MiB.

2.3 Creating a Compressed Backup Using the dd Command

  1. Our hard disk is mounted by default in the directory /media/linaro/24FC743CFC7409F6. If it's not mounted, you need to manually mount it.

  2. Manually mount a USB drive.

    sudo su
    # Create a directory for mounting the USB drive
    mkdir -p /media/usb

    # Mount the USB drive
    mount /dev/sda1 /media/usb/
  3. Backup the image to the mounted USB drive using the dd command.

    dd if=/dev/mmcblk0 of=/media/usb/luckfox.img count=6900 bs=1024k conv=sync

    # Copying will take some time, please be patient. You'll see messages like:
    3350+0 records in
    3350+0 records out
    3512729600 bytes (3.5 GB, 3.3 GiB) copied, 198.883 s, 17.7 MB/s
  4. Monitor the progress of the image backup. Open another terminal and enter the following command:

    watch -n 1 du -sh /media/usb/luckfox.img

    # Refreshes the image size every second. Press Ctrl+C to exit.
    Every 1.0s: du -sh /media/usb/luckfox.img linaro-alip: Fri Aug 4 12:28:05 2023

    1.1G /media/usb/luckfox.img
  5. After the backup is complete, unmount the USB drive.

    umount /media/usb/

2.4 Flashing the Image Using RKDevTool_Release

  1. Open the Rockchip flashing tool RKDevTool. Double-click the second row labeled "Parameter" and change the name to "image".

  2. Check the first row for "Loader" and the second row for "image".

  3. In section ①, select the location of the firmware for the Core3566 board (download link: click here). In section ②, choose the path of the backed-up image.

  4. Click on "run". You will see the write progress on the right side. If it shows "Download image OK", the write process is successful.

2.5 Modifying MAC Address

If the backed-up image results in a MAC address conflict with the original device, you can follow the steps below to modify the MAC address.

Note: You need to use a serial connection to log in to Core3566, as disabling the network interface will disconnect the SSH connection.

  1. Install the macchanger tool.

    sudo apt update
    sudo apt install macchanger
  2. To modify the MAC address, here we are using eth0. First, disable the network interface using the ifconfig command.

    sudo ifconfig eth0 down
  3. Use the macchanger command with the -r parameter to change the MAC address to a random address.

    sudo macchanger -r eth0
  4. After changing the MAC address, execute the following command to bring up the network interface.

    sudo ifconfig eth0 up
  5. Use the following command to check the current MAC address.

    root@linaro-alip:/home/linaro# macchanger -s eth0
    Current MAC: ee:27:fc:f1:80:9f (unknown)
    Permanent MAC: 2e:f2:bb:3a:fa:b3 (unknown)