75XX MicroSD Recovery: Difference between revisions

From embeddedTS Manuals
No edit summary
m (Links auto-updated for 2022 re-branding ( https://files.embeddedarm.com/ts-arm-sbc/ts-7520-linux/binaries/ts-images/dblstorimg-4gbsd-latest.dd.bz2 →‎ https://files.embeddedTS.com/ts-arm-sbc/ts-7520-linux/binaries/ts-images/dblstorimg-4gbsd-latest.dd.bz2))
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
If backing up on a separate workstation, keep in mind windows does not have direct block device support needed to write these images.  You will also need to determine the SD card deviceYou can usually find this in the output of 'dmesg' after inserting the SD card and you will typically see something like '/dev/sdb' as the block device and '/dev/sdb1' for the first partition.  On some newer kernels you will see '/dev/mmcblk0' as the block device and '/dev/mmcblkop1' for the first partitionFor these examples I will use the '/dev/mmcblk0' format.
These instructions for rewriting the SD card must be done either on the arm system, or on a linux workstation.  We do not support any method using Windows to rewrite the cards, but many virtual machines offer USB redirection which will also work with the USB card reader supplied in the development kitThe methods using dd and sdctl to rewrite the SD card will completely erase everything on the card and set up our MBR, kernel, intird, and Debian filesystemNo prior formatting to the card is needed.


If you are backing up directly on the board you will likely need to use some kind of offboard storage like a thumbdrive or external hard driveMake sure you have any nbd devices unmounted before trying to restore new ones.
After plugging in the USB adapter to your PC you will need to determine the block device.  You can usually find this in the output of 'dmesg' after inserting the SD card and you will typically see something like '/dev/sdb' as the block device and '/dev/sdb1' for the first partitionOn some newer kernels you will see '/dev/mmcblk0' as the block device and '/dev/mmcblkop1' for the first partition.  For these examples I will use the '/dev/mmcblk0' format.


You can find the latest SD card image [ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7500-linux/binaries/ts-images/2gbsd-noeclipse-latest.dd.bz2 here].  Make sure you decompress the image first before writing.
You can find the latest SD card image [https://files.embeddedTS.com/ts-arm-sbc/ts-7520-linux/binaries/ts-images/dblstorimg-4gbsd-latest.dd.bz2 here].  Make sure you decompress the image first before writing. For example to decompress on most Linux workstations you can run:
 
<source lang=bash>
bzip2 -d dblstorimg-4gbsd-latest.dd.bz2
</source>
 
To update to our latest image from your workstation:
<source lang=bash>
dd if=/path/to/dblstorimg-4gbsd-latest.dd of=/dev/mmcblk0 bs=32k && sync && sync
</source>


''' From Workstation '''   
''' From Workstation '''   
Line 12: Line 21:
Entire SD card
Entire SD card
<source lang=bash>
<source lang=bash>
dd if=/dev/mmcblk0 of=/path/to/backup.dd bs=32k
dd if=/dev/mmcblk0 of=/path/to/backup.dd bs=32k && sync && sync
</source>
</source>


Kernel
Kernel
<source lang=bash>
<source lang=bash>
dd if=/dev/mmcblk0p2 of=/path/to/zImage bs=32k
dd if=/dev/mmcblk0p2 of=/path/to/zImage bs=32k && sync && sync
</source>
</source>


Initrd
Initrd
<source lang=bash>
<source lang=bash>
dd if=/dev/mmcblk0p3 of=/path/to/initrd bs=32k
dd if=/dev/mmcblk0p3 of=/path/to/initrd bs=32k && sync && sync
</source>
</source>


Line 29: Line 38:
Entire SD card
Entire SD card
<source lang=bash>
<source lang=bash>
dd if=/path/to/backup.dd of=/dev/mmcblk0 bs=32k
dd if=/path/to/backup.dd of=/dev/mmcblk0 bs=32k && sync
</source>
</source>


Kernel
Kernel
<source lang=bash>
<source lang=bash>
dd if=/path/to/zImage bs=32k of=/dev/mmcblk0p2
dd if=/path/to/zImage bs=32k of=/dev/mmcblk0p2 && sync
</source>
</source>


Initrd
Initrd
<source lang=bash>
<source lang=bash>
dd if=/initrd bs=32k of=/dev/mmcblk0p3
dd if=/initrd bs=32k of=/dev/mmcblk0p3 && sync
</source>
</source>


Line 50: Line 59:
# Determine the block size
# Determine the block size
eval $(sdctl)
eval $(sdctl)
dd if=/dev/nbd5 of=/path/to/backup.dd bs=512 count=$cardsize_sectors conv=sync
dd if=/dev/nbd5 of=/path/to/backup.dd bs=512 count=$cardsize_sectors conv=sync && sync
</source>
</source>


Line 67: Line 76:
The entire card from SBC
The entire card from SBC
<source lang=bash>
<source lang=bash>
dd if=/path/to/2gbsd-noeclipse-latest.dd bs=512 conv=sync of=/dev/nbd5
dd if=/path/to/2gbsd-noeclipse-latest.dd bs=512 conv=sync of=/dev/nbd5 && sync
</source>
</source>


Kernel
Kernel
<source lang=bash>
<source lang=bash>
dd if=/mnt/root/zImage bs=512 conv=sync of=/dev/nbd7
dd if=/mnt/root/zImage bs=512 conv=sync of=/dev/nbd7 && sync
</source>
</source>


Initrd
Initrd
<source lang=bash>
<source lang=bash>
dd if=/mnt/root/initrd bs=512 conv=sync of=/dev/nbd8
dd if=/mnt/root/initrd bs=512 conv=sync of=/dev/nbd8 && sync
</source>
</source>
''' Expected Partition Layout '''
{| class="wikitable"
|-
! Partition
! Contents
|-
| 1
| FAT32 (empty)
|-
| 2
| kernel binary (0xda)
|-
| 3
| initrd (0xda)
|-
| 4
| Debian root filesystem (EXT3)
|}

Latest revision as of 16:27, 17 January 2022

These instructions for rewriting the SD card must be done either on the arm system, or on a linux workstation. We do not support any method using Windows to rewrite the cards, but many virtual machines offer USB redirection which will also work with the USB card reader supplied in the development kit. The methods using dd and sdctl to rewrite the SD card will completely erase everything on the card and set up our MBR, kernel, intird, and Debian filesystem. No prior formatting to the card is needed.

After plugging in the USB adapter to your PC you will need to determine the block device. You can usually find this in the output of 'dmesg' after inserting the SD card and you will typically see something like '/dev/sdb' as the block device and '/dev/sdb1' for the first partition. On some newer kernels you will see '/dev/mmcblk0' as the block device and '/dev/mmcblkop1' for the first partition. For these examples I will use the '/dev/mmcblk0' format.

You can find the latest SD card image here. Make sure you decompress the image first before writing. For example to decompress on most Linux workstations you can run:

bzip2 -d dblstorimg-4gbsd-latest.dd.bz2

To update to our latest image from your workstation:

dd if=/path/to/dblstorimg-4gbsd-latest.dd of=/dev/mmcblk0 bs=32k && sync && sync

From Workstation


Backup

Entire SD card

dd if=/dev/mmcblk0 of=/path/to/backup.dd bs=32k && sync && sync

Kernel

dd if=/dev/mmcblk0p2 of=/path/to/zImage bs=32k && sync && sync

Initrd

dd if=/dev/mmcblk0p3 of=/path/to/initrd bs=32k && sync && sync

Restore

Entire SD card

dd if=/path/to/backup.dd of=/dev/mmcblk0 bs=32k && sync

Kernel

dd if=/path/to/zImage bs=32k of=/dev/mmcblk0p2 && sync

Initrd

dd if=/initrd bs=32k of=/dev/mmcblk0p3 && sync

From SBC


Backup

Entire card

# Determine the block size
eval $(sdctl)
dd if=/dev/nbd5 of=/path/to/backup.dd bs=512 count=$cardsize_sectors conv=sync && sync

Kernel

sdctl -R 4096 -z 512 --seek part1 > kernel

Initrd

sdctl -R 4096 -z 512 --seek part2 > initrd

Restore

The entire card from SBC

dd if=/path/to/2gbsd-noeclipse-latest.dd bs=512 conv=sync of=/dev/nbd5 && sync

Kernel

dd if=/mnt/root/zImage bs=512 conv=sync of=/dev/nbd7 && sync

Initrd

dd if=/mnt/root/initrd bs=512 conv=sync of=/dev/nbd8 && sync