resize /dev/loop0 and increase space

You can use sudo losetup /dev/loop0 to see what file the loopback device is attached to, then you can increase its size with, for example, sudo dd if=/dev/zero bs=1MiB of=/path/to/file conv=notrunc oflag=append count=xxx where xxx is the number of MiB you want to add. After that, sudo losetup -c /dev/loop0 and sudo resize2fs /dev/loop0 should make the new space available for use.


To to see what file the loopback device is attached to, execute:

# losetup /dev/loop0

then to increase its size you can give, for example

# dd if=/dev/zero bs=1MiB of=/path/to/file conv=notrunc oflag=append count=xxx

where xxx is the number of MiB you want to add.

If the file system is not currently mounted on /, to make the new space available for use you can give:

# losetup -c /dev/loop0
# resize2fs /dev/loop0

If the image you are trying to resize is Ubuntu Touch/Ubports rootfs (which is found in /data/system.img) and you are trying to do this from the device, now reboot to recovery and then after entering in the device with adb shell, give:

# losetup /dev/block/loop0 /data/system.img
# e2fsck -f /dev/block/loop0
# resize2fs -f /dev/block/loop0     # if your fs is ext
# xfs_growfs /dev/block/loop0       # if your fs is xfs