EMMC has been flashed and LePotato boots from it. My questions are below
How can I now back up the finished image to the onboard microSD card? mmcblk0 is a 32gb EMMC. You can see mmcblk1 is showing up and is a 32gb microSD
Can I use the onboard microSD as additional storage? Is there a way to automatically expand to current file system to both storage devices combined?
To backup the eMMC:
- Flash a MicroSD card with some OS and insert it into the board.
- Interrupt the bootloader and type in
run bootcmd_mmc1
.
- Once the MicroSD card OS is booted, run
sudo dd if=/dev/mmcblk0 of=backup.img bs=1M
. Your MicroSD card has to be larger than your eMMC. If you want to compress it before writing it to the MicroSD card, run sudo dd if=/dev/mmcblk0 bs=1M | gzip > backup.img.gz
To use MicroSD card as additional storage, just boot from the eMMC and use mkfs.FS /dev/mmcblk1
and replace FS with ext4 or btrfs or xfs or vfat etc. Setup a mount entry in /dev/fstab.
You have to modify the image via a loopback device or before backing up and insert an expansion script to run.
#!/bin/sh
### BEGIN INIT INFO
# Provides: resize2fs_once
# Required-Start:
# Required-Stop:
# Default-Start: 3
# Default-Stop:
# Short-Description: Resize the root filesystem to fill partition
# Description:
### END INIT INFO
. /lib/lsb/init-functions
case "$1" in
start)
log_daemon_msg "Starting resize2fs_once"
ROOT_DEV=$(findmnt / -o source -nv | sed -E "s/p?[0-9]\$//") &&
sfdisk -d $ROOT_DEV | sed "s/size=\s\+[0-9]*,\s\+type=83/type=83/" | sfdisk --force $ROOT_DEV &&
partprobe $ROOT_DEV &&
btrfs fi resize max / &&
update-rc.d resize2fs_once remove &&
rm /etc/init.d/resize2fs_once &&
log_end_msg $?
;;
*)
echo "Usage: $0 start" >&2
exit 3
;;
esac
1 Like