I have an ext4 partition containing rootfs.

I need to implement a system update (uboot) which just extracts and writes the new rootfs image. This probably works like dd-ing the image into MMC flash to offset where the rootfs ext4 partition is said to be.

We are doing first MMC erase and then MMC write. The erasing operation is very slow (1-2 minutes). I am thinking that it may not be necessary and just writing new rootfs will do the trick.

The question is, suppose I am writing rootfs image that is smaller than the previous one: then there will be some residual data at the end right? Wouldn't this cause some problem when we for example run fsck?

  • I am curious about how you are doing this. On mine I created a small linux kernel and rootfs that only resides in memory to update the mmc using busybox commands: fdisk, mkfs ... Will you post the command syntax you are using in u-boot. mmc write ....
    – jc__
    Jul 12, 2016 at 15:02

1 Answer 1


If the image that you are writing to the mmc is a complete partition with the file allocation table, then NO you do not need to erase or zero out the old space. The old 'random' data left is not part of a file and will be over-written as the space is used.

Remember that a mmc device has a finite number of writes in its life and that number of writes is much smaller that say a hard drive.

  • but how the fsck works? wouldnt it recognize it as some not recovered files?
    – nayana
    Jul 13, 2016 at 8:26
  • fsck = file system check. The file system has an index, File allocation table or fat. The fat has a list of what blocks are in use. The blocks not in use by the fat are determined to be free. any 'data' on the free blocks is irreverent to the fat and the fat will place its own data there when it uses that block overwriting any existing 'noise'. This is an overly simplified example, but should help to answer your question.
    – jc__
    Jul 13, 2016 at 17:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.