TS-4720 eMMC Backup/restore: Difference between revisions

From embeddedTS Manuals
No edit summary
m (Links auto-updated for 2022 re-branding ( https://files.embeddedarm.com/ts-socket-macrocontrollers/ts-4710-linux/binaries/ts-images/2gb-emmc-slc-471x-latest.dd.bz2 →‎ https://files.embeddedTS.com/ts-socket-macrocontrollers/ts-4710-linux/binaries/ts-images/2gb-emmc-slc-471x-latest.dd.bz2))
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{|  
{|  
| [[File:MicroSD.png|70px|link=ftp://ftp.embeddedarm.com/ts-socket-macrocontrollers/ts-4710-linux/binaries/ts-images/4gbsd-471x-latest.dd.bz2]]
| [[File:eMMC.png|70px|link=https://files.embeddedTS.com/ts-socket-macrocontrollers/ts-4710-linux/binaries/ts-images/2gb-emmc-slc-471x-latest.dd.bz2]]
| [ftp://ftp.embeddedarm.com/ts-socket-macrocontrollers/ts-4710-linux/binaries/ts-images/4gbsd-471x-latest.dd.bz2 Click to download the latest 4GB SD card image.]
| [https://files.embeddedTS.com/ts-socket-macrocontrollers/ts-4710-linux/binaries/ts-images/2gb-emmc-slc-471x-latest.dd.bz2 Click to download the latest 2GB eMMC image.]
|}
|}


{{Warning|Make sure the SD and eMMC filesystems are mounted read only while writing any images.  If dd is used to read or write a disk while a filesystem on it is mounted read/write this can result in a corrupt image.}}
{{Warning|Make sure the SD and eMMC filesystems are mounted read only while writing any images.  If dd is used to read or write a disk while a filesystem on it is mounted read/write this can result in a corrupt image.}}


''' Write an Image to eMMC '''
First boot to the initramfs.  These steps should '''not be run from the full Debian environment''', so to get back to the initramfs, first run:
 
The onboard eMMC uses the same image as the MicroSD card.  To program the eMMC chip you would need to first boot to the MicroSD card.  From the stock SD image initramfs you can use dd to write the SD image to the eMMC:
<source lang=bash>
<source lang=bash>
dd if=/dev/nbd0 of=/dev/nbd1 bs=4M conv=fsync
tshwctl --removejp 1 && reboot
#/dev/nbd0 is the microSD
#/dev/nbd1 is the eMMC
#bs=4M is not required but will speed up the copy
#conv=fsync causes dd to flush all writes to the disk immediately rather than use cache
</source>
</source>


Alternatively you can use a usb drive with a copy of the eMMC image:
Once you are in the initramfs, mount a network share or usb drive containing the emmc image.
<source lang=bash>
# The first partition of a usb drive would be at /dev/sda1
mkdir /mnt/usb/
mount /dev/sda1 /mnt/usb/
dd if=/mnt/usb/emmcImage.dd of=/dev/nbd1  bs=4M conv=fsync
</source>


''' Create image from eMMC '''
''' Write an Image to eMMC '''
 
Since the eMMC and SD images are the same you can use an SD card to backup the eMMC image.  This will replace the contents of the MicroSD card with the eMMC image:


<source lang=bash>
<source lang=bash>
# Boot from SD (/dev/nbd1) will not start the nbd-client for eMMC.  This only needs
# Plug in a thumbdrive formatted with ext2/3/4 or fat32/ntfs
# to be started once per boot to access eMMC with:
mkdir /mnt/usbdev
nbd-client 127.0.0.1 7500 /dev/nbd0
mount -o ro /dev/sda1 /mnt/usbdev
dd if=/dev/nbd1 of=/dev/nbd0 bs=4M conv=fsync
dd if=/mnt/usbdev/emmc-image.dd bs=4M of=/dev/nbd1
#/dev/nbd1 is the eMMC
#/dev/nbd0 is the microSD
#bs=4M is not required but will speed up the copy
#conv=fsync causes dd to flush all writes to the disk immediately rather than use cache
</source>
</source>


Alternatively you can use a usb drive as the location to store the eMMC image:
''' Save an image from eMMC '''
 
<source lang=bash>
<source lang=bash>
# The first partition of a usb drive would be at /dev/sda1
# Plug in a thumbdrive formatted with ext2/3/4 or fat32/ntfs
mkdir /mnt/usb/
mkdir /mnt/usbdev
mount /dev/sda1 /mnt/usb/
mount -o ro /dev/sda1 /mnt/usbdev
dd if=/dev/nbd1 of=/mnt/usb/emmcBackup.dd bs=4M conv=fsync
# This can take about 15 minutes
dd if=/dev/nbd1 bs=4M of=/mnt/usbdev/emmc-image.dd
umount /mnt/usbdev
sync
</source>
</source>

Latest revision as of 16:51, 17 January 2022

EMMC.png Click to download the latest 2GB eMMC image.
WARNING: Make sure the SD and eMMC filesystems are mounted read only while writing any images. If dd is used to read or write a disk while a filesystem on it is mounted read/write this can result in a corrupt image.

First boot to the initramfs. These steps should not be run from the full Debian environment, so to get back to the initramfs, first run:

tshwctl --removejp 1 && reboot

Once you are in the initramfs, mount a network share or usb drive containing the emmc image.

Write an Image to eMMC

# Plug in a thumbdrive formatted with ext2/3/4 or fat32/ntfs
mkdir /mnt/usbdev
mount -o ro /dev/sda1 /mnt/usbdev
dd if=/mnt/usbdev/emmc-image.dd bs=4M of=/dev/nbd1

Save an image from eMMC

# Plug in a thumbdrive formatted with ext2/3/4 or fat32/ntfs
mkdir /mnt/usbdev
mount -o ro /dev/sda1 /mnt/usbdev
# This can take about 15 minutes
dd if=/dev/nbd1 bs=4M of=/mnt/usbdev/emmc-image.dd
umount /mnt/usbdev
sync