75XX MicroSD Recovery: Difference between revisions

From embeddedTS Manuals
No edit summary
No edit summary
Line 12: Line 12:
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 29:
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 50:
# 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 67:
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)
|}

Revision as of 09:55, 23 March 2012

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 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.

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 drive. Make sure you have any nbd devices unmounted before trying to restore new ones.

You can find the latest SD card image here. Make sure you decompress the image first before writing.

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