Use the space from a unused partition
Overview
Most Sailfish X devices have a partition left over from Android which is completely unused. Newer Android phones have partitions labelled system_a and system_b, which were used by deliver OS updates as full partitions without overwriting the used one. On next reboot, Android just switches the partition to boot from. SailfishOS only uses system_b, as it doesn’t provide kernel updates.
This does only work on devices with a /dev/disk/by-partlabel/system_a
and a /dev/disk/by-partlabel/system_b
partition, e.g. the Xperia XA2. It does not work on devices with only a /dev/disk/by-partlabel/system
partition like the Xperia X!
Warning! 4.6.0.15 started to use the same system_a partition:
Xperia XA2 and Xperia 10
Partition opt2 was created to allow for more space for AppSupport on Sailfish 5.0.0 (but only if the partition is not already used).
This means that this is not necessary or, if you already used the system_a, you can't udpate through GUI but use command line.
Preparations
You need shell access and root access for this guide. You get shell access by enabling the devlopment mode. You become root by executing devel-su
and entering the password you sat in the development mode settings.
It's good to have a full system backup, e.g. with restic or borg.
Add the partition to LVM
To start, you have to add /dev/disk/by-partlabel/system_a
to the Logical Volume Manager.
- Enter
pvcreate /dev/disk/by-partlabel/system_a
to prepare the partition for LVM. - Secondly, type
vgextend sailfish /dev/disk/by-partlabel/system_a
to add the partition to thesailfish
volume group.
If you get messages similar to this:
/dev/mmcblk0rpmb: read failed after 0 of 4096 at 4186112: Input/output error
Don't worry. mmcblk0rpmb
stands for Replay Protected Memory Block, which is a security storage feature of Android not used by SailfishOS. When the programs you just executed scan all partitions, they won't be able to read this secure storage, hence the error message.
Extend the sailfish root filesystem
Now, the space of the sailfish volume group is extended by the size of the system_a
partition and we can continue with adding the new free space of the volume group to the root volume.
- This is done with
lvextend sailfish/root -l +100%Free
, which tells LVM to assign all free space in thesailfish
volume group to theroot
volume. - In the end, we resize the root filesystem to the new size of the
root
volume by enteringresize2fs /dev/mapper/sailfish-root
. This can be done while the filesystem is mounted, which is a nice feature of ext4.
Now you can proceed with installing apps or starting the system update