How to resize system.img.raw under 13GB

Hi Sir/Madam,

I know the default “roorfssize” is 28GB and I can modify it to reduce the size of system.img.raw. But I found if I modify the rootfssize to 10GB, the size of system.img.raw is still 12.9GB.(it works if rootfssize > 13GB ). I found the rooffs is onlt about 5GB, so how could I reduce the size of system.img.raw under 13GB (ex: 10GB)?

I look into flash.sh, mksparse seems to be used to fill pattern but it is binary application. I don’t know to much pattern it fills. It looks like related to BLBlockSize but I can’t find its define.

Thank you
Best Regards,
Jason

Can I use this?

sudo ./flash.sh -S 10GiB -R ./rootfs / jetson-xavier mmcblk0p1

Thank you

Maybe there are some mistakes. To modify rootfssize also can work.

I can’t answer what will work. Some information though: Size would have to be a multiple of the block size of 512 bytes. This is further restricted that the size must evenly fit in the “-S #MiB” or “-S #GiB” specification. The mksparse fill pattern is a NULL byte, so you can do this manually from a raw image.

You do not need to flash a sparse image. If you place a raw image with the correct name in the correct place, then it will flash that image without issue (“bootloader/system.img”). Just use the flash.sh option “-r” to “reuse” the image and to not overwrite the one you are using.

If you loopback cover the system.img.raw, and then run something like “gparted” on the loopback device, then you should be able to set a reduced size. There are a number of ways to cut off the tail of excess bytes on the resulting file, though you’d want to remove loopback coverage first.

MiB => 10241024
GiB => 1024
1024*1024

I couldn’t tell you any specific minimum size.

Hi linuxdev,

Thank you for your information.