How to get a larger root partition on Touch












7















I'm trying to make Touch (14.10) work as an Ubuntu server. However the root partition is only 2 GB and is insufficient for the packages I need to install. Is there any way to get more space on the root partition?



Thus far I've tried:




  • resize2fs on /dev/loop0 won't work since the kernel doesn't support online resizing and I can't unmount root (ro doesn't cut it, even with -f).


  • Adding 2 GB to the end of /userdata/ubuntu.img works, but resize2fs on the file doesn't help.











share|improve this question























  • This is a very interesting question for a new user. Welcome to the community.

    – Akiva
    Aug 23 '14 at 6:40
















7















I'm trying to make Touch (14.10) work as an Ubuntu server. However the root partition is only 2 GB and is insufficient for the packages I need to install. Is there any way to get more space on the root partition?



Thus far I've tried:




  • resize2fs on /dev/loop0 won't work since the kernel doesn't support online resizing and I can't unmount root (ro doesn't cut it, even with -f).


  • Adding 2 GB to the end of /userdata/ubuntu.img works, but resize2fs on the file doesn't help.











share|improve this question























  • This is a very interesting question for a new user. Welcome to the community.

    – Akiva
    Aug 23 '14 at 6:40














7












7








7


3






I'm trying to make Touch (14.10) work as an Ubuntu server. However the root partition is only 2 GB and is insufficient for the packages I need to install. Is there any way to get more space on the root partition?



Thus far I've tried:




  • resize2fs on /dev/loop0 won't work since the kernel doesn't support online resizing and I can't unmount root (ro doesn't cut it, even with -f).


  • Adding 2 GB to the end of /userdata/ubuntu.img works, but resize2fs on the file doesn't help.











share|improve this question














I'm trying to make Touch (14.10) work as an Ubuntu server. However the root partition is only 2 GB and is insufficient for the packages I need to install. Is there any way to get more space on the root partition?



Thus far I've tried:




  • resize2fs on /dev/loop0 won't work since the kernel doesn't support online resizing and I can't unmount root (ro doesn't cut it, even with -f).


  • Adding 2 GB to the end of /userdata/ubuntu.img works, but resize2fs on the file doesn't help.








partitioning ubuntu-touch filesystem






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Aug 23 '14 at 2:25









user319608user319608

383




383













  • This is a very interesting question for a new user. Welcome to the community.

    – Akiva
    Aug 23 '14 at 6:40



















  • This is a very interesting question for a new user. Welcome to the community.

    – Akiva
    Aug 23 '14 at 6:40

















This is a very interesting question for a new user. Welcome to the community.

– Akiva
Aug 23 '14 at 6:40





This is a very interesting question for a new user. Welcome to the community.

– Akiva
Aug 23 '14 at 6:40










5 Answers
5






active

oldest

votes


















1














I had a similar problem, ultimately I decided to move my /usr to /home/usr (/home is mounted from 14G file system, which gives me plenty of space for additional packages).



This is a little bit hackish way to do this, but it seems to work for me. The follwing code examples are using $ to indicate that command should be run as normal user and # to indicate root user role (which can be gained either by sudo or loggig as root).





  1. Set password for root user, you will need the ability to log as the root in case you screw anything up with your /usr/bin/sudo. To do so:



    $ sudo su
    # passwd



  2. Copy contents of /usr preserving ownership and permissions:



    $ cd /usr
    $ sudo find . -depth -print0 | sudo cpio --null --sparse -pvd /home/usr/



  3. The next logical step would be to use fstab to mount /home/usr as /usr on boot, however all changes that I tried to make to the fstab were disappearing after rebooting Ubuntu. So I've created simple script to do the mounting, and saved it as /etc/init.d/bind.sh:



    #!/bin/sh
    if [ "X$1" = "Xstart" ]; then
    echo "Binding /home/usr to /usr..."
    chmod 4755 /home/usr/bin/passwd /home/usr/bin/chsh /home/usr/bin/pkexec /home/usr/bin/sudo /home/usr/bin/newgrp /home/usr/bin/gpasswd /home/usr/bin/chfn /home/usr/lib/pt_chown /home/usr/lib/eject/dmcrypt-get-device /home/usr/lib/openssh/ssh-keysign /home/usr/lib/dbus-1.0/dbus-daemon-launch-helper /home/usr/lib/policykit-1/polkit-agent-helper-1 /home/usr/lib/arm-linux-gnueabihf/oxide-qt/chrome-sandbox /home/usr/lib/arm-linux-gnueabihf/lxc/lxc-user-nic
    mount -o bind,suid /home/usr /usr
    echo "...done"
    fi


    The chmod line is needed, as I noticed that suid bit is sometimes missing after mounting. The list of the files that had the suid bit set on can be found by running # find /usr -user root -perm -4000 on the original /usr directory. Please note, that if you install anything later on which is using the suid bit it may become broken unless you add it to the list.



    You will need to create symbolic link in /etc/rcS.d for bind.sh:



     # ln -s /etc/init.d/bind.sh /etc/rcS.d/S36bind.sh


    Note: you might want to pick different number than 36 depending on the state of your /etc/rcS.d.



    Alternatively you can edit /lib/init/fstab as described here to have persistent changes in fstab.




  4. After rebooting the system should be now using /home/usr as /usr so hopefully you should have more space for additional packages. Note that old /usr still exists but is unreachable as long as the new directory is mounted.



    In case anything goes wrong you can return to previous state by renaming the symbolic link in /etc/rcS.d and rebooting:



     # mv /etc/rcS.d/S36bind.sh /etc/rcS.d/K36bind.sh







share|improve this answer


























  • seeying "Xstart" in your proposed solution made me think that this is not something you did on a Ubuntu Touch device, is it?

    – Kris Jace
    May 2 '17 at 7:48



















3














This solution worked for me:



https://github.com/plasma-mobile/plasma-phone-dev-setup/blob/master/usr/bin/resize-root-partition



Basically, it's KDE Plasma Mobile's super-simple install script. Just run it, take a nap, and you should have a 6 GB root partition.






share|improve this answer































    1














    Here's the quickest way I've figured out to do it.



    Warning:
    This may break your phone if typed incorrectly. Ensure you have full backups before beginning and are willing to make mistakes in case you lose all data on your phone.
    This example command resizes the root filesystem to 6GB, so if it's already bigger than that it will be truncated and your phone likely will become unbootable (until re-imaged). Only use this command if your root filesystem image is less than 6GB (the Ubuntu Touch default is 2GB).



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





    share|improve this answer
























    • can you explain to me a little better, how this works?

      – Alko
      Sep 29 '15 at 18:23



















    0














    Ok, here is the way that I did it on my meizu pro5. Your mileage may varry.



    O and you may brick your phone.



    Take this guide as a hint for your path to follow. Don't come back crying.



    Have a fresh phone made by ubuntu-device-flash. In the phone you should have an SD card big enough to hold the fs from the userdata partition plus 512M plus 700M for the custom and cache partition.




    • put twrp3.0 as the recovery image.

    • use fdisk -l /dev/block/sda to see the partitions.

    • save that report. You should have the last 4 partition as system, custom, cache and userdata.

    • mkdir /tmp/userdata

    • mount /dev/block/sda44 (for me it was 44) /tmp/userdata

    • cd /tmp

    • tar -czf /external_sd/userdata.tar.gz userdata

    • umount /tmp/userdata

    • dd if=/dev/block/sda43 of=/externa_sd/cache.img

    • dd if=/dev/block/sda42 of=/externa_sd/custom.img


    You now have saved the data, now to redo the partitions we will use the fdisk from ubuntu since the fdisk from twrp is not good enough.




    • mkdir /tmp/ubuntu

    • mount -o loop /system/var/lib/lxc-andoid/system.img /tmp/ubuntu

    • mknod -m 666 b 8 0 /tmp/ubuntu/dev/sda

    • chroot /tmp/ubuntu /sbin/fdisk /dev/sda


    You delete the 41,42,43,44 partitions and create :




    • a new 41 starting from the same place but bigger.

    • a new 42 starting after 41 with the same size as the old 42.

    • a new 43 starting after 42 with the same size as the old 43.

    • a new 44 starting after 43 and ending on the same sector as the old 44.

    • save the new partition table

    • umount /tmp/ubuntu


    Put back the userdata, custom and cache.




    • dd if=/externa_sd/cache.img of=/dev/block/sda43

    • dd if=/externa_sd/custom.img of=/dev/block/sda42

    • create a new ext4 on 44: mke2fs /dev/block/sda44

    • mount /dev/block/sda44 /tmp/userdata

    • cd /tmp

    • tar -xzf /external_sd/userdata.tar.gz

    • umount /tmp/userdata

    • umount /tmp/ubuntu

    • umount /system

    • increase now the system partition: resize2fs /dev/block/sda41


    You should now have a bigger root partition in your ubuntu-touch system.



    Have fun.






    share|improve this answer

































      0














      After some more play here is what you need to know and do.



      Ubuntu touch is booting from an android device so the partions have to be apropiate.



      The android system is identifying the partitions by the partition label.



      You have for meizu pro 5 this partitions: system (the root partition), cache (used for upgrates by Ubuntu, you should have about 1G on it), custom (no idea what is used for), userdata (used for /home and a lot of other folders that are mounted with bind to different parts of the root)



      phablet@ubuntu-phablet:~$ sudo fdisk /dev/sda

      Welcome to fdisk (util-linux 2.25.2).

      Changes will remain in memory only, until you decide to write them.

      Be careful before using the write command.


      Command (m for help): x

      Expert command (m for help): p
      Disk /dev/sda: 58.2 GiB, 62537072640 bytes, 15267840 sectors
      Units: sectors of 1 * 4096 = 4096 bytes
      Sector size (logical/physical): 4096 bytes / 16384 bytes
      I/O size (minimum/optimal): 16384 bytes / 8192 bytes
      Disklabel type: gpt
      Disk identifier: 00042021-0408-4601-9DCC-xxxxxxxxxxx
      First LBA: 6
      Last LBA: 15267834
      Alternative LBA: 15267839
      Partitions entries LBA: 2
      Allocated partition entries: 128

      Device Start End Sectors Type-UUID UUID Name Attrs
      /dev/sda1 1024 1279 256 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx D117F98E-6F2C-D04B-A5B2-xxxxxxxxxxxx private
      /dev/sda2 1280 1343 64 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 25718777-D0AD-7443-9E60-xxxxxxxxxxxx proinfo
      /dev/sda3 1344 1407 64 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 8A4BB8B4-E304-AE48-8536-xxxxxxxxxxxx misc
      /dev/sda21 2048 3071 1024 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 08992135-13C6-084B-9322-xxxxxxxxxxxx param
      /dev/sda22 3072 5119 2048 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 333A128E-D3E3-B94D-92F4-xxxxxxxxxxxx efs
      /dev/sda23 5120 5631 512 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx F20AA902-1C5D-294A-9177-xxxxxxxxxxxx pnv
      /dev/sda24 5632 6655 1024 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx DB88503D-34A5-3E41-836D-xxxxxxxxxxxx ldfw
      /dev/sda25 6656 7679 1024 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 012B3303-34AC-284D-99B4-xxxxxxxxxxxx dtb
      /dev/sda26 7680 13823 6144 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx FAEC2ECF-8544-E241-B19D-xxxxxxxxxxxx bootimg
      /dev/sda27 13824 22015 8192 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx F13A0978-B1B5-1A4E-8821-xxxxxxxxxxxx recovery
      /dev/sda28 22016 30207 8192 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx B710EB04-45B9-E94A-8D0B-xxxxxxxxxxxx bootlogo
      /dev/sda29 30208 35327 5120 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx AD5EC4B6-2D9F-8544-9417-xxxxxxxxxxxx rstinfo
      /dev/sda30 35328 40447 5120 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx CCEB0B18-39CB-D547-9DB7-xxxxxxxxxxxx mnv
      /dev/sda31 40448 45567 5120 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx D4981A2B-0478-544E-9607-xxxxxxxxxxxx reserved1
      /dev/sda32 45568 50687 5120 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 6D6C9A36-E919-264D-A9EE-xxxxxxxxxxxx reserved2
      /dev/sda33 50688 55807 5120 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 60B98C0E-BEAD-B043-9CC6-xxxxxxxxxxxx reserved3
      /dev/sda41 65536 7929855 7864320 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx F2ECCD60-9303-46B1-B193-xxxxxxxxxxxx system
      /dev/sda42 7929856 8060927 131072 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx DD8D25F3-92F2-4B24-9558-xxxxxxxxxxxx custom
      /dev/sda43 8060928 8323071 262144 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 01573816-7EBF-4860-8AB7-xxxxxxxxxxxx cache
      /dev/sda44 8323072 15267834 6944763 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx E15F5427-031C-4BB0-89D5-xxxxxxxxxxxx userdata


      Expert command (m for help):


      Because you have a lot of binds to the root you have to modify the partitions form recovery.



      First pitfall, the default recovery image for Ubuntu is not adb enabled. I used TWRP 3.0.



      Second pitfall, TWRP fdisk utility is not good enough, it is the busybox variant and it has not the modification commands. So just make a copy (with dd from the system image to a file so you can mount as a loop device) of the system partition onthe SD card, mount it, create with mknod /dev/sda in this mount and chroot /sbin/fdisk



      Now you can play with partitions. Just be careful not to mess anything but the four target partitions. Don't forget to put the names to the partition's labels.



      All of the four partitions are ext4 make the filesystems and then you should be able to mount them from TWRP menu.
      If you have just grow the system partition you should be able to getaway with resizing the fs.



      You could redo the partitions and then just reflash the Ubuntu system with ubuntu-device-flash.






      share|improve this answer

























        Your Answer








        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "89"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f514913%2fhow-to-get-a-larger-root-partition-on-touch%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        5 Answers
        5






        active

        oldest

        votes








        5 Answers
        5






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        1














        I had a similar problem, ultimately I decided to move my /usr to /home/usr (/home is mounted from 14G file system, which gives me plenty of space for additional packages).



        This is a little bit hackish way to do this, but it seems to work for me. The follwing code examples are using $ to indicate that command should be run as normal user and # to indicate root user role (which can be gained either by sudo or loggig as root).





        1. Set password for root user, you will need the ability to log as the root in case you screw anything up with your /usr/bin/sudo. To do so:



          $ sudo su
          # passwd



        2. Copy contents of /usr preserving ownership and permissions:



          $ cd /usr
          $ sudo find . -depth -print0 | sudo cpio --null --sparse -pvd /home/usr/



        3. The next logical step would be to use fstab to mount /home/usr as /usr on boot, however all changes that I tried to make to the fstab were disappearing after rebooting Ubuntu. So I've created simple script to do the mounting, and saved it as /etc/init.d/bind.sh:



          #!/bin/sh
          if [ "X$1" = "Xstart" ]; then
          echo "Binding /home/usr to /usr..."
          chmod 4755 /home/usr/bin/passwd /home/usr/bin/chsh /home/usr/bin/pkexec /home/usr/bin/sudo /home/usr/bin/newgrp /home/usr/bin/gpasswd /home/usr/bin/chfn /home/usr/lib/pt_chown /home/usr/lib/eject/dmcrypt-get-device /home/usr/lib/openssh/ssh-keysign /home/usr/lib/dbus-1.0/dbus-daemon-launch-helper /home/usr/lib/policykit-1/polkit-agent-helper-1 /home/usr/lib/arm-linux-gnueabihf/oxide-qt/chrome-sandbox /home/usr/lib/arm-linux-gnueabihf/lxc/lxc-user-nic
          mount -o bind,suid /home/usr /usr
          echo "...done"
          fi


          The chmod line is needed, as I noticed that suid bit is sometimes missing after mounting. The list of the files that had the suid bit set on can be found by running # find /usr -user root -perm -4000 on the original /usr directory. Please note, that if you install anything later on which is using the suid bit it may become broken unless you add it to the list.



          You will need to create symbolic link in /etc/rcS.d for bind.sh:



           # ln -s /etc/init.d/bind.sh /etc/rcS.d/S36bind.sh


          Note: you might want to pick different number than 36 depending on the state of your /etc/rcS.d.



          Alternatively you can edit /lib/init/fstab as described here to have persistent changes in fstab.




        4. After rebooting the system should be now using /home/usr as /usr so hopefully you should have more space for additional packages. Note that old /usr still exists but is unreachable as long as the new directory is mounted.



          In case anything goes wrong you can return to previous state by renaming the symbolic link in /etc/rcS.d and rebooting:



           # mv /etc/rcS.d/S36bind.sh /etc/rcS.d/K36bind.sh







        share|improve this answer


























        • seeying "Xstart" in your proposed solution made me think that this is not something you did on a Ubuntu Touch device, is it?

          – Kris Jace
          May 2 '17 at 7:48
















        1














        I had a similar problem, ultimately I decided to move my /usr to /home/usr (/home is mounted from 14G file system, which gives me plenty of space for additional packages).



        This is a little bit hackish way to do this, but it seems to work for me. The follwing code examples are using $ to indicate that command should be run as normal user and # to indicate root user role (which can be gained either by sudo or loggig as root).





        1. Set password for root user, you will need the ability to log as the root in case you screw anything up with your /usr/bin/sudo. To do so:



          $ sudo su
          # passwd



        2. Copy contents of /usr preserving ownership and permissions:



          $ cd /usr
          $ sudo find . -depth -print0 | sudo cpio --null --sparse -pvd /home/usr/



        3. The next logical step would be to use fstab to mount /home/usr as /usr on boot, however all changes that I tried to make to the fstab were disappearing after rebooting Ubuntu. So I've created simple script to do the mounting, and saved it as /etc/init.d/bind.sh:



          #!/bin/sh
          if [ "X$1" = "Xstart" ]; then
          echo "Binding /home/usr to /usr..."
          chmod 4755 /home/usr/bin/passwd /home/usr/bin/chsh /home/usr/bin/pkexec /home/usr/bin/sudo /home/usr/bin/newgrp /home/usr/bin/gpasswd /home/usr/bin/chfn /home/usr/lib/pt_chown /home/usr/lib/eject/dmcrypt-get-device /home/usr/lib/openssh/ssh-keysign /home/usr/lib/dbus-1.0/dbus-daemon-launch-helper /home/usr/lib/policykit-1/polkit-agent-helper-1 /home/usr/lib/arm-linux-gnueabihf/oxide-qt/chrome-sandbox /home/usr/lib/arm-linux-gnueabihf/lxc/lxc-user-nic
          mount -o bind,suid /home/usr /usr
          echo "...done"
          fi


          The chmod line is needed, as I noticed that suid bit is sometimes missing after mounting. The list of the files that had the suid bit set on can be found by running # find /usr -user root -perm -4000 on the original /usr directory. Please note, that if you install anything later on which is using the suid bit it may become broken unless you add it to the list.



          You will need to create symbolic link in /etc/rcS.d for bind.sh:



           # ln -s /etc/init.d/bind.sh /etc/rcS.d/S36bind.sh


          Note: you might want to pick different number than 36 depending on the state of your /etc/rcS.d.



          Alternatively you can edit /lib/init/fstab as described here to have persistent changes in fstab.




        4. After rebooting the system should be now using /home/usr as /usr so hopefully you should have more space for additional packages. Note that old /usr still exists but is unreachable as long as the new directory is mounted.



          In case anything goes wrong you can return to previous state by renaming the symbolic link in /etc/rcS.d and rebooting:



           # mv /etc/rcS.d/S36bind.sh /etc/rcS.d/K36bind.sh







        share|improve this answer


























        • seeying "Xstart" in your proposed solution made me think that this is not something you did on a Ubuntu Touch device, is it?

          – Kris Jace
          May 2 '17 at 7:48














        1












        1








        1







        I had a similar problem, ultimately I decided to move my /usr to /home/usr (/home is mounted from 14G file system, which gives me plenty of space for additional packages).



        This is a little bit hackish way to do this, but it seems to work for me. The follwing code examples are using $ to indicate that command should be run as normal user and # to indicate root user role (which can be gained either by sudo or loggig as root).





        1. Set password for root user, you will need the ability to log as the root in case you screw anything up with your /usr/bin/sudo. To do so:



          $ sudo su
          # passwd



        2. Copy contents of /usr preserving ownership and permissions:



          $ cd /usr
          $ sudo find . -depth -print0 | sudo cpio --null --sparse -pvd /home/usr/



        3. The next logical step would be to use fstab to mount /home/usr as /usr on boot, however all changes that I tried to make to the fstab were disappearing after rebooting Ubuntu. So I've created simple script to do the mounting, and saved it as /etc/init.d/bind.sh:



          #!/bin/sh
          if [ "X$1" = "Xstart" ]; then
          echo "Binding /home/usr to /usr..."
          chmod 4755 /home/usr/bin/passwd /home/usr/bin/chsh /home/usr/bin/pkexec /home/usr/bin/sudo /home/usr/bin/newgrp /home/usr/bin/gpasswd /home/usr/bin/chfn /home/usr/lib/pt_chown /home/usr/lib/eject/dmcrypt-get-device /home/usr/lib/openssh/ssh-keysign /home/usr/lib/dbus-1.0/dbus-daemon-launch-helper /home/usr/lib/policykit-1/polkit-agent-helper-1 /home/usr/lib/arm-linux-gnueabihf/oxide-qt/chrome-sandbox /home/usr/lib/arm-linux-gnueabihf/lxc/lxc-user-nic
          mount -o bind,suid /home/usr /usr
          echo "...done"
          fi


          The chmod line is needed, as I noticed that suid bit is sometimes missing after mounting. The list of the files that had the suid bit set on can be found by running # find /usr -user root -perm -4000 on the original /usr directory. Please note, that if you install anything later on which is using the suid bit it may become broken unless you add it to the list.



          You will need to create symbolic link in /etc/rcS.d for bind.sh:



           # ln -s /etc/init.d/bind.sh /etc/rcS.d/S36bind.sh


          Note: you might want to pick different number than 36 depending on the state of your /etc/rcS.d.



          Alternatively you can edit /lib/init/fstab as described here to have persistent changes in fstab.




        4. After rebooting the system should be now using /home/usr as /usr so hopefully you should have more space for additional packages. Note that old /usr still exists but is unreachable as long as the new directory is mounted.



          In case anything goes wrong you can return to previous state by renaming the symbolic link in /etc/rcS.d and rebooting:



           # mv /etc/rcS.d/S36bind.sh /etc/rcS.d/K36bind.sh







        share|improve this answer















        I had a similar problem, ultimately I decided to move my /usr to /home/usr (/home is mounted from 14G file system, which gives me plenty of space for additional packages).



        This is a little bit hackish way to do this, but it seems to work for me. The follwing code examples are using $ to indicate that command should be run as normal user and # to indicate root user role (which can be gained either by sudo or loggig as root).





        1. Set password for root user, you will need the ability to log as the root in case you screw anything up with your /usr/bin/sudo. To do so:



          $ sudo su
          # passwd



        2. Copy contents of /usr preserving ownership and permissions:



          $ cd /usr
          $ sudo find . -depth -print0 | sudo cpio --null --sparse -pvd /home/usr/



        3. The next logical step would be to use fstab to mount /home/usr as /usr on boot, however all changes that I tried to make to the fstab were disappearing after rebooting Ubuntu. So I've created simple script to do the mounting, and saved it as /etc/init.d/bind.sh:



          #!/bin/sh
          if [ "X$1" = "Xstart" ]; then
          echo "Binding /home/usr to /usr..."
          chmod 4755 /home/usr/bin/passwd /home/usr/bin/chsh /home/usr/bin/pkexec /home/usr/bin/sudo /home/usr/bin/newgrp /home/usr/bin/gpasswd /home/usr/bin/chfn /home/usr/lib/pt_chown /home/usr/lib/eject/dmcrypt-get-device /home/usr/lib/openssh/ssh-keysign /home/usr/lib/dbus-1.0/dbus-daemon-launch-helper /home/usr/lib/policykit-1/polkit-agent-helper-1 /home/usr/lib/arm-linux-gnueabihf/oxide-qt/chrome-sandbox /home/usr/lib/arm-linux-gnueabihf/lxc/lxc-user-nic
          mount -o bind,suid /home/usr /usr
          echo "...done"
          fi


          The chmod line is needed, as I noticed that suid bit is sometimes missing after mounting. The list of the files that had the suid bit set on can be found by running # find /usr -user root -perm -4000 on the original /usr directory. Please note, that if you install anything later on which is using the suid bit it may become broken unless you add it to the list.



          You will need to create symbolic link in /etc/rcS.d for bind.sh:



           # ln -s /etc/init.d/bind.sh /etc/rcS.d/S36bind.sh


          Note: you might want to pick different number than 36 depending on the state of your /etc/rcS.d.



          Alternatively you can edit /lib/init/fstab as described here to have persistent changes in fstab.




        4. After rebooting the system should be now using /home/usr as /usr so hopefully you should have more space for additional packages. Note that old /usr still exists but is unreachable as long as the new directory is mounted.



          In case anything goes wrong you can return to previous state by renaming the symbolic link in /etc/rcS.d and rebooting:



           # mv /etc/rcS.d/S36bind.sh /etc/rcS.d/K36bind.sh








        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 2 at 21:08









        Pablo Bianchi

        2,4251529




        2,4251529










        answered Oct 29 '14 at 9:57









        belickimbelickim

        262




        262













        • seeying "Xstart" in your proposed solution made me think that this is not something you did on a Ubuntu Touch device, is it?

          – Kris Jace
          May 2 '17 at 7:48



















        • seeying "Xstart" in your proposed solution made me think that this is not something you did on a Ubuntu Touch device, is it?

          – Kris Jace
          May 2 '17 at 7:48

















        seeying "Xstart" in your proposed solution made me think that this is not something you did on a Ubuntu Touch device, is it?

        – Kris Jace
        May 2 '17 at 7:48





        seeying "Xstart" in your proposed solution made me think that this is not something you did on a Ubuntu Touch device, is it?

        – Kris Jace
        May 2 '17 at 7:48













        3














        This solution worked for me:



        https://github.com/plasma-mobile/plasma-phone-dev-setup/blob/master/usr/bin/resize-root-partition



        Basically, it's KDE Plasma Mobile's super-simple install script. Just run it, take a nap, and you should have a 6 GB root partition.






        share|improve this answer




























          3














          This solution worked for me:



          https://github.com/plasma-mobile/plasma-phone-dev-setup/blob/master/usr/bin/resize-root-partition



          Basically, it's KDE Plasma Mobile's super-simple install script. Just run it, take a nap, and you should have a 6 GB root partition.






          share|improve this answer


























            3












            3








            3







            This solution worked for me:



            https://github.com/plasma-mobile/plasma-phone-dev-setup/blob/master/usr/bin/resize-root-partition



            Basically, it's KDE Plasma Mobile's super-simple install script. Just run it, take a nap, and you should have a 6 GB root partition.






            share|improve this answer













            This solution worked for me:



            https://github.com/plasma-mobile/plasma-phone-dev-setup/blob/master/usr/bin/resize-root-partition



            Basically, it's KDE Plasma Mobile's super-simple install script. Just run it, take a nap, and you should have a 6 GB root partition.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jan 15 '16 at 7:42









            tusingtusing

            312




            312























                1














                Here's the quickest way I've figured out to do it.



                Warning:
                This may break your phone if typed incorrectly. Ensure you have full backups before beginning and are willing to make mistakes in case you lose all data on your phone.
                This example command resizes the root filesystem to 6GB, so if it's already bigger than that it will be truncated and your phone likely will become unbootable (until re-imaged). Only use this command if your root filesystem image is less than 6GB (the Ubuntu Touch default is 2GB).



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





                share|improve this answer
























                • can you explain to me a little better, how this works?

                  – Alko
                  Sep 29 '15 at 18:23
















                1














                Here's the quickest way I've figured out to do it.



                Warning:
                This may break your phone if typed incorrectly. Ensure you have full backups before beginning and are willing to make mistakes in case you lose all data on your phone.
                This example command resizes the root filesystem to 6GB, so if it's already bigger than that it will be truncated and your phone likely will become unbootable (until re-imaged). Only use this command if your root filesystem image is less than 6GB (the Ubuntu Touch default is 2GB).



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





                share|improve this answer
























                • can you explain to me a little better, how this works?

                  – Alko
                  Sep 29 '15 at 18:23














                1












                1








                1







                Here's the quickest way I've figured out to do it.



                Warning:
                This may break your phone if typed incorrectly. Ensure you have full backups before beginning and are willing to make mistakes in case you lose all data on your phone.
                This example command resizes the root filesystem to 6GB, so if it's already bigger than that it will be truncated and your phone likely will become unbootable (until re-imaged). Only use this command if your root filesystem image is less than 6GB (the Ubuntu Touch default is 2GB).



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





                share|improve this answer













                Here's the quickest way I've figured out to do it.



                Warning:
                This may break your phone if typed incorrectly. Ensure you have full backups before beginning and are willing to make mistakes in case you lose all data on your phone.
                This example command resizes the root filesystem to 6GB, so if it's already bigger than that it will be truncated and your phone likely will become unbootable (until re-imaged). Only use this command if your root filesystem image is less than 6GB (the Ubuntu Touch default is 2GB).



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






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Aug 13 '15 at 9:28









                Daniel van VugtDaniel van Vugt

                111




                111













                • can you explain to me a little better, how this works?

                  – Alko
                  Sep 29 '15 at 18:23



















                • can you explain to me a little better, how this works?

                  – Alko
                  Sep 29 '15 at 18:23

















                can you explain to me a little better, how this works?

                – Alko
                Sep 29 '15 at 18:23





                can you explain to me a little better, how this works?

                – Alko
                Sep 29 '15 at 18:23











                0














                Ok, here is the way that I did it on my meizu pro5. Your mileage may varry.



                O and you may brick your phone.



                Take this guide as a hint for your path to follow. Don't come back crying.



                Have a fresh phone made by ubuntu-device-flash. In the phone you should have an SD card big enough to hold the fs from the userdata partition plus 512M plus 700M for the custom and cache partition.




                • put twrp3.0 as the recovery image.

                • use fdisk -l /dev/block/sda to see the partitions.

                • save that report. You should have the last 4 partition as system, custom, cache and userdata.

                • mkdir /tmp/userdata

                • mount /dev/block/sda44 (for me it was 44) /tmp/userdata

                • cd /tmp

                • tar -czf /external_sd/userdata.tar.gz userdata

                • umount /tmp/userdata

                • dd if=/dev/block/sda43 of=/externa_sd/cache.img

                • dd if=/dev/block/sda42 of=/externa_sd/custom.img


                You now have saved the data, now to redo the partitions we will use the fdisk from ubuntu since the fdisk from twrp is not good enough.




                • mkdir /tmp/ubuntu

                • mount -o loop /system/var/lib/lxc-andoid/system.img /tmp/ubuntu

                • mknod -m 666 b 8 0 /tmp/ubuntu/dev/sda

                • chroot /tmp/ubuntu /sbin/fdisk /dev/sda


                You delete the 41,42,43,44 partitions and create :




                • a new 41 starting from the same place but bigger.

                • a new 42 starting after 41 with the same size as the old 42.

                • a new 43 starting after 42 with the same size as the old 43.

                • a new 44 starting after 43 and ending on the same sector as the old 44.

                • save the new partition table

                • umount /tmp/ubuntu


                Put back the userdata, custom and cache.




                • dd if=/externa_sd/cache.img of=/dev/block/sda43

                • dd if=/externa_sd/custom.img of=/dev/block/sda42

                • create a new ext4 on 44: mke2fs /dev/block/sda44

                • mount /dev/block/sda44 /tmp/userdata

                • cd /tmp

                • tar -xzf /external_sd/userdata.tar.gz

                • umount /tmp/userdata

                • umount /tmp/ubuntu

                • umount /system

                • increase now the system partition: resize2fs /dev/block/sda41


                You should now have a bigger root partition in your ubuntu-touch system.



                Have fun.






                share|improve this answer






























                  0














                  Ok, here is the way that I did it on my meizu pro5. Your mileage may varry.



                  O and you may brick your phone.



                  Take this guide as a hint for your path to follow. Don't come back crying.



                  Have a fresh phone made by ubuntu-device-flash. In the phone you should have an SD card big enough to hold the fs from the userdata partition plus 512M plus 700M for the custom and cache partition.




                  • put twrp3.0 as the recovery image.

                  • use fdisk -l /dev/block/sda to see the partitions.

                  • save that report. You should have the last 4 partition as system, custom, cache and userdata.

                  • mkdir /tmp/userdata

                  • mount /dev/block/sda44 (for me it was 44) /tmp/userdata

                  • cd /tmp

                  • tar -czf /external_sd/userdata.tar.gz userdata

                  • umount /tmp/userdata

                  • dd if=/dev/block/sda43 of=/externa_sd/cache.img

                  • dd if=/dev/block/sda42 of=/externa_sd/custom.img


                  You now have saved the data, now to redo the partitions we will use the fdisk from ubuntu since the fdisk from twrp is not good enough.




                  • mkdir /tmp/ubuntu

                  • mount -o loop /system/var/lib/lxc-andoid/system.img /tmp/ubuntu

                  • mknod -m 666 b 8 0 /tmp/ubuntu/dev/sda

                  • chroot /tmp/ubuntu /sbin/fdisk /dev/sda


                  You delete the 41,42,43,44 partitions and create :




                  • a new 41 starting from the same place but bigger.

                  • a new 42 starting after 41 with the same size as the old 42.

                  • a new 43 starting after 42 with the same size as the old 43.

                  • a new 44 starting after 43 and ending on the same sector as the old 44.

                  • save the new partition table

                  • umount /tmp/ubuntu


                  Put back the userdata, custom and cache.




                  • dd if=/externa_sd/cache.img of=/dev/block/sda43

                  • dd if=/externa_sd/custom.img of=/dev/block/sda42

                  • create a new ext4 on 44: mke2fs /dev/block/sda44

                  • mount /dev/block/sda44 /tmp/userdata

                  • cd /tmp

                  • tar -xzf /external_sd/userdata.tar.gz

                  • umount /tmp/userdata

                  • umount /tmp/ubuntu

                  • umount /system

                  • increase now the system partition: resize2fs /dev/block/sda41


                  You should now have a bigger root partition in your ubuntu-touch system.



                  Have fun.






                  share|improve this answer




























                    0












                    0








                    0







                    Ok, here is the way that I did it on my meizu pro5. Your mileage may varry.



                    O and you may brick your phone.



                    Take this guide as a hint for your path to follow. Don't come back crying.



                    Have a fresh phone made by ubuntu-device-flash. In the phone you should have an SD card big enough to hold the fs from the userdata partition plus 512M plus 700M for the custom and cache partition.




                    • put twrp3.0 as the recovery image.

                    • use fdisk -l /dev/block/sda to see the partitions.

                    • save that report. You should have the last 4 partition as system, custom, cache and userdata.

                    • mkdir /tmp/userdata

                    • mount /dev/block/sda44 (for me it was 44) /tmp/userdata

                    • cd /tmp

                    • tar -czf /external_sd/userdata.tar.gz userdata

                    • umount /tmp/userdata

                    • dd if=/dev/block/sda43 of=/externa_sd/cache.img

                    • dd if=/dev/block/sda42 of=/externa_sd/custom.img


                    You now have saved the data, now to redo the partitions we will use the fdisk from ubuntu since the fdisk from twrp is not good enough.




                    • mkdir /tmp/ubuntu

                    • mount -o loop /system/var/lib/lxc-andoid/system.img /tmp/ubuntu

                    • mknod -m 666 b 8 0 /tmp/ubuntu/dev/sda

                    • chroot /tmp/ubuntu /sbin/fdisk /dev/sda


                    You delete the 41,42,43,44 partitions and create :




                    • a new 41 starting from the same place but bigger.

                    • a new 42 starting after 41 with the same size as the old 42.

                    • a new 43 starting after 42 with the same size as the old 43.

                    • a new 44 starting after 43 and ending on the same sector as the old 44.

                    • save the new partition table

                    • umount /tmp/ubuntu


                    Put back the userdata, custom and cache.




                    • dd if=/externa_sd/cache.img of=/dev/block/sda43

                    • dd if=/externa_sd/custom.img of=/dev/block/sda42

                    • create a new ext4 on 44: mke2fs /dev/block/sda44

                    • mount /dev/block/sda44 /tmp/userdata

                    • cd /tmp

                    • tar -xzf /external_sd/userdata.tar.gz

                    • umount /tmp/userdata

                    • umount /tmp/ubuntu

                    • umount /system

                    • increase now the system partition: resize2fs /dev/block/sda41


                    You should now have a bigger root partition in your ubuntu-touch system.



                    Have fun.






                    share|improve this answer















                    Ok, here is the way that I did it on my meizu pro5. Your mileage may varry.



                    O and you may brick your phone.



                    Take this guide as a hint for your path to follow. Don't come back crying.



                    Have a fresh phone made by ubuntu-device-flash. In the phone you should have an SD card big enough to hold the fs from the userdata partition plus 512M plus 700M for the custom and cache partition.




                    • put twrp3.0 as the recovery image.

                    • use fdisk -l /dev/block/sda to see the partitions.

                    • save that report. You should have the last 4 partition as system, custom, cache and userdata.

                    • mkdir /tmp/userdata

                    • mount /dev/block/sda44 (for me it was 44) /tmp/userdata

                    • cd /tmp

                    • tar -czf /external_sd/userdata.tar.gz userdata

                    • umount /tmp/userdata

                    • dd if=/dev/block/sda43 of=/externa_sd/cache.img

                    • dd if=/dev/block/sda42 of=/externa_sd/custom.img


                    You now have saved the data, now to redo the partitions we will use the fdisk from ubuntu since the fdisk from twrp is not good enough.




                    • mkdir /tmp/ubuntu

                    • mount -o loop /system/var/lib/lxc-andoid/system.img /tmp/ubuntu

                    • mknod -m 666 b 8 0 /tmp/ubuntu/dev/sda

                    • chroot /tmp/ubuntu /sbin/fdisk /dev/sda


                    You delete the 41,42,43,44 partitions and create :




                    • a new 41 starting from the same place but bigger.

                    • a new 42 starting after 41 with the same size as the old 42.

                    • a new 43 starting after 42 with the same size as the old 43.

                    • a new 44 starting after 43 and ending on the same sector as the old 44.

                    • save the new partition table

                    • umount /tmp/ubuntu


                    Put back the userdata, custom and cache.




                    • dd if=/externa_sd/cache.img of=/dev/block/sda43

                    • dd if=/externa_sd/custom.img of=/dev/block/sda42

                    • create a new ext4 on 44: mke2fs /dev/block/sda44

                    • mount /dev/block/sda44 /tmp/userdata

                    • cd /tmp

                    • tar -xzf /external_sd/userdata.tar.gz

                    • umount /tmp/userdata

                    • umount /tmp/ubuntu

                    • umount /system

                    • increase now the system partition: resize2fs /dev/block/sda41


                    You should now have a bigger root partition in your ubuntu-touch system.



                    Have fun.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Jun 4 '16 at 18:11

























                    answered Jun 3 '16 at 8:28









                    E. TimoteiE. Timotei

                    1166




                    1166























                        0














                        After some more play here is what you need to know and do.



                        Ubuntu touch is booting from an android device so the partions have to be apropiate.



                        The android system is identifying the partitions by the partition label.



                        You have for meizu pro 5 this partitions: system (the root partition), cache (used for upgrates by Ubuntu, you should have about 1G on it), custom (no idea what is used for), userdata (used for /home and a lot of other folders that are mounted with bind to different parts of the root)



                        phablet@ubuntu-phablet:~$ sudo fdisk /dev/sda

                        Welcome to fdisk (util-linux 2.25.2).

                        Changes will remain in memory only, until you decide to write them.

                        Be careful before using the write command.


                        Command (m for help): x

                        Expert command (m for help): p
                        Disk /dev/sda: 58.2 GiB, 62537072640 bytes, 15267840 sectors
                        Units: sectors of 1 * 4096 = 4096 bytes
                        Sector size (logical/physical): 4096 bytes / 16384 bytes
                        I/O size (minimum/optimal): 16384 bytes / 8192 bytes
                        Disklabel type: gpt
                        Disk identifier: 00042021-0408-4601-9DCC-xxxxxxxxxxx
                        First LBA: 6
                        Last LBA: 15267834
                        Alternative LBA: 15267839
                        Partitions entries LBA: 2
                        Allocated partition entries: 128

                        Device Start End Sectors Type-UUID UUID Name Attrs
                        /dev/sda1 1024 1279 256 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx D117F98E-6F2C-D04B-A5B2-xxxxxxxxxxxx private
                        /dev/sda2 1280 1343 64 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 25718777-D0AD-7443-9E60-xxxxxxxxxxxx proinfo
                        /dev/sda3 1344 1407 64 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 8A4BB8B4-E304-AE48-8536-xxxxxxxxxxxx misc
                        /dev/sda21 2048 3071 1024 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 08992135-13C6-084B-9322-xxxxxxxxxxxx param
                        /dev/sda22 3072 5119 2048 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 333A128E-D3E3-B94D-92F4-xxxxxxxxxxxx efs
                        /dev/sda23 5120 5631 512 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx F20AA902-1C5D-294A-9177-xxxxxxxxxxxx pnv
                        /dev/sda24 5632 6655 1024 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx DB88503D-34A5-3E41-836D-xxxxxxxxxxxx ldfw
                        /dev/sda25 6656 7679 1024 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 012B3303-34AC-284D-99B4-xxxxxxxxxxxx dtb
                        /dev/sda26 7680 13823 6144 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx FAEC2ECF-8544-E241-B19D-xxxxxxxxxxxx bootimg
                        /dev/sda27 13824 22015 8192 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx F13A0978-B1B5-1A4E-8821-xxxxxxxxxxxx recovery
                        /dev/sda28 22016 30207 8192 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx B710EB04-45B9-E94A-8D0B-xxxxxxxxxxxx bootlogo
                        /dev/sda29 30208 35327 5120 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx AD5EC4B6-2D9F-8544-9417-xxxxxxxxxxxx rstinfo
                        /dev/sda30 35328 40447 5120 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx CCEB0B18-39CB-D547-9DB7-xxxxxxxxxxxx mnv
                        /dev/sda31 40448 45567 5120 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx D4981A2B-0478-544E-9607-xxxxxxxxxxxx reserved1
                        /dev/sda32 45568 50687 5120 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 6D6C9A36-E919-264D-A9EE-xxxxxxxxxxxx reserved2
                        /dev/sda33 50688 55807 5120 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 60B98C0E-BEAD-B043-9CC6-xxxxxxxxxxxx reserved3
                        /dev/sda41 65536 7929855 7864320 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx F2ECCD60-9303-46B1-B193-xxxxxxxxxxxx system
                        /dev/sda42 7929856 8060927 131072 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx DD8D25F3-92F2-4B24-9558-xxxxxxxxxxxx custom
                        /dev/sda43 8060928 8323071 262144 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 01573816-7EBF-4860-8AB7-xxxxxxxxxxxx cache
                        /dev/sda44 8323072 15267834 6944763 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx E15F5427-031C-4BB0-89D5-xxxxxxxxxxxx userdata


                        Expert command (m for help):


                        Because you have a lot of binds to the root you have to modify the partitions form recovery.



                        First pitfall, the default recovery image for Ubuntu is not adb enabled. I used TWRP 3.0.



                        Second pitfall, TWRP fdisk utility is not good enough, it is the busybox variant and it has not the modification commands. So just make a copy (with dd from the system image to a file so you can mount as a loop device) of the system partition onthe SD card, mount it, create with mknod /dev/sda in this mount and chroot /sbin/fdisk



                        Now you can play with partitions. Just be careful not to mess anything but the four target partitions. Don't forget to put the names to the partition's labels.



                        All of the four partitions are ext4 make the filesystems and then you should be able to mount them from TWRP menu.
                        If you have just grow the system partition you should be able to getaway with resizing the fs.



                        You could redo the partitions and then just reflash the Ubuntu system with ubuntu-device-flash.






                        share|improve this answer






























                          0














                          After some more play here is what you need to know and do.



                          Ubuntu touch is booting from an android device so the partions have to be apropiate.



                          The android system is identifying the partitions by the partition label.



                          You have for meizu pro 5 this partitions: system (the root partition), cache (used for upgrates by Ubuntu, you should have about 1G on it), custom (no idea what is used for), userdata (used for /home and a lot of other folders that are mounted with bind to different parts of the root)



                          phablet@ubuntu-phablet:~$ sudo fdisk /dev/sda

                          Welcome to fdisk (util-linux 2.25.2).

                          Changes will remain in memory only, until you decide to write them.

                          Be careful before using the write command.


                          Command (m for help): x

                          Expert command (m for help): p
                          Disk /dev/sda: 58.2 GiB, 62537072640 bytes, 15267840 sectors
                          Units: sectors of 1 * 4096 = 4096 bytes
                          Sector size (logical/physical): 4096 bytes / 16384 bytes
                          I/O size (minimum/optimal): 16384 bytes / 8192 bytes
                          Disklabel type: gpt
                          Disk identifier: 00042021-0408-4601-9DCC-xxxxxxxxxxx
                          First LBA: 6
                          Last LBA: 15267834
                          Alternative LBA: 15267839
                          Partitions entries LBA: 2
                          Allocated partition entries: 128

                          Device Start End Sectors Type-UUID UUID Name Attrs
                          /dev/sda1 1024 1279 256 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx D117F98E-6F2C-D04B-A5B2-xxxxxxxxxxxx private
                          /dev/sda2 1280 1343 64 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 25718777-D0AD-7443-9E60-xxxxxxxxxxxx proinfo
                          /dev/sda3 1344 1407 64 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 8A4BB8B4-E304-AE48-8536-xxxxxxxxxxxx misc
                          /dev/sda21 2048 3071 1024 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 08992135-13C6-084B-9322-xxxxxxxxxxxx param
                          /dev/sda22 3072 5119 2048 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 333A128E-D3E3-B94D-92F4-xxxxxxxxxxxx efs
                          /dev/sda23 5120 5631 512 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx F20AA902-1C5D-294A-9177-xxxxxxxxxxxx pnv
                          /dev/sda24 5632 6655 1024 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx DB88503D-34A5-3E41-836D-xxxxxxxxxxxx ldfw
                          /dev/sda25 6656 7679 1024 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 012B3303-34AC-284D-99B4-xxxxxxxxxxxx dtb
                          /dev/sda26 7680 13823 6144 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx FAEC2ECF-8544-E241-B19D-xxxxxxxxxxxx bootimg
                          /dev/sda27 13824 22015 8192 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx F13A0978-B1B5-1A4E-8821-xxxxxxxxxxxx recovery
                          /dev/sda28 22016 30207 8192 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx B710EB04-45B9-E94A-8D0B-xxxxxxxxxxxx bootlogo
                          /dev/sda29 30208 35327 5120 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx AD5EC4B6-2D9F-8544-9417-xxxxxxxxxxxx rstinfo
                          /dev/sda30 35328 40447 5120 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx CCEB0B18-39CB-D547-9DB7-xxxxxxxxxxxx mnv
                          /dev/sda31 40448 45567 5120 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx D4981A2B-0478-544E-9607-xxxxxxxxxxxx reserved1
                          /dev/sda32 45568 50687 5120 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 6D6C9A36-E919-264D-A9EE-xxxxxxxxxxxx reserved2
                          /dev/sda33 50688 55807 5120 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 60B98C0E-BEAD-B043-9CC6-xxxxxxxxxxxx reserved3
                          /dev/sda41 65536 7929855 7864320 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx F2ECCD60-9303-46B1-B193-xxxxxxxxxxxx system
                          /dev/sda42 7929856 8060927 131072 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx DD8D25F3-92F2-4B24-9558-xxxxxxxxxxxx custom
                          /dev/sda43 8060928 8323071 262144 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 01573816-7EBF-4860-8AB7-xxxxxxxxxxxx cache
                          /dev/sda44 8323072 15267834 6944763 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx E15F5427-031C-4BB0-89D5-xxxxxxxxxxxx userdata


                          Expert command (m for help):


                          Because you have a lot of binds to the root you have to modify the partitions form recovery.



                          First pitfall, the default recovery image for Ubuntu is not adb enabled. I used TWRP 3.0.



                          Second pitfall, TWRP fdisk utility is not good enough, it is the busybox variant and it has not the modification commands. So just make a copy (with dd from the system image to a file so you can mount as a loop device) of the system partition onthe SD card, mount it, create with mknod /dev/sda in this mount and chroot /sbin/fdisk



                          Now you can play with partitions. Just be careful not to mess anything but the four target partitions. Don't forget to put the names to the partition's labels.



                          All of the four partitions are ext4 make the filesystems and then you should be able to mount them from TWRP menu.
                          If you have just grow the system partition you should be able to getaway with resizing the fs.



                          You could redo the partitions and then just reflash the Ubuntu system with ubuntu-device-flash.






                          share|improve this answer




























                            0












                            0








                            0







                            After some more play here is what you need to know and do.



                            Ubuntu touch is booting from an android device so the partions have to be apropiate.



                            The android system is identifying the partitions by the partition label.



                            You have for meizu pro 5 this partitions: system (the root partition), cache (used for upgrates by Ubuntu, you should have about 1G on it), custom (no idea what is used for), userdata (used for /home and a lot of other folders that are mounted with bind to different parts of the root)



                            phablet@ubuntu-phablet:~$ sudo fdisk /dev/sda

                            Welcome to fdisk (util-linux 2.25.2).

                            Changes will remain in memory only, until you decide to write them.

                            Be careful before using the write command.


                            Command (m for help): x

                            Expert command (m for help): p
                            Disk /dev/sda: 58.2 GiB, 62537072640 bytes, 15267840 sectors
                            Units: sectors of 1 * 4096 = 4096 bytes
                            Sector size (logical/physical): 4096 bytes / 16384 bytes
                            I/O size (minimum/optimal): 16384 bytes / 8192 bytes
                            Disklabel type: gpt
                            Disk identifier: 00042021-0408-4601-9DCC-xxxxxxxxxxx
                            First LBA: 6
                            Last LBA: 15267834
                            Alternative LBA: 15267839
                            Partitions entries LBA: 2
                            Allocated partition entries: 128

                            Device Start End Sectors Type-UUID UUID Name Attrs
                            /dev/sda1 1024 1279 256 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx D117F98E-6F2C-D04B-A5B2-xxxxxxxxxxxx private
                            /dev/sda2 1280 1343 64 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 25718777-D0AD-7443-9E60-xxxxxxxxxxxx proinfo
                            /dev/sda3 1344 1407 64 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 8A4BB8B4-E304-AE48-8536-xxxxxxxxxxxx misc
                            /dev/sda21 2048 3071 1024 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 08992135-13C6-084B-9322-xxxxxxxxxxxx param
                            /dev/sda22 3072 5119 2048 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 333A128E-D3E3-B94D-92F4-xxxxxxxxxxxx efs
                            /dev/sda23 5120 5631 512 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx F20AA902-1C5D-294A-9177-xxxxxxxxxxxx pnv
                            /dev/sda24 5632 6655 1024 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx DB88503D-34A5-3E41-836D-xxxxxxxxxxxx ldfw
                            /dev/sda25 6656 7679 1024 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 012B3303-34AC-284D-99B4-xxxxxxxxxxxx dtb
                            /dev/sda26 7680 13823 6144 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx FAEC2ECF-8544-E241-B19D-xxxxxxxxxxxx bootimg
                            /dev/sda27 13824 22015 8192 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx F13A0978-B1B5-1A4E-8821-xxxxxxxxxxxx recovery
                            /dev/sda28 22016 30207 8192 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx B710EB04-45B9-E94A-8D0B-xxxxxxxxxxxx bootlogo
                            /dev/sda29 30208 35327 5120 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx AD5EC4B6-2D9F-8544-9417-xxxxxxxxxxxx rstinfo
                            /dev/sda30 35328 40447 5120 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx CCEB0B18-39CB-D547-9DB7-xxxxxxxxxxxx mnv
                            /dev/sda31 40448 45567 5120 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx D4981A2B-0478-544E-9607-xxxxxxxxxxxx reserved1
                            /dev/sda32 45568 50687 5120 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 6D6C9A36-E919-264D-A9EE-xxxxxxxxxxxx reserved2
                            /dev/sda33 50688 55807 5120 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 60B98C0E-BEAD-B043-9CC6-xxxxxxxxxxxx reserved3
                            /dev/sda41 65536 7929855 7864320 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx F2ECCD60-9303-46B1-B193-xxxxxxxxxxxx system
                            /dev/sda42 7929856 8060927 131072 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx DD8D25F3-92F2-4B24-9558-xxxxxxxxxxxx custom
                            /dev/sda43 8060928 8323071 262144 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 01573816-7EBF-4860-8AB7-xxxxxxxxxxxx cache
                            /dev/sda44 8323072 15267834 6944763 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx E15F5427-031C-4BB0-89D5-xxxxxxxxxxxx userdata


                            Expert command (m for help):


                            Because you have a lot of binds to the root you have to modify the partitions form recovery.



                            First pitfall, the default recovery image for Ubuntu is not adb enabled. I used TWRP 3.0.



                            Second pitfall, TWRP fdisk utility is not good enough, it is the busybox variant and it has not the modification commands. So just make a copy (with dd from the system image to a file so you can mount as a loop device) of the system partition onthe SD card, mount it, create with mknod /dev/sda in this mount and chroot /sbin/fdisk



                            Now you can play with partitions. Just be careful not to mess anything but the four target partitions. Don't forget to put the names to the partition's labels.



                            All of the four partitions are ext4 make the filesystems and then you should be able to mount them from TWRP menu.
                            If you have just grow the system partition you should be able to getaway with resizing the fs.



                            You could redo the partitions and then just reflash the Ubuntu system with ubuntu-device-flash.






                            share|improve this answer















                            After some more play here is what you need to know and do.



                            Ubuntu touch is booting from an android device so the partions have to be apropiate.



                            The android system is identifying the partitions by the partition label.



                            You have for meizu pro 5 this partitions: system (the root partition), cache (used for upgrates by Ubuntu, you should have about 1G on it), custom (no idea what is used for), userdata (used for /home and a lot of other folders that are mounted with bind to different parts of the root)



                            phablet@ubuntu-phablet:~$ sudo fdisk /dev/sda

                            Welcome to fdisk (util-linux 2.25.2).

                            Changes will remain in memory only, until you decide to write them.

                            Be careful before using the write command.


                            Command (m for help): x

                            Expert command (m for help): p
                            Disk /dev/sda: 58.2 GiB, 62537072640 bytes, 15267840 sectors
                            Units: sectors of 1 * 4096 = 4096 bytes
                            Sector size (logical/physical): 4096 bytes / 16384 bytes
                            I/O size (minimum/optimal): 16384 bytes / 8192 bytes
                            Disklabel type: gpt
                            Disk identifier: 00042021-0408-4601-9DCC-xxxxxxxxxxx
                            First LBA: 6
                            Last LBA: 15267834
                            Alternative LBA: 15267839
                            Partitions entries LBA: 2
                            Allocated partition entries: 128

                            Device Start End Sectors Type-UUID UUID Name Attrs
                            /dev/sda1 1024 1279 256 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx D117F98E-6F2C-D04B-A5B2-xxxxxxxxxxxx private
                            /dev/sda2 1280 1343 64 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 25718777-D0AD-7443-9E60-xxxxxxxxxxxx proinfo
                            /dev/sda3 1344 1407 64 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 8A4BB8B4-E304-AE48-8536-xxxxxxxxxxxx misc
                            /dev/sda21 2048 3071 1024 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 08992135-13C6-084B-9322-xxxxxxxxxxxx param
                            /dev/sda22 3072 5119 2048 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 333A128E-D3E3-B94D-92F4-xxxxxxxxxxxx efs
                            /dev/sda23 5120 5631 512 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx F20AA902-1C5D-294A-9177-xxxxxxxxxxxx pnv
                            /dev/sda24 5632 6655 1024 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx DB88503D-34A5-3E41-836D-xxxxxxxxxxxx ldfw
                            /dev/sda25 6656 7679 1024 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 012B3303-34AC-284D-99B4-xxxxxxxxxxxx dtb
                            /dev/sda26 7680 13823 6144 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx FAEC2ECF-8544-E241-B19D-xxxxxxxxxxxx bootimg
                            /dev/sda27 13824 22015 8192 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx F13A0978-B1B5-1A4E-8821-xxxxxxxxxxxx recovery
                            /dev/sda28 22016 30207 8192 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx B710EB04-45B9-E94A-8D0B-xxxxxxxxxxxx bootlogo
                            /dev/sda29 30208 35327 5120 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx AD5EC4B6-2D9F-8544-9417-xxxxxxxxxxxx rstinfo
                            /dev/sda30 35328 40447 5120 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx CCEB0B18-39CB-D547-9DB7-xxxxxxxxxxxx mnv
                            /dev/sda31 40448 45567 5120 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx D4981A2B-0478-544E-9607-xxxxxxxxxxxx reserved1
                            /dev/sda32 45568 50687 5120 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 6D6C9A36-E919-264D-A9EE-xxxxxxxxxxxx reserved2
                            /dev/sda33 50688 55807 5120 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 60B98C0E-BEAD-B043-9CC6-xxxxxxxxxxxx reserved3
                            /dev/sda41 65536 7929855 7864320 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx F2ECCD60-9303-46B1-B193-xxxxxxxxxxxx system
                            /dev/sda42 7929856 8060927 131072 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx DD8D25F3-92F2-4B24-9558-xxxxxxxxxxxx custom
                            /dev/sda43 8060928 8323071 262144 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx 01573816-7EBF-4860-8AB7-xxxxxxxxxxxx cache
                            /dev/sda44 8323072 15267834 6944763 EBD0A0A2-B9E5-4433-87C0-xxxxxxxxxxxx E15F5427-031C-4BB0-89D5-xxxxxxxxxxxx userdata


                            Expert command (m for help):


                            Because you have a lot of binds to the root you have to modify the partitions form recovery.



                            First pitfall, the default recovery image for Ubuntu is not adb enabled. I used TWRP 3.0.



                            Second pitfall, TWRP fdisk utility is not good enough, it is the busybox variant and it has not the modification commands. So just make a copy (with dd from the system image to a file so you can mount as a loop device) of the system partition onthe SD card, mount it, create with mknod /dev/sda in this mount and chroot /sbin/fdisk



                            Now you can play with partitions. Just be careful not to mess anything but the four target partitions. Don't forget to put the names to the partition's labels.



                            All of the four partitions are ext4 make the filesystems and then you should be able to mount them from TWRP menu.
                            If you have just grow the system partition you should be able to getaway with resizing the fs.



                            You could redo the partitions and then just reflash the Ubuntu system with ubuntu-device-flash.







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Jun 9 '16 at 8:14

























                            answered Jun 9 '16 at 7:49









                            E. TimoteiE. Timotei

                            1166




                            1166






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Ask Ubuntu!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f514913%2fhow-to-get-a-larger-root-partition-on-touch%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                Human spaceflight

                                Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

                                File:DeusFollowingSea.jpg