Sunday, May 5, 2024
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 4543  / 1 Year ago, fri, may 5, 2023, 6:46:57

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.



More From » partitioning

 Answers
4

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


[#23525] Sunday, May 7, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
issfullus

Total Points: 264
Total Questions: 126
Total Answers: 107

Location: Comoros
Member since Mon, Dec 19, 2022
1 Year ago
;