TS-4100 eMMC Backup/restore: Difference between revisions

From embeddedTS Manuals
(Created page with "The simplest way to backup/restore the eMMC is through u-boot. If you boot up and stop in u-boot you can run this command: <source lang=bash> ums 0 mmc 1 </source> This will...")
 
m (Non-link text auto-updated for 2022 re-branding ( http://ftp.embeddedarm.com/ftp/ts-socket-macrocontrollers/ts-4100-linux/distributions/debian/ts4100-armhf-stretch-latest.tar.xz →‎ http://ftp.embeddedTS.com/ftp/ts-socket-macrocontrollers/ts-4100-linux/distributions/debian/ts4100-armhf-stretch-latest.tar.xz))
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
The simplest way to backup/restore the eMMC is through u-boot. If you boot up and stop in u-boot you can run this command:
These instructions assume the TS-4100 is booted from SD card all the way to Linux. They also assume that the eMMC is unmodified, with a single partition. If the partition table has been modified, a utility such as 'gparted' or 'fdisk' may be needed to remove the existing partition table and recreate it with a single partition. Note that the partition table must be "MBR" or "msdos", the "GPT" partition table format is not supported by U-Boot.
 
<source lang=bash>
<source lang=bash>
ums 0 mmc 1
# Verify nothing else has the partition mounted
umount /dev/mmcblk1p1
 
mkfs.ext3 /dev/mmcblk1p1
mount /dev/mmcblk1p1 /mnt/emmc
wget http://ftp.embeddedTS.com/ftp/ts-socket-macrocontrollers/ts-4100-linux/distributions/debian/ts4100-armhf-stretch-latest.tar.xz
tar -xf ts4100-armhf-stretch-latest.tar.xz -C /mnt/emmc
umount /mnt/emmc
sync
</source>
</source>
{{:U-Boot ext4 warning}}


This will make the board act as a USB mass storage device with direct access to the emmc diskOn a linux workstation, to backup the image:
Once written, the files on disk can be verified to ensure they are the same as the source files in the archiveTo do so, run the following commands:
<source lang=bash>
<source lang=bash>
dmesg | tail -n 30
mount /dev/mmcblk1p1 /mnt/emmc
# Look for the last /dev/sd* device connected.  This should also match the eMMC
# size of around 3.78GiB.  On my system, this is /dev/sdd.
sudo mkdir /mnt/emmc/
sudo mount /dev/mmcblk2p1 /mnt/emmc/
cd /mnt/emmc/
cd /mnt/emmc/
tar -cjf /path/to/ts4100-backup-image.tar.bz2
md5sum --quiet -c md5sums.txt
cd ../
cd -
umount /mnt/emmc/
umount /mnt/emmc
sync
sync
</source>
</source>


To write a new filesystem to the TS-4100:
The 'md5sum' command will report any differences between files and their checksums. Any differences are an indication of failure to write data or a damaged disk.
<source lang=bash>
dmesg | tail -n 30
# Look for the last /dev/sd* device connected. This should also match the eMMC
# size of around 3.78GiB.  On my system, this is /dev/sdd.
sudo mkdir /mnt/emmc/
sudo mkfs.ext4 /dev/mmcblk2p1
# If the above command fails, use fdisk or gparted to repartition the emmc
# to have one large partition.
sudo mount /dev/mmcblk2p1 /mnt/emmc/
tar -xjf /path/to/ts4100-new-image.tar.bz2 -C /mnt/emmc
umount /mnt/emmc/
sync
</source>

Latest revision as of 14:20, 18 January 2022

These instructions assume the TS-4100 is booted from SD card all the way to Linux. They also assume that the eMMC is unmodified, with a single partition. If the partition table has been modified, a utility such as 'gparted' or 'fdisk' may be needed to remove the existing partition table and recreate it with a single partition. Note that the partition table must be "MBR" or "msdos", the "GPT" partition table format is not supported by U-Boot.

# Verify nothing else has the partition mounted
umount /dev/mmcblk1p1

mkfs.ext3 /dev/mmcblk1p1
mount /dev/mmcblk1p1 /mnt/emmc
wget http://ftp.embeddedTS.com/ftp/ts-socket-macrocontrollers/ts-4100-linux/distributions/debian/ts4100-armhf-stretch-latest.tar.xz
tar -xf ts4100-armhf-stretch-latest.tar.xz -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.

Once written, the files on disk can be verified to ensure they are the same as the source files in the archive. To do so, run the following commands:

mount /dev/mmcblk1p1 /mnt/emmc
cd /mnt/emmc/
md5sum --quiet -c md5sums.txt
cd -
umount /mnt/emmc
sync

The 'md5sum' command will report any differences between files and their checksums. Any differences are an indication of failure to write data or a damaged disk.