Set partition sizes when flashing


  • Community

    No, actually...

    The devices which Canonical shipped have Ubuntu Touch installed on their /system partition. It is generally unsafe to resize this partition because Android devices are weird... More akin to a doomsday than stepping on a Lego

    The others (the Nexus 5, Oneplus One, and Fairphone 2) are installed to an image file which resides on /data/.



  • FWIW, on the Nexus 5 I found it on /userdata/system.img
    I'm very tempted to up-size the image file and see if I can get a bigger root!



  • @unisuperbox assume someone has a device that currently installs into the partition. and assume they are sufficiently motivated and prepared to deal with the occasional footbullet. how would they go about installing their device with an image file?



  • @vandys I just did this on a M10 frieza an it worked like a charm.

    sudo -s
    dd if=/dev/null of=/userdata/ubuntu.img bs=1M seek=6000 count=0
    resize2fs -f /userdata/ubuntu.img                                            
    reboot
    

    How I understand it, it writes zero bytes in the image file after skipping 6GB. This leads to growth of the image file. Then resize2fs is used to grow the ext4 to the full extend of this file. The reboot is necessary to make the kernel aware about the changed filesystem.
    Now, the root partition is big enough for all the apt goodness:

    phablet@ubuntu-phablet:~$ ls -lash /userdata/ubuntu.img 
    2.6G -rw------- 2 root root 5.9G Oct 18 09:34 /userdata/ubuntu.img
    phablet@ubuntu-phablet:~$ df -h /
    Filesystem      Size  Used Avail Use% Mounted on
    /dev/loop0      5.8G  2.3G  3.3G  41% /
    

    Warning: could have bad consequences for your phone. Execute the commands without much interruption - especially if your root partition is already mounted rw. You don't want to corrupt your filesystem.

    Have fun with it! 😉



  • @haveaniceday said in Set partition sizes when flashing:

    @vandys I just did this on a M10 frieza an it worked like a charm.

    "Fools rush in where angels fear to tread". Given your prompting, I did it too (ubuntu.img and
    system.img appear to be two links to the same underlying inode) and... success. I now have
    lots of room on my partition for any more packages. Very nice! So mark as a workable
    technique on Nexus 5, too. Many thanks.



  • @haveaniceday
    This worked for me too. Thanks for that.

    What I can't seem to figure out though, is where the extra space is being deducted from. I had expected that the free space on /userdata would be reduced, but that doesn't seem to be the case. But this space must be coming at the expence of something, shouldn't it?



  • I for one, as a user rather than a developer, think that the policy should be that things should be as un-footshootable as possible no matter how much rope that you might give us. ;)



  • @halucigenia not to worry. youll be able to sleep easy while youre staying away from commandline tools of which youre not sure what they do like ubports-qa ;)



  • @haveaniceday Fantastic, thank you very much for this. Another happy Nexus 5 user. After the first reboot, df -h / wasn't showing any change while the ls was. Ran the resize2fs -f /userdata/ubuntu.img again and rebooted a couple more times and finally succeeded. Just in case anyone else has similar issues when attempting this.


  • Banned

    This post is deleted!


Looks like your connection to UBports Forum was lost, please wait while we try to reconnect.