TS-4900 eMMC Backup/restore: Difference between revisions

From embeddedTS Manuals
No edit summary
No edit summary
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
'''Write the image:'''
'''Write the image:'''


These commands assume you are booted to the SD card, and  
These commands assume the unit is booted from SD and eMMC is set up with a single partition:


<source lang=bash>
<source lang=bash>
Line 7: Line 7:
umount /dev/mmcblk2p1
umount /dev/mmcblk2p1


mkfs.ext4 /dev/mmcblk2p1
mkfs.ext3 /dev/mmcblk2p1
mkdir /mnt/emmc
mkdir /mnt/emmc
mount /dev/mmcblk2p1 /mnt/emmc
mount /dev/mmcblk2p1 /mnt/emmc
wget ftp://ftp.embeddedarm.com/ts-socket-macrocontrollers/ts-4900-linux/distributions/yocto/fido/ts-x11-image-tsimx6-latest.tar.bz2
wget https://files.embeddedTS.com/ts-socket-macrocontrollers/ts-4900-linux/distributions/debian/debian-armhf-bullseye-latest.tar.bz2
tar -xf ts-x11-image-tsimx6-latest.tar.bz2 -C /mnt/emmc
tar --numeric-owner -xf debian-armhf-bullseye-latest.tar.bz2 -C /mnt/emmc
umount /mnt/emmc
umount /mnt/emmc
sync
sync
</source>
</source>
{{:U-Boot ext4 warning}}


After it is written you can verify the data was written correctly.
After the tarball is unpacked, the data on disk can be verified with md5sum:
<source lang=bash>
<source lang=bash>
# Drop any block cache
# Drop any block cache
Line 22: Line 23:
mount /dev/mmcblk2p1 /mnt/emmc
mount /dev/mmcblk2p1 /mnt/emmc
cd /mnt/emmc/
cd /mnt/emmc/
sudo md5sums -c md5sums.txt
sudo md5sum -c md5sums.txt
umount /mnt/emmc
umount /mnt/emmc
sync
sync
</source>
</source>


The md5sums command will report what differences there are, if any, and return if it passed or failed.
The md5sum command will report what differences there are, if any, and return if it passed or failed.


'''Backup the image:'''
'''Backup the image:'''


First boot the board to any SD image.  The SD should have enough space for the compressed image of your eMMC.  From our default image this is ~500MB.  To create an image to your SD card:
First boot the device to any compatible bootable SD card.  The SD needs have enough free space for the compressed image of the data on the eMMC.  Our default image eMMC image is ~500MB when compressedA tarball of the eMMC can be created on the SD card with the following commands:
<source lang=bash>
<source lang=bash>
mkdir /mnt/sd/
mkdir /mnt/emmc/
mount /dev/mmcblk1p1 /mnt/sd/
mount /dev/mmcblk2p1 /mnt/emmc/
cd /mnt/sd/
cd /mnt/emmc/
tar -cjf /root/backup.tar.bz2 *
tar --numeric-owner -cjf /root/emmc-backup.tar.bz2 *
umount /mnt/sd/
cd /
umount /mnt/emmc/
</source>
</source>

Latest revision as of 12:08, 3 February 2022

Write the image:

These commands assume the unit is booted from SD and eMMC is set up with a single partition:

# Verify nothing else has this mounted
umount /dev/mmcblk2p1

mkfs.ext3 /dev/mmcblk2p1
mkdir /mnt/emmc
mount /dev/mmcblk2p1 /mnt/emmc
wget https://files.embeddedTS.com/ts-socket-macrocontrollers/ts-4900-linux/distributions/debian/debian-armhf-bullseye-latest.tar.bz2
tar --numeric-owner -xf debian-armhf-bullseye-latest.tar.bz2 -C /mnt/emmc
umount /mnt/emmc
sync
Note: The ext4 filesystem can be used instead of ext3, but it may require additional options. U-Boot does not support the 64bit addressing added as the default behavior in recent revisions of mkfs.ext4. If using e2fsprogs 1.43 or newer, the options "-O ^64bit,^metadata_csum" must be used with ext4 for proper compatibility. Older versions of e2fsprogs do not need these options passed nor are they needed for ext3.

After the tarball is unpacked, the data on disk can be verified with md5sum:

# Drop any block cache
echo 3 > /proc/sys/vm/drop_caches
mount /dev/mmcblk2p1 /mnt/emmc
cd /mnt/emmc/
sudo md5sum -c md5sums.txt
umount /mnt/emmc
sync

The md5sum command will report what differences there are, if any, and return if it passed or failed.

Backup the image:

First boot the device to any compatible bootable SD card. The SD needs have enough free space for the compressed image of the data on the eMMC. Our default image eMMC image is ~500MB when compressed. A tarball of the eMMC can be created on the SD card with the following commands:

mkdir /mnt/emmc/
mount /dev/mmcblk2p1 /mnt/emmc/
cd /mnt/emmc/
tar --numeric-owner -cjf /root/emmc-backup.tar.bz2 *
cd /
umount /mnt/emmc/