TS-4900 MicroSD Backup/restore: Difference between revisions

From embeddedTS Manuals
No edit summary
No edit summary
Line 1: Line 1:
These instructions assume you have an SD card with one partition.  Most SD cards ship this way by default.  If the card has had its partition table modified this can be corrected with a tool like gparted or fdisk.
These instructions assume you have an SD card with one partition.  Most SD cards ship this way by default.  If the card has had its partition table modified this can be corrected with a tool like gparted or fdisk.


Plug the SD card into a USB reader and connect it to your Linux PC.   
Plug the SD card into a USB reader and connect it to your Linux PC.  Newer distributions include a utility called "lsblk" which lists all block devices like a USB SD card reader:
These instructions assume your SD interface is /dev/sdc, but check dmesg in your PC to see what
<source lang=bash>
lsblk
</source>
  NAME  MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
  sdY      8:0    0  400G  0 disk
  ├─sdY1  8:1    0  398G  0 part /
  ├─sdY2  8:2    0    1K  0 part
  └─sdY5  8:5    0    2G  0 part [SWAP]
  sr0    11:0    1  1024M  0 rom 
  sdX      8:32  1  3.9G  0 disk
  ├─sdX1  8:33  1  7.9M  0 part
  ├─sdX2  8:34  1    2M  0 part
  ├─sdX3  8:35  1    2M  0 part
  └─sdX4  8:36  1  3.8G  0 part 
 
In this case the SD card is 4GB, so sdX is the target device.  Note that on your system, sdX will not be a real device, it could be sda, sdb, mmcblk0, etc.  Technologic Systems is not responsible for any damages cause by using the improper device node for imaging an SD card.
 
After plugging in the device after Linux has booted you can use dmesg to print out the kernel log.  When the USB drive is added it will append to the end of that file.  Try running:
<source lang=bash>dmesg | tail -n 100</source>
 
  scsi 54:0:0:0: Direct-Access    Generic  Storage Device  0.00 PQ: 0 ANSI: 2
  sd 54:0:0:0: Attached scsi generic sg2 type 0
  sd 54:0:0:0: [sdX] 3862528 512-byte logical blocks: (3.97 GB/3.84 GiB)
 
In this case, sdXc is shown as a 3.97GB card.  Note that on your system, sdX will not be a real device, it could be sda, sdb, mmcblk0, etc.  Technologic Systems is not responsible for any damages cause by using the improper device node for imaging an SD card.


Running these commands will reflash the SD card to our default latest image.
Running these commands will reflash the SD card to our default latest image.
Line 8: Line 32:
<source lang=bash>
<source lang=bash>
# Verify nothing else has this mounted
# Verify nothing else has this mounted
sudo umount /dev/sdc1
sudo umount /dev/sdX1


sudo mkfs.ext3 /dev/sdc1
sudo mkfs.ext3 /dev/sdX1
sudo mkdir /mnt/sd
sudo mkdir /mnt/sd
sudo mount /dev/sdc1 /mnt/sd/
sudo mount /dev/sdX1 /mnt/sd/
wget ftp://ftp.embeddedarm.com/ts-socket-macrocontrollers/ts-4900-linux/distributions/yocto/fido/ts-x11-image-tsimx6-latest.tar.bz2
wget ftp://ftp.embeddedarm.com/ts-socket-macrocontrollers/ts-4900-linux/distributions/yocto/fido/ts-x11-image-tsimx6-latest.tar.bz2


Line 23: Line 47:
After it is written you can verify the data was written correctly.  Reinsert the disk to verify any block cache is gone, then run these:
After it is written you can verify the data was written correctly.  Reinsert the disk to verify any block cache is gone, then run these:
<source lang=bash>
<source lang=bash>
mount /dev/sdc1 /mnt/sd
mount /dev/sdX1 /mnt/sd
cd /mnt/sd/
cd /mnt/sd/
sudo md5sum -c md5sums.txt
sudo md5sum -c md5sums.txt

Revision as of 12:19, 2 March 2017

These instructions assume you have an SD card with one partition. Most SD cards ship this way by default. If the card has had its partition table modified this can be corrected with a tool like gparted or fdisk.

Plug the SD card into a USB reader and connect it to your Linux PC. Newer distributions include a utility called "lsblk" which lists all block devices like a USB SD card reader:

lsblk
 NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
 sdY      8:0    0   400G  0 disk 
 ├─sdY1   8:1    0   398G  0 part /
 ├─sdY2   8:2    0     1K  0 part 
 └─sdY5   8:5    0     2G  0 part [SWAP]
 sr0     11:0    1  1024M  0 rom  
 sdX      8:32   1   3.9G  0 disk 
 ├─sdX1   8:33   1   7.9M  0 part 
 ├─sdX2   8:34   1     2M  0 part 
 ├─sdX3   8:35   1     2M  0 part 
 └─sdX4   8:36   1   3.8G  0 part  

In this case the SD card is 4GB, so sdX is the target device. Note that on your system, sdX will not be a real device, it could be sda, sdb, mmcblk0, etc. Technologic Systems is not responsible for any damages cause by using the improper device node for imaging an SD card.

After plugging in the device after Linux has booted you can use dmesg to print out the kernel log. When the USB drive is added it will append to the end of that file. Try running:

dmesg | tail -n 100
 scsi 54:0:0:0: Direct-Access     Generic  Storage Device   0.00 PQ: 0 ANSI: 2
 sd 54:0:0:0: Attached scsi generic sg2 type 0
 sd 54:0:0:0: [sdX] 3862528 512-byte logical blocks: (3.97 GB/3.84 GiB)

In this case, sdXc is shown as a 3.97GB card. Note that on your system, sdX will not be a real device, it could be sda, sdb, mmcblk0, etc. Technologic Systems is not responsible for any damages cause by using the improper device node for imaging an SD card.

Running these commands will reflash the SD card to our default latest image.

# Verify nothing else has this mounted
sudo umount /dev/sdX1

sudo mkfs.ext3 /dev/sdX1
sudo mkdir /mnt/sd
sudo mount /dev/sdX1 /mnt/sd/
wget ftp://ftp.embeddedarm.com/ts-socket-macrocontrollers/ts-4900-linux/distributions/yocto/fido/ts-x11-image-tsimx6-latest.tar.bz2

sudo tar -xf ts-x11-image-tsimx6-latest.tar.bz2 -C /mnt/sd
sudo umount /mnt/sd
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 it is written you can verify the data was written correctly. Reinsert the disk to verify any block cache is gone, then run these:

mount /dev/sdX1 /mnt/sd
cd /mnt/sd/
sudo md5sum -c md5sums.txt
umount /mnt/sd
sync

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