Root partition filling up

First of all, a big thank you all for advice and assistance!

Background tl;dr
My Xperia X is stuck on 4.4.0.58 as lack of space on the root partition prevents further upgrades.

Game plan
I have decided to do a fresh install of Sailfish OS once I have migrated important data to a new device. The primary reason for this is that I’ve had a number of failed OS upgrades/command line recoveries since 2018, plus uncountable apps installed, tested and removed. The idea now being that starting over will remove any cruft and potential interference from various packages from various sources.

Before wiping the X I will use it as a playground for trying out the good suggestions I have received in this thread. I’ll start by addressing storage space, then go on to extend the root partition.

1 Like

Storage: Findings
I have used three tools to check storage use:

  1. [Settings > Storage](https://docs.sailfishos.org/Support/Help_Articles/Storage_Space/):
    • Gives an overview, but very limited info on the root partition
  2. [Storage Space](https://openrepos.net/content/ade/space-inspector) app:
    • Provides drill-down into directories. A bit slow at times and I had it crash twice
  3. ncdu (from Chum, accessed via ssh):
    • Drill-down. Worked very well, nice to use a physical keyboard and be able to copy&paste findings

These are the things that stand out at first sight; space that probably could be recovered by deleting or moving/symlinking items:

240 MiB OSM Scout Server, MLS, Syncthing
26 MiB Default videos and photos in /etc/skel
53 MiB /usr/share/ambience [several @ 2-4 MB]
116 MiB One font and unused locales/translations
435 MiB Total space occupied

Syncthing is the only orphaned thing on root that I noticed at a cursory glance.

Then there are interesting items I haven’t looked closer at:
68 MiB /system/lib64
55 MiB /usr/lib/locale/locale-archive
35 MiB /var/lib/rpm
158 MiB Total space occupied

1 Like

Questions and next steps
When I have some time for it, this is what I will be doing next.

Move/symlink - permissions!?

  • OSM Scout Server
  • MLS
  • Default vids/pics
  • Ambiances

Remove

  • Syncthing
  • unused(?) wqy-zenhei font - 16 MiB
  • unused locales

Knowledge gaps

  • Will removed locales and fonts be reinstalled on OS upgrade? Is there a better way to get rid of them?
  • What is /usr/lib/locale/locale-archive (55 MiB) for? Can it be pruned?
  • Spring-cleaning of rpm's?
  • IIRC, the Sailfish OS on the Xperia X is 32-bit - what is /system/lib64 (68 MiB) for?
1 Like

Don’t: This is much harder to do correctly than most anticipate; permissions are the primary but not the only aspect.

In general: Only move, symlink or remove “system” stuff, if you fully understand every possible consequence, i.e., if you are an UNIX expert. If not, leave it, the chance of detecting unintended consequences often much later is simply too high.

Hence do not remove “unused” locales, MLS etc., if they are part of the regular SailfishOS installation. For example, an app or command line tool which uses a deleted locale might not be able to display anything, consequently you even cannot copy&paste output foreign to you into Google Translate or a similar service to understand what is going on / wrong.

You may delete the default videos, pictures and ambiences you are 100% sure of not wanting them; I deleted only the default video, because I was never 100% sure about the rest. And there is at most a few 10 MBytes to be gained on a 2500 MBytes volume, so what!?!

You sure can remove everything you installed on top of the basic SailfishOS installation (e.g., Syncthing), but you must ensure to restore the original state of the OS. If you are not 100% sure how to achieve this, leave it!

The only real way out is …

… go on to extend the root partition.

3 Likes

I agree completely - I have done this a couple of times on my Xperia X (F5122), and it is the best way to do it (by that I mean that it isn’t a hack that may cause problems later, but keeps consistency with with the way that the filesystems are set up to begin with). If you want some more background on what is going on before following the instructions, search for something like “LVM guide”. The diagram and explanations here may be helpful.

2 Likes

I really would like to have an option (shell script?) to do this automatically from Linux computer similar to the flash process! The commands from the gitlab link (above) seems too complex for me.

Thanks to @oroesler, I tested this Extend SailfishOS rootfs with a hidden, unused partition.-Oskar Roesler’s Blog on my XA2.

It is great.
Before:

Instructions in terminal:

pvcreate /dev/disk/by-partlabel/system_a
vgextend sailfish /dev/disk/by-partlabel/system_a
#If you get messages similar to this:
#/dev/mmcblk0rpmb: read failed after 0 of 4096 at 4186112: Input/output error
#Don’t worry.
lvextend sailfish/root -l +100%Free
resize2fs /dev/mapper/sailfish-root

Done!
Result:

Read the article carefully though, as I suppose one can totally ruin their installation.

Edit:
It was under 4.4.0.? though.
I didn’t try on 4.5.0.18 as room is sufficient atm.
The only downside is that cloning phones with dd to have a backup one is not working with this trick.
edit: another downside is that SFOS can’t be reflashed without to reflash Android first.

2 Likes

Yes, but he biggest downside is as mentioned in the blog entry:
“Additionally, you won’t be able to reflash SailfishOS without reflashing Android first.”
As Jolla’s new mantra since SailfishOS 4 is “it does not matter if upgrading SailfishOS is unstable and tends to break an SailfishOS installation, because reflashing is so easy” (as stated by Jovirkku multiple times here at FSO), I perceive this as a significant drawback; much more than simple cloning via dd cannot work, because the LVM root volume is distributed across two partitions. BTW, backing up on file-system level via tar requires more knowledge and understanding but is superior to trivial backing up on block device level via dd.

Yes, thank you, I forgot that.
I was re-reading it and wanted to add it right away.
Also, I wanted to add the article on the wiki.

1 Like

Superior than backing up with dd, you mean?

1 Like

This is impossible, these actions technically must be performed at the recovery console, which can be operated from your Linux computer via an USB cable.
Basically you are asking for someone else to take the responsibility for executing a few critical commands: This cannot work, because all responsibility for using Free Software (= “Open Source Software”) is always on the user.

The commands from the gitlab link (above) seems too complex for me.

You stated this multiple times, but never mentioned what appears to be “too complex for you”. I cannot think of anything simpler than the current step-by-step guide, but am sure open to any specific suggestions how to improve it.

As stated before, if you really do something wrong (performing steps in the wrong order, significantly mistype commands etc.) usually you will see error messages indicating your wrong-doing, but at worst you have to re-flash SailfishOS, so backup your data first (as always with such low-level LVM and filesystem changes). “Bricking your device” is basically impossible with these actions (as I also stated before when you expressed this fear of yours elsewhere at FSO), but I will never say “never”, because I have no idea what ideas users have to do things differently (i.e., wrong).

If you are so afraid, but OTOH so keen on gaining more space on your root volume, why don’t you try on a non-production device (an old Xperia X is fully sufficient for that).

2 Likes

If you mean my “Guide: Installing SailfishX on Xperias” or specific parts of it, I am glad, if you link to it (for specific parts, the links in the “Table of content” are suitable), but strongly oppose copying any content: Any copied content will be outdated (“stale”) from the moment you copy it! You will not be able to keep up with changes, because the mechanisms to notify you about changes are weak and it is tedious, completely superfluous work to copy every new change (and again, and again, and …). To avoid copying content is one of the principal reasons why web-links have been invented.

Nono, I meant: to point to the wiki’s book about expanding root partition, which contains oroesler’s method.
But maybe you could make a link to your guide in this subsection?

And I’d be interested and curious if you want/have time to elaborate about tar backup method. Maybe here, where you began to talk about it?

No, I will not link to stuff, which …

  • I have not quality assured personally: i.e., practically tested multiple times.
  • has obvious and significant drawbacks over the solution I present and use: i.e., is inferior from my perspective.
  • is not a generic solution: i.e., only works on specific devices, which does not fit to a guide for all devices SailfishX supports.
  • I have no idea how long it is maintained: Most guides become unmaintained after a couple of months, in contrast to mine (multiple ones), which undergo regular maintenance since their inceptions (starting 2017). I also usually mark information as outdated or not covering newer devices, which most guides by others do not.

It does not make any sense to duplicate information further and further (it usually does not become any better by doing so): Search the WWW, this is common knowledge for more than 35 years. My intention was only to indicate that.
Alternatively (and better suited for command line beginners) use a backup software specifically designed for this purpose, as restic or many others.

A misunderstanding which sticks… :slightly_smiling_face: I am sorry if my English is involved.
I meant I wanted to add in my first post on this thread, a link to, not only oroesler blog, but also to his wiki. (Or even better, replace the link to his blog by a link to his wiki, so users discover it and also can access/add other informations).
Then, I meant that you could add a link into the wiki, pointing to your guide. (not in your guide to the wiki).
So, people would have more chances to discover your article.

Regarding tar, what I am interested to know - and I searched on the forum and in your guide to check if you already wrote about that - is not how tar works, but from where you use it in SFOS and what you do backup.
Do you backup /home directory or the whole filesystem with tar?
From where do you achieve this: Terminal while the device is running or from recovery console, or as root within a second user while your regular user is not used? ect.

1 Like

I meant a script running on the Linux computer while the phone is connected as you wrote.
edit: similar to the flashing script.

I will do so for training.

1 Like

IMHO rather the lack of context, i.e. writing too tersely (which ultimately results in writing much more, than being concise in the first place).

I meant I wanted to add in my first post on this thread, a link to, not only oroesler blog, but also to his wiki. (Or even better, replace the link to his blog by a link to his wiki, so users discover it and also can access/add other informations).

Do as you like, I cannot see how or why this would involve me.

Then, I meant that you could add a link into the wiki, pointing to your guide. (not in your guide to the wiki).

Again: Do as you like, why do you try to involve me? Everybody is welcome to link to my guides (I just oppose copying anything from them without having a sustainable maintenance concept).

Regarding tar , what I am interested to know - and I searched on the forum and in your guide to check if you already wrote about that - is not how tar works, but from where you use it in SFOS and what you do backup.

  • “How it works”: Do read its man page thoroughly, even if you are not interested.
  • “from where you use it in SFOS and what you do backup”: As with any other Linux or UNIX installation.
  • “Do you backup /home directory or the whole filesystem with tar”: This is the same! Do as it fits best for you. Usually I backup both file-systems of a SailfishOS installation: / and /home
  • “From where do you achieve this: Terminal while the device is running or from recovery console,”: If you would have searched the WWW for tar backups, you know that single-user mode is only necessary for restoring (often, but not always), only in corner cases for creating backups.
  • “as root within a second user while your regular user is not used?”: Better do not use tar for backups, if that is a serious question (see also tar man-page) and basic UNIX user concepts are not well understood.

TL;DR:I am not your interactive UNIX guide, I feel abused by repeatedly trying to achieve that.

Ok, understood. Thank you for detailing and my apologies for the time waste.

2 Likes

Thank you, everyone who replied here!

I’d like to put that in relation to the available free space rather than the size of the volume.

A few 10 MB here and there adds up to 435 MB, which would roughly amount to an 80% increase in free space for me. That would get me over the upgrade threshold by a significant margin.

Well, that’s not me :slight_smile: Instead I decided to ditch App Support plus MLS, OSM Scout Server (map data were already on the SD card) and Pure Maps.

I failed uninstalling syncthing, because pkcon remove claimed that the package reported to be installed by pkcon search wasn’t installed after all :thinking:

This gathered enough space to upgrade all the way to 4.5.0.19. So mission accomplished, in a sense. I will not restore all the stuff I removed, but make a clean-slate start by flashing the latest release and expanding the root partition.

I’ve set up a new phone using @olf’s guide and am in the process of migrating. This comes with some issues (nemo/defaultuser, failing .ics export/import) that I want to resolve before flashing the Xperia X.

Again, thank you for all the knowledge shared here!
[Edit to properly tag @olf]

2 Likes

Before every upgrade i check/delete/uninstall the following to gain 500MB free space.

Check: /opt/alien/usr/share
CHUM
mimic
Osmscout
Bassoon Tracker
Unistall from Storeman
rpncalc
Jupii