Start a new topic

Errors when creating SD-card image for TS-7553


I'm working on the TS-7553.

We recently moved to use the SD-card, instead of booting from XNAND.

In the current version I noticed the /usr/bin/mawk utility is missing from the main filesystem partition (we're booting from initrd, busybox).

Inspecting dmesg - I see errors:

    EXT3-fs error (device nbd9): htree_dirblock_to_tree: bad entry in directory #10056: rec_len % 4 != 0 - offset=8192, inode=1838169323, rec_len=25707, name_len=111

I'm suspecting the problem is in how I'm creating the image.

On an Ubuntu 14 VirtualBox machine I:

  1. Copy the original embeddedarm image, 2gbsd-noeclipse-mar292017.dd to MyImage.dd
  2. Loop-mount the filesystem partition
  3. Create directories, copy files, create symlinks, run sed on files
  4. umount
  5. Do similar stuff to the initrd partition.

After, I dd MyImage.dd to an SD-card...

*** If I dd the original image - no errors, and mawk exists.

Best Answer

Turns out I called `sdctl -P` too early in my startup script.

Removing the call fixed the issue.

Oh - reading the problematic SD-card on my Ubuntu - is fine... mawk file exists!

Only on the TS7553 the SD-card is corrupt.


The error indicates an issue from the filesystem layer.  From what I know of the output there could be one of a few possibilities.  I have listed them below in order of likelihood:

- Disk corruption.  This could occur anywhere along the line.  Care needs to be taken when using local mount points to ensure that all data is synced and properly unmounted.  Also note that resizing of partitions should be done with care.  Please ensure that all of the file operations you are running on the filesystem are valid and complete successfully and that you are not manipulating the image on disk while any partition of it is mounted.

- RAM corruption.  Test out the same SD card in another TS-7553 and see if the error occur.  Additionally you could install memtester on the device and run it on as much RAM as many times as you can.

- Bad SD card.  We have seen cards come from the factory with bad sectors that are not properly handled.  Try this with a new SD card and see what happens

I have verified that our stock image is correct and works without issue.  When creating a custom image, we suggest you ensure there is no filesystem damage by running an fsck on it.  Additionally, take an md5sum of the source image, and verify every disk created from that image reads back the same md5sum.  Ensure when writing the disk that you follow the instructions that we list in the TS-7553 manual:

I'm not resizing any partition, even changes in the small initfs partition are within the partition limits.

All partitions are umount-ed before loop-mounting.

I tested multiple SD-cards, on multiple TSs - all the same behavior.


Turns out I called `sdctl -P` too early in my startup script.

Removing the call fixed the issue.

Login or Signup to post a comment