• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
UBports Robot Logo UBports Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

Set partition sizes when flashing

Scheduled Pinned Locked Moved OS
partition sizesresizingroot partitionflashinginstalling
42 Posts 15 Posters 14.5k Views 5 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • U Offline
      UniSuperBox
      last edited by 15 Oct 2018, 23:27

      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/.

      D 1 Reply Last reply 16 Oct 2018, 04:19 Reply Quote 0
      • V Offline
        vandys
        last edited by 16 Oct 2018, 01:10

        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!

        1 Reply Last reply Reply Quote 0
        • D Offline
          doniks @UniSuperBox
          last edited by 16 Oct 2018, 04:19

          @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?

          1 Reply Last reply Reply Quote 1
          • H Offline
            haveaniceday
            last edited by 18 Oct 2018, 07:55

            @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! πŸ˜‰

            V A M 3 Replies Last reply 19 Oct 2018, 01:15 Reply Quote 2
            • V Offline
              vandys @haveaniceday
              last edited by 19 Oct 2018, 01:15

              @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.

              1 Reply Last reply Reply Quote 0
              • A Offline
                arubislander @haveaniceday
                last edited by 19 Oct 2018, 16:02

                @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?

                πŸ‡¦πŸ‡Ό πŸ‡³πŸ‡± πŸ‡ΊπŸ‡Έ πŸ‡ͺπŸ‡Έ
                Happily running Ubuntu Touch
                Google Pixel 3a (20.04 DEV)
                JingPad (24.04 preview)
                Meizu Pro 5 (16.04 DEV)

                1 Reply Last reply Reply Quote 0
                • H Offline
                  halucigenia
                  last edited by 29 Oct 2018, 14:31

                  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. πŸ˜‰

                  Nexus4, Meizu MX4, Meizu Pro5, PinePhone UBPorts edition, PineTab, Pixel 3a XL

                  D 1 Reply Last reply 29 Oct 2018, 18:01 Reply Quote 0
                  • D Offline
                    doniks @halucigenia
                    last edited by 29 Oct 2018, 18:01

                    @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 πŸ˜‰

                    1 Reply Last reply Reply Quote 0
                    • M Offline
                      myii @haveaniceday
                      last edited by 19 Nov 2018, 03:10

                      @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.

                      1 Reply Last reply Reply Quote 0
                      • L Offline
                        L-00117 Banned @doniks
                        last edited by 30 Nov 2018, 16:06

                        This post is deleted!
                        1 Reply Last reply Reply Quote 0
                        • M Offline
                          myii
                          last edited by 27 Dec 2018, 21:31

                          Apologies to all for the mass call-outs used in this post -- I wouldn't usually do this. I've encountered a situation where extending rootfs and all subsequent customisations are lost. I'm sharing this as a warning for those who have already resized, a caveat for those considering to do so, and as a discussion point for how to move forwards.

                          Switching the release channel loses the extended rootfs

                          With hindsight, there's nothing surprising about this since the process of switching channels replaces /userdata/ubuntu.img.

                          @haveaniceday above:

                          Of course, this will probably break OTA updates...

                          @UniSuperBox above:

                          The image file can be resized, and I'm considering ways to make ubports-qa do this in case the user would prefer to use apt and turn off system-image upgrades.

                          I never had any issues with OTA updates, even after some fairly extensive hacking and customisations. Other than switching the channel, what other system-image upgrades could lead to this outcome?

                          Moving forward

                          @haveaniceday above:

                          I'll just repeat the steps for each release.

                          Essentially, this is all that can be done. But I managed to do some decent testing and found that this reconfiguration process can be made much easier. In my case, I made promising progress with SaltStack configuration management. Solutions involving tools such as this become viable once rootfs has been extended (in that the necessary packages can be installed). It wouldn't be too difficult to have a repo for collecting formulas that help automate this.

                          @vandys @arubislander @doniks Since you all appear to have gone through the resizing process, I hope you don't mind me drawing your attention to this post.

                          1 Reply Last reply Reply Quote 1
                          • M Offline
                            myii
                            last edited by 28 Dec 2018, 08:24

                            One strange experience to share about extending rootfs after switching the release channel. Following the instructions above, using 6000 worked fine for the rc channel. However, after switching to the dev channel, I couldn't get this to work for that value, no matter how many times I resized and rebooted. I did manage to get other sizes to work, though. Ultimately, I settled for 6144 (6 * 1024) to get 6.0GB, i.e.:

                            dd if=/dev/null of=/userdata/ubuntu.img bs=1M seek=6144 count=0
                            
                            1 Reply Last reply Reply Quote 0
                            • U Offline
                              UniSuperBox
                              last edited by UniSuperBox 28 Dec 2018, 16:49

                              Most system-image upgrades are differential, where only the changes from one image to the next are downloaded and applied. So, any updates in upstream Ubuntu as well as our own packages are changed. If you run sudo apt dist-upgrade, you will already have these newer packages and won't see any changes when the upgrade happens. This could be seen as a bug or a feature depending on who you are. It's a bug in that an image may not be in a known good state after an upgrade.

                              Upgrades which download a whole system image will always rewrite all of your changes. Full updates will happen in the following scenarios:

                              • You specify a full upgrade to system-image (There's a way to do this, but I'm not sure how at this time)
                              • The system-image-server does not have a diff from the image you are using to the new image (you've skipped a few updates, for example I went from devel 2018-12-21 to 2018-12-28 today and had to download the full image)
                              • You are switching release channels

                              This is why I said that ubports-qa should disable system-image updates. After you've changed your system image, it is no longer in a known good state and may behave in unexpected ways.

                              M 1 Reply Last reply 28 Dec 2018, 20:38 Reply Quote 1
                              • M Offline
                                myii @UniSuperBox
                                last edited by 28 Dec 2018, 20:38

                                @unisuperbox Fantastic, detailed explanation -- appreciate you taking the time to go through that.

                                • The system-image-server does not have a diff from the image you are using to the new image (you've skipped a few updates, for example I went from devel 2018-12-21 to 2018-12-28 today and had to download the full image)

                                This leaves me with some food for thought since it appears that I've increased my risk of this happening by switching to the dev channel.

                                This is why I said that ubports-qa should disable system-image updates. After you've changed your system image, it is no longer in a known good state and may behave in unexpected ways.

                                Is there a simple way of testing this out in the meantime?

                                1 Reply Last reply Reply Quote 0
                                • K Offline
                                  KrisJace
                                  last edited by 8 Jan 2019, 09:19

                                  I have been rad with the Nexus5 where rootfs is not constrained by a small physical partition size. I wish all devices could be converted to that layout.
                                  So far I enabled very easy resizing of rootfs via atuTools4UT: https://sourceforge.net/projects/all-things-ubuntu-library/files/releases/

                                  And the related portion in the sourcecode: https://sourceforge.net/p/all-things-ubuntu-library/code/HEAD/tree/trunk/ATUpackages/ATU/ATU-src/atulib.pas#l1329

                                  Currently working on a GUI for also resizing rootfs based on physical partition layout, ie. on Meizu PRO 5. Not sure if I will be able to do it on-device, but am still exploring this possibility, even using pivot chroot method.

                                  1 Reply Last reply Reply Quote 3
                                  • R Offline
                                    rooty
                                    last edited by rooty 7 Jan 2019, 21:04 1 Jul 2019, 20:36

                                    Hi,

                                    Please help me, I'm confused...

                                    So I'm trying to increase my root, did following:

                                    dd if=/dev/null of=/userdata/ubuntu.img bs=1M seek=6144 count=0
                                    e2fsck -p /userdata/ubuntu.img
                                    resize2fs /userdata/ubuntu.img
                                    

                                    got this

                                    root@ubuntu-phablet:~# ls -lahi /userdata/
                                    total 3.9G
                                          2 drwxrwx--x.  5 system      system           4.0K Jul  1 12:08 .
                                          2 drwxr-xr-x  23 lxc-dnsmasq systemd-timesync 4.0K Apr 30 19:54 ..
                                    1310721 drwxrwx--x  23 system      system           4.0K Jul  1 13:21 android-data
                                         22 -rw-r--r--   1 root        root                2 Oct 13  1970 .last_ubuntu-build
                                         21 -rw-rw-rw-   1 root        root                0 Oct 13  1970 .last_update
                                         13 -rw-------.  1 root        root                2 Jan  7  1970 .layout_version
                                         11 -rw-------   1 root        root              32M Oct 13  1970 SWAP.img
                                     131073 drwxr-xr-x   5 root        root             4.0K Oct 13  1970 system-data
                                         19 -rw-------   2 root        root             6.0G Oct 14  1970 system.img
                                         19 -rw-------   2 root        root             6.0G Oct 14  1970 ubuntu.img
                                     655361 drwxr-xr-x   3 root        root             4.0K Oct 13  1970 user-data
                                    
                                    root@ubuntu-phablet:/userdata# parted ubuntu.img
                                    GNU Parted 3.2
                                    Using /userdata/ubuntu.img
                                    Welcome to GNU Parted! Type 'help' to view a list of commands.
                                    (parted) print
                                    Model:  (file)
                                    Disk /userdata/ubuntu.img: 6442MB
                                    Sector size (logical/physical): 512B/512B
                                    Partition Table: loop
                                    Disk Flags:
                                    
                                    Number  Start  End     Size    File system  Flags
                                     1      0.00B  6442MB  6442MB  ext2
                                    
                                    

                                    already did reboot couple times and still getting

                                    root@ubuntu-phablet:~# df -h /
                                    Filesystem      Size  Used Avail Use% Mounted on
                                    /dev/loop0      2.0G  1.8G   82M  96% /
                                    

                                    my specs:
                                    nexus 5
                                    Ubuntu 16.04.6 LTS

                                    p.s.
                                    All Things Ubuntu Library does not work for me

                                    root@ubuntu-phablet:~# ./ATU_arm-linux
                                    ./ATU_arm-linux: error while loading shared libraries: libgdk-x11-2.0.so.0: cannot open shared object file: No such file or directory
                                    root@ubuntu-phablet:~# ldd ./ATU_arm-linux
                                    	libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0xb6f01000)
                                    	libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0xb6eee000)
                                    	libgdk-x11-2.0.so.0 => not found
                                    	libX11.so.6 => /usr/lib/arm-linux-gnueabihf/libX11.so.6 (0xb6dfd000)
                                    	libgdk_pixbuf-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libgdk_pixbuf-2.0.so.0 (0xb6dd4000)
                                    	libgtk-x11-2.0.so.0 => not found
                                    	libgobject-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libgobject-2.0.so.0 (0xb6d8b000)
                                    	libglib-2.0.so.0 => /lib/arm-linux-gnueabihf/libglib-2.0.so.0 (0xb6cb3000)
                                    	libgthread-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libgthread-2.0.so.0 (0xb6ca1000)
                                    	libgmodule-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libgmodule-2.0.so.0 (0xb6c8e000)
                                    	libpango-1.0.so.0 => /usr/lib/arm-linux-gnueabihf/libpango-1.0.so.0 (0xb6c48000)
                                    	libcairo.so.2 => /usr/lib/arm-linux-gnueabihf/libcairo.so.2 (0xb6b90000)
                                    	libatk-1.0.so.0 => /usr/lib/arm-linux-gnueabihf/libatk-1.0.so.0 (0xb6b69000)
                                    	libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6a7d000)
                                    	/lib/ld-linux-armhf.so.3 (0xb6f38000)
                                    	libxcb.so.1 => /usr/lib/arm-linux-gnueabihf/libxcb.so.1 (0xb6a59000)
                                    	libgio-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libgio-2.0.so.0 (0xb6956000)
                                    	libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0xb68de000)
                                    	libffi.so.6 => /usr/lib/arm-linux-gnueabihf/libffi.so.6 (0xb68c8000)
                                    	libpcre.so.3 => /lib/arm-linux-gnueabihf/libpcre.so.3 (0xb686b000)
                                    	libthai.so.0 => /usr/lib/arm-linux-gnueabihf/libthai.so.0 (0xb6855000)
                                    	libpixman-1.so.0 => /usr/lib/arm-linux-gnueabihf/libpixman-1.so.0 (0xb67cb000)
                                    	libfontconfig.so.1 => /usr/lib/arm-linux-gnueabihf/libfontconfig.so.1 (0xb678e000)
                                    	libfreetype.so.6 => /usr/lib/arm-linux-gnueabihf/libfreetype.so.6 (0xb6717000)
                                    	libpng12.so.0 => /lib/arm-linux-gnueabihf/libpng12.so.0 (0xb66ef000)
                                    	libxcb-shm.so.0 => /usr/lib/arm-linux-gnueabihf/libxcb-shm.so.0 (0xb66dc000)
                                    	libxcb-render.so.0 => /usr/lib/arm-linux-gnueabihf/libxcb-render.so.0 (0xb66c4000)
                                    	libXrender.so.1 => /usr/lib/arm-linux-gnueabihf/libXrender.so.1 (0xb66ad000)
                                    	libXext.so.6 => /usr/lib/arm-linux-gnueabihf/libXext.so.6 (0xb6692000)
                                    	libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0xb6670000)
                                    	librt.so.1 => /lib/arm-linux-gnueabihf/librt.so.1 (0xb665a000)
                                    	libXau.so.6 => /usr/lib/arm-linux-gnueabihf/libXau.so.6 (0xb664e000)
                                    	libXdmcp.so.6 => /usr/lib/arm-linux-gnueabihf/libXdmcp.so.6 (0xb663a000)
                                    	libselinux.so.1 => /lib/arm-linux-gnueabihf/libselinux.so.1 (0xb6615000)
                                    	libresolv.so.2 => /lib/arm-linux-gnueabihf/libresolv.so.2 (0xb65f5000)
                                    	libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0xb65cd000)
                                    	libdatrie.so.1 => /usr/lib/arm-linux-gnueabihf/libdatrie.so.1 (0xb65b8000)
                                    	libexpat.so.1 => /lib/arm-linux-gnueabihf/libexpat.so.1 (0xb6590000)
                                    
                                    1 Reply Last reply Reply Quote 0
                                    • R Offline
                                      rooty
                                      last edited by 2 Jul 2019, 05:07

                                      ok, so I was not able to accomplish this task from inside my phone, for some reason modified filesystem's size shrinks back to 2GB even tho I run resize2fs few times. Partition was fine tho, it just FS.

                                      For those who's trying to solve this issue:
                                      Was able to change the file system size from a host, connecting the phone to my laptop and running

                                      adb shell  # phone in recovery mode
                                      e2fsck -f -y system.img
                                      resize2fs -fp system.img
                                      
                                      S 1 Reply Last reply 27 Aug 2019, 11:29 Reply Quote 0
                                      • S Offline
                                        simbion @rooty
                                        last edited by simbion 27 Aug 2019, 11:29

                                        @rooty
                                        I managed to do it to expand the system partition from 2GB to 6GB. Went into recovery mode UBports:
                                        simbion@simbion:~/1$ adb devices
                                        simbion@simbion:~/1$ adb pull /data/system.img
                                        simbion@simbion:~/1$ dd if=/dev/null of=system.img bs=1M seek=6144 count=0
                                        simbion@simbion:~/1$ e2fsck -p system.img
                                        simbion@simbion:~/1$ resize2fs system.img
                                        simbion@simbion:~/1$ adb push system.img /data
                                        The process is not fast. After that, I have all the updates and applications began to be installed. It would be nice if did it in UBports when you install to select how much you need to under system.

                                        dobeyD 1 Reply Last reply 27 Aug 2019, 13:42 Reply Quote 1
                                        • dobeyD Offline
                                          dobey @simbion
                                          last edited by 27 Aug 2019, 13:42

                                          @simbion said in Set partition sizes when flashing:

                                          It would be nice if did it in UBports when you install to select how much you need to under system.

                                          Installing packages with apt and resizing the rootfs is not supported. Nobody needs it, though you might want it.

                                          L 1 Reply Last reply 11 Sept 2019, 20:11 Reply Quote -1
                                          • L Offline
                                            L-00327 Banned @dobey
                                            last edited by 11 Sept 2019, 20:11

                                            @dobey then what can you do with ubuntu touch can you run snapd on my oneplus one, it is open source how can I get full space for my apt-get not just reserved for storage? already mounted r/w permanently with one liner $ adb shell

                                            $ sudo touch /userdata/.writable_image

                                            $ sudo reboot
                                            If i could manage to somehow free up this space I'd be gucci for installing full web apps again, this didn't happen when I used to install it with multirom. Does anyone know if deleting the lock file will help thanks

                                            dobeyD 1 Reply Last reply 11 Sept 2019, 21:05 Reply Quote 0
                                            • First post
                                              Last post