More than 1 GB of unusable memory on /home?

  • Hi,

    sorry for posting yet another (possibly stupid) question:

    "df /home" shows that I consumed 2.7 GB of memory, whereas "du -h /home" only shows about 800 MB of used memory. Is that normal? Any way to reclaim those lost 2 GB of memory?

    phablet@ubuntu-phablet:~$ sudo df /home -h 
    Filesystem                       Size  Used Avail Use% Mounted on
    /dev/disk/by-partlabel/userdata  9,3G  2,7G  6,7G  29% /home
    phablet@ubuntu-phablet:~$ sudo du -h -c --max-depth=0 /home 
    798M	/home
    798M	total



  • @dave it's not a stupid question, it's a common doubt. Read man df and man du to understand these tools behaviour.

    Also see this

  • @advocatux,

    thanks for the reply. I sort of understand and expect slight differences between df and du output. However, here it's like a factor two difference.

    Digging a little deeper, I think the reason may be the strange file system / mountpoint layout used by ubuntu touch.

    mount | grep /dev/mmcblk0p23

    Lists more than 40 directories that are mounted via device /dev/mmcblk0p23. Looking at /etc/fstab this seems to be accomplished via some bind-mount trickery. However the "actual" directory corresponding to /dev/mmcblk0p23 seems to have been unmounted after bind-mounting, so there is no easy way to find out which directories outside /home take up the "lost" gigabyte of memory.

    Looks like after some tinkering with libertine, I'm soon going to be out of memory 🙂



  • @dave I didn't read your profile before answering. Sorry for my basic reply 🙂

  • @advocatux my profile was still empty by the time you wrote your reply. sorry for wasting your time 🙂

  • In Ubuntu Touch, the root filesystem is mounted read-only and the parts of the system that have to be writable are bind-mounted. The block device you're wondering about is actually the /data partition, as Android calls it. Specifically, you'll find that the folders user-data/ system-data/ and android-data/ appear on this partition if you were to mount it. Contained in those is everything that you're able to write to (as root) in Ubuntu Touch.

    If you'd like to learn more about this process, it's done at process_bind_mounts() in our initramfs. It's configured with the writable-paths file.

  • So this is where my flash memory is going:

    $ mount|grep mmcblk0p23 | sed -n -e 's/.*on \([^ ]\+\).*/\1/p'|sudo xargs du --max-depth=2 -c -h

    -> /userdata/system.img is taking 2 GB and seems to be the actual ubuntu touch file system image. Then I wonder why there is another 4 GB partition in /dev/mmcblk0p21. This is mounted on /android/cache. Is there any reason for that "cache" partition taking up so much memory? Can its size be changed during installation from the ubports-installer to leave more room for my home partition?

  • I'm pretty sure that the installer does not touch the partition layout.


    1. Android is weird. I wouldn't be surprised if some devices/bootloaders have specific expectations about the partition layout
    2. these are embedded devices. If the bootprocess is severly messed up, you can't exactly put the hard disk into that other device and fix the partitions

    So, while I guess it is possible to make cache smaller, I am not gonna try on my device and I'd caution you to do so!

    Now to the aspect of "I'm running out of space" due to tinkering with libertine, ... well you still have some 6GB to through around, not huge, but not nothing either. If you run out of space, rather than doing acrobatics with partition sizes you want to look into acrobatics with bind mounting 😉

Log in to reply