On Tue, Jul 26, 2011 at 2:36 AM, Amir Goldstein <amir73il@xxxxxxxxx> wrote: > On Mon, Jul 25, 2011 at 9:10 PM, Ted Ts'o <tytso@xxxxxxx> wrote: >> On Sat, Jul 23, 2011 at 12:49:28AM +0900, Round Robinjp wrote: >>> Hi >>> >>> I have a question regarding making ext4 image for >>> large eMMC partition. >>> >>> We have a 4G partition in our embedded device >>> in which we want to use ext4 filesystem. >>> But for that we have to create a 4G image. >>> flashing this 4G image to the eMMC takes a long >>> time. Is there any way to reduce this time? >>> >>> For vfat, you can truncate the image leaving only >>> non zero-filled blocks which makes the image very >>> short and the time for flashing is reduced. >>> Is something similar to that possible for ext4? >> >> OK, so it's not obvious what problem you are trying to ask here. >> >> It sounds like Andreas was trying to help you solve the problem of >> minimizing the number of blocks written by mke2fs. >> >> I'm guessing the problem is you've already created a file system image >> which is 4G, and for which a large number of the blocks are not used, >> and you're trying to optimize the amount of time it takes to flash the >> image. Is that right? >> > > I am going to make a 3rd guess and we will see who was closest ;-) > My guess is that Round wan't a "short" image, just like he wrote. > vfat image can simply be truncated, because all initial blocks are at the > beginning of the partition. > > One could truncate the result of an ext4 image to quite less than 4G, > for example, if flex_bg is set to 32, all bitmaps are at the block group 0. > copies of the super block can be discarded, since one has the copy in > the image file. > > The only important piece of information, not in the beginning of the partition > is the super block of the journal, which is usually in the middle of the fs, > so one needs do some tricks to allocate the journal from group 0. > Is there a mke2fs option to do that? Now the fs is clean, so we can delete journal. After the image is flashed to the eMMC, we can add journal again. I think tune2fs can add and delete journal. Am I rgiht? Yongqiang. > > All-in-all, I think it should be easy to prepare a 4G image that could > be truncated > to one group (128M). > > Amir. > >> The way to do that is to use a program like zerofree.c (google it, or >> see attached) to make sure the non-used blocks are zero-filled, and >> then use a program like make-sparse.c (see the e2fsprogs sources, in >> the contrib directory) to only write the non-zero blocks to the flash >> device. >> >> Regards, >> >> - Ted >> > -- > To unsubscribe from this list: send the line "unsubscribe linux-ext4" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- Best Wishes Yongqiang Yang -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html