Rock pi 4 emmc back up

Backup and restore from eMMC to uSD?

Please see the tips above on https://rock.sh/rockpi-toolbox

Hi setq,
Backup and restore from eMMC to uSD?
This backup i thought to use for production for all rock pi boards.
https://rock.sh/rockpi-toolbox 404 error found.

Hello,
I use either DD or Partclone. DD is reliable in recreating the whole image but backing up large eMMCs when 6gb is used is time consuming…
Partclone will back up a partition to a file and backs up only used space. I use sfdisk --dump to keep the partition layout the same.
I usually do something like

sfdisk --dump /dev/mmcblk1 > mmcblk1.sfdisk.dump
partclone.ext4 -s /dev/mmcblk1p1 -o ./pinebookpro-mmcblk1p1.partclone -c -N
partclone.ext4 -s /dev/mmcblk1p2 -o ./pinebookpro-mmcblk1p2.partclone -c -N

You can restore to a larger partition without issue and I think you can restore to a smaller partition if the used space of the back is (obviously), less then the available space. And it works with a wide variety of file system types.

Hi setq,
I followed same link before i used 16gb emmc when trying to run ./rockpi-backup.sh -o (pwd) got error no space left on device.
Now i removed emmc ubuntu server os flashed with 32GB SD card after that tried same command now also i am getting error.

 etc/sysctl.d/99-sysctl.conf -> ../sysctl.conf
 etc/sysctl.d/README
     519 100%    0.96kB/s    0:00:00 (xfr#532, ir-chk=1002/2035)
 rsync: write failed on "/tmp/rootfs/rockpi-backup-191113-1018.img": No space left on device (28)
 rsync error: error in file IO (code 11) at receiver.c(393) [receiver=3.1.2]

How to solve the issue ?

Thanks & Regards
Vasu

Hi vasudhevan,

I want to see the print of df -h

If you have a mounted external disk, specify the mount point for -e option.

Hi setq

Filesystem           Size  Used Avail Use% Mounted on
/dev/root             15G  2.6G   12G  19% /
devtmpfs             1.9G     0  1.9G   0% /dev
tmpfs                1.9G     0  1.9G   0% /dev/shm
tmpfs                1.9G  720K  1.9G   1% /run
tmpfs                5.0M     0  5.0M   0% /run/lock
tmpfs                1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/mmcblk0p4       100M   38M   62M  38% /boot
tmpfs                382M     0  382M   0% /run/user/0
overflow             5.8M     0  5.8M   0% /tmp
/dev/mapper/loop0p5  1.6G  5.9M  1.5G

I am fixing it now, please update it in about 30 minutes.

I updated the script, please download it again.

Thank you for helping to find the bug.

This is because -e option was added in the previous version. I provided this parameter when I tested it.

However, if this parameter is not specified when running it, it will add an extra \(backslash) to rsync and cause a bug.

Hi setq,
Thank you for your response.
I used emmc to sd card bakup.
Now also i am getting same error.
mount sd card in /run/media location.
Can you possible give command for taking backup emmc to sd card ?

Thanks & Regards
Vasu

rock@rockpi:~ $ sudo mount /dev/sda /mnt # sda is USB flash disk
rock@rockpi:~ $ sudo ./rockpi-backup.sh -o /mnt/backup.img -e /mnt
rock@rockpi:~ $ ls -lh /mnt/backup.img
-rw-r–r-- 1 root root 8.7G Nov 15 14:46 /mnt/backup.img
rock@rockpi:~ sudo dd if=/mnt/backup.img of=/dev/sdb status=progress # sdb is sd card
rock@rockpi:~ sudo umount /mnt
rock@rockpi:~ sudo mount /dev/sdb5 /mnt
rock@rockpi:~ sudo nano /mnt/etc/fstab # change mmcblk1p4 to mmcblk0p4
rock@rockpi:~ sudo umount /mnt
rock@rockpi:~

Plug in sd card and restart to verify the backup was successful.

Hi setq,
I used emmc 16gb back up to sd card 16gb.
I am getting error.

  root@rock:/home/rock# sudo ./rockpi-backup.sh -o /mnt/backup.img -e /mnt

Welcome to rockpi-backup.sh, part of the Rockpi toolkit.

Enter rockpi-backup.sh -h to view help.
For a description and example usage, see the README.md at:
https://rock.sh/rockpi-toolbox


dd: failed to truncate to 9644802048 bytes in output file ‘/mnt/backup.img’: File too large

Hi setq,
Stills issue is there this is emergency for production.
How to solve the issue ?
sudo ./rockpi-backup.sh -o /mnt/backup.img -e /mnt //got error

sent 1,181,637,806 bytes  received 632,767 bytes  4,260,434.50 bytes/sec
total size is 1,179,202,064  speedup is 1.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1196)       [sender=3.1.2]

Thanks & Regards
Vasu

I’ll take a look now.

Any update on this.

I’m sorry, but I had some other work yesterday. I’ll take care of it today.

Thank you for your reply.

I updated the script, please download it again and try it.

Hi setq,
Sorry for the late reply.
Thank you for your response.
Now back is working image also created.
Back up image flashed with sd card.
See /dev/root 2.2G 2.0G 67M 97% / but sd card size 16gb .

           Filesystem      Size  Used Avail Use% Mounted on
           /dev/root       2.2G  2.0G   67M  97% /
           devtmpfs        1.9G     0  1.9G   0% /dev
           tmpfs           1.9G     0  1.9G   0% /dev/shm
           tmpfs           1.9G  700K  1.9G   1% /run
           tmpfs           5.0M     0  5.0M   0% /run/lock
           tmpfs           1.9G     0  1.9G   0% /sys/fs/cgroup
           /dev/mmcblk0p4  100M   38M   62M  38% /boot
           tmpfs           382M     0  382M   0% /run/user/0

How to expand /dev/root partition ?

Thanks & Regards
Vasu