How to resize the rootfs?

How to resize the footfs size? like, allocate more or all UFS space for rootfs? Thanks!

android or open embedded?

Hi ric,

Currently, I’m using debian rootfs. any idea? I saw script like “” for other 96 boards?

What I do is to flash rootfs to “userdata” instead of “system”
fastboot flash userdata footfs.img
Then on boot edit the grub to use sda13 to boot.
This gives me about 24gb of space.
I have tried this successfully on open embedded root fs, not sure about debian.

Resizing rootfs means repartitioning the sdd disk. Certain named partitions can’t be simply deleted because their names are hardcoded into xloader (initial closed source bootloader on the sda disk). I think eventually it should be possible to move minimal uefi and nvme to sdc disk, leaving the whole sdd for use with debian.

Hi ric, helg. Thank you for the information. I tried a lot of stuff. doesn’t work so far.

also, I tried to flash rootfs.img into userdata instead of system:
sudo fastboot flash userdata rootfs.img

But, I failed to point /dev/sdd13 (userdata) to boot. any ideas? I don’t know what I did wrong somewhere…

You can eventually modify the partition table (ptable.img), removing the userdata partition and resizing the system one to about 30GB.

1 Like

hi loic, thanks a lot. that sounds great! I will definite check that out. again, thank you loic :grin:

do you have uart/serial access to the devices? if so when the grub shows up press escape, the highlight the proper boot option and press ‘e’. here you will be able to change the boot partition.
once that is done press ctrl+x to boot

hi ric,

yes, I could access the device by uart/serial. I dont think I have the grub.

well, I modified the partition table (ptable.img) and it worked. you can have

a try! :slight_smile:

1 Like

cc @guodong
I am not able to recreate the current ptable.img file .
The partition-table-tool repository is out of sync.

@leo-yan @guodong

Your commit message contains the wrong partition data information. Compare

root@linaro-developer:~# fdisk   -l /dev/sdd
Device       Start     End Sectors  Size Type
/dev/sdd1      256     383     128  512K Microsoft basic data
/dev/sdd2      384     511     128  512K Microsoft basic data
/dev/sdd3      512    3583    3072   12M Microsoft basic data
/dev/sdd4     3584    5119    1536    6M Microsoft basic data
/dev/sdd5     5120   70655   65536  256M Microsoft basic data
/dev/sdd6    70656   70911     256    1M Microsoft basic data
/dev/sdd7    70912   87295   16384   64M Microsoft basic data
/dev/sdd8    87296   91391    4096   16M Microsoft basic data
/dev/sdd9    91392   91903     512    2M Microsoft basic data
/dev/sdd10   91904 1292031 1200128  4.6G Microsoft basic data
/dev/sdd11 1292032 1492735  200704  784M Microsoft basic data
/dev/sdd12 1492736 1495807    3072   12M Microsoft basic data
/dev/sdd13 1495808 7805951 6310144 24.1G Microsoft basic data

with your commit:

Ref, the new partition table is:
{PART_XLOADER_A,        0,         2*1024,          UFS_PART_0},/* xloader       2M     sda */
{PART_XLOADER_B,        0,         2*1024,          UFS_PART_1},/* reserved      2M     sdb */
{PART_PTABLE,           0,         1024,            UFS_PART_2},/* ptable        512K   sdc */
{PART_FRP,              1024,      7*1024,          UFS_PART_2},/* frp           512K   sdc1 */
{PART_PTABLE_LU3,       0,         1024,            UFS_PART_3},/* ptable_lu3    1M     sdd  */
{PART_VRL,              1024,       512,            UFS_PART_3},/* vrl           512K   sdd1 */
{PART_VRL_BACKUP,       1536,      512,             UFS_PART_3},/* vrl backup    512K   sdd2 */
{PART_FASTBOOT,         2*1024,      12*1024,       UFS_PART_3},/* fastboot      12M    sdd3 */
{PART_NVME,             14*1024,   6*1024,          UFS_PART_3},/* nvme          6M     sdd4 */
{PART_CACHE,            20*1024,   256*1024,        UFS_PART_3},/* cache         256M   sdd5 */
{PART_FW_LPM3,          276*1024,  1024,            UFS_PART_3},/* mcuimage      1M     sdd6 */
{PART_BOOT,             277*1024,  64*1024,         UFS_PART_3},/* boot          64M    sdd7 */
{PART_DTS,              341*1024,  16*1024,         UFS_PART_3},/* dtimage       16M    sdd8 */
{PART_TRUSTFIRMWARE,    357*1024,  2*1024,          UFS_PART_3},/* trustfirmware 2M     sdd9 */
{PART_SYSTEM,           359*1024,  4688*1024,       UFS_PART_3},/* system        4688M  sdd10 */
{PART_VENDOR,           5047*1024, 784*1024,        UFS_PART_3},/* vendor        784M   sdd11 */
{PART_FIP,              5831*1024, 12*1024,         UFS_PART_3},/* fip           12M    sdd12 */
{PART_USERDATA,         5843*1024, (4UL)*1024*1024, UFS_PART_3},/* userdata      4G     sdd13 */

Signed-off-by: Guodong Xu <>

PART_VRL and PART_VRL_BACKUP are undefined and the partition sizes don’t match.

This might explain the issues with your recent check in: “ptable.img: Updated for all partitions 1M byte alignment”

FAILED (remote: flash write back vrl failure)

We are in the middle of transmitting ptable.img to 1M byte aligned, as part
of our effort of transmitting to ATF/UEFI.

I believe you are talking about this branch: ,
which you are right doesn’t match ptable.img you saw in

Please give us some time to finish this transmission.

Thanks for looking into this, I appreciate your work on the ATF/UEFI transition.

Do you mind posting the correct partition table header file for the current ptable.img file? It would be great to be able to re-create the current ptable.img file.

PART_VRL is the same partition as PART_XLOADER_RESERVED1
and it is actually unused on hikey960. I don’t know what VRL stands for, but it is some scheme of code/data digital signature verification, which is also used in the first 4K of sec_*.img files.

Anyway, I ended up using a simple patch:

diff --git a/partition.h b/partition.h
index 78c684d..176dccc 100755
--- a/partition.h
+++ b/partition.h
@@ -44,10 +44,7 @@ static const struct partition partition_table_ufs[] =
   {PART_BOOT,             289*1024,  64*1024,         UFS_PART_3},/* boot          64M   sdd7 */
   {PART_DTS,              353*1024,  16*1024,         UFS_PART_3},/* dtimage       16M   sdd8 */
   {PART_TRUSTFIRMWARE,    369*1024,  2*1024,          UFS_PART_3},/* trustfirmware 2M    sdd9 */
-  {PART_SYSTEM,           371*1024,  4688*1024,       UFS_PART_3},/* system        4688M sdd10 */
-  {PART_VENDOR,           5059*1024, 784*1024,        UFS_PART_3},/* vendor        784M  sdd11 */
-  {PART_RESERVED,         5843*1024, 1024,            UFS_PART_3},/* reserved      1M    sdd12 */
-  {PART_USERDATA,         5844*1024, (24646UL)*1024,  UFS_PART_3},/* userdata      24G   sdd13 */
+  {PART_SYSTEM,           371*1024,  30122*1024,       UFS_PART_3},/* system       30122M sdd10 */
   {"0", 0, 0, 0},

Hi @Robert

Does the following work for you?

dd if=/dev/urandom of=rand bs=1k count=3000000

This is causing the board to crash immediately without any debug output under /var/log/…

So, the correct partition table header file for the current ptable.img file:

$ git show 7137222
commit 7137222e25e2ebc7d45084d5e85fe2558b84c599
Author: Chen Feng

You can build from this commit.


@guodong , Thanks but this is still not the right partition table.

Just compare the md5sums:
f383f268b7e4195b46de03209a5804ab tools-images-hikey960/ptable.img
4a9e3b58621865d698b3ff03e06e54a1 partition-table-tool/ptable.img

Am I doing something wrong?

I use this link( generate ptable.img:
ter$ ./efipartition ptable.img
[efipartition]: version = 1.0
[efipartition]: ufs ptable info is :
partition[0], name:xloader_a, size is 2048 KB
partition[1], name:xloader_b, size is 2048 KB
partition[2], name:ptable, size is 1024 KB
partition[3], name:frp, size is 7168 KB
partition[4], name:ptable_lu3, size is 1024 KB
partition[5], name:xloader_reserved1, size is 1024 KB
partition[6], name:fastboot, size is 12288 KB
partition[7], name:nvme, size is 6144 KB
partition[8], name:fip, size is 12288 KB
partition[9], name:cache, size is 262144 KB
partition[10], name:fw_lpm3, size is 1024 KB
partition[11], name:boot, size is 65536 KB
partition[12], name:dts, size is 16384 KB
partition[13], name:trustfirmware, size is 2048 KB
partition[14], name:system, size is 25280512 KB
partition[15], name:vendor, size is 802816 KB
partition[16], name:reserved, size is 1024 KB
partition[17], name:userdata, size is 4757504 KB
efi partition bin file “ptable.img” gen succeed!

when i flash ptable.img and other images to the board, I encountered the following problems:

Press RETURN or SPACE key to quit.
Fastboot platform: check for partition-type:ptable
Downloading 200704 bytes
200704 / 200704 bytes downloaded (100%)
Flashing partition ptable
Fastboot platform: No GPT on flash. Fastboot on Versatile Express does not support MBR.
Warning: Failed to read partitions from Android NVM device (status: Device Error)
Fastboot platform: check for partition-type:xloader
Downloading 154752 bytes
154752 / 154752 bytes downloaded (100%)
Flashing partition xloader
Fastboot platform: check for partition-type:fastboot
Downloading 1081344 bytes
1081344 / 1081344 bytes downloaded (100%)
Flashing partition fastboot
No such partition.
Fastboot platform: check for partition-type:fip
Downloading 1237488 bytes
1237488 / 1237488 bytes downloaded (100%)
Flashing partition fip
No such partition.
Fastboot platform: check for partition-type:boot
Downloading 67108864 bytes
67108864 / 67108864 bytes downloaded (100%)
Flashing partition boot
No such partition.
Fastboot platform: check for partition-type:system
Erasing partition system
Couldn’t erase image: Not Found
Can anyone help me?Thank you