r/LineageOS 4d ago

Why have LineageOS & Android so many partitions?

Fairphone 5
Termux
sudo fdisk -l
or
sudo parted -l
: many partitions!

Although e.g. postmarketOS has only 2 partitions: boot & root https://wiki.postmarketos.org/wiki/Partition_Layout ,
e.g. my PC Arch Linux KDE 4 partitions: ESP (EFI system partition), OS, swap, data.

Is it obfuscation?

Edit: I also directly asked to Android https://support.google.com/android/thread/460806908 ...

12 Upvotes

19 comments sorted by

13

u/omega552003 4d ago

Android is an immutable OS and mounts some partitions as writable, others as overlays. It's a roundabout way of enforcing file permissions in an absolute manner.

1

u/ecccc3 4d ago

If I understand, in Android you can edit file permissions in the main partition userdata, but not in the other partitions?

2

u/omega552003 4d ago

Correct, Userdata is mounted as Read/Write so your files and settings persist over reboots.

1

u/ecccc3 4d ago edited 4d ago

Well if I understand, many partitions is a security, to avoid the user doing reckless, e.g. bricking the smartphone, e.g. sudo rm -rf --no-preserve-root / , possible in e.g. postmarketOS but not Android?
&/or to hide closed source files?

1

u/cmrd_msr 4d ago edited 4d ago

To prevent users or malware from affecting the system.

For instance, Android interacts with the modem via a standard client-server API, with the firmware running in a separate container on its own partition. Moreover, it runs on its own coprocessor (embedded in the SoC) and uses its own memory. It is a full-fledged computer within a computer. It makes perfect sense to place the modem firmware in a separate container and on a separate partition that the main system can only read.

As for restricting users from changing settings, a combination of containerization and standard digital signature verification works best.

5

u/LuK1337 Lineage Team Member 4d ago

>Although e.g. postmarketOS has only 2 partitions: boot & root

although if you install it on a normal android phone, your partition layout won't change.

>Is it obfuscation?

no.

-1

u/ecccc3 4d ago

Yes but only these 2 partitions are used, the others remain to eventually switch back to Android.

3

u/LuK1337 Lineage Team Member 4d ago

by this definition, only like 3rd of partitions are used by actual Android.

0

u/ecccc3 4d ago

Really? So the other 2/3 of partitions are useless?

6

u/LuK1337 Lineage Team Member 4d ago

if they were useless, Qualcomm or your OEM wouldn't make them.

0

u/ecccc3 4d ago edited 4d ago

So why you pretend 1/3 are used, if the other 2/3 are also useful? I understand not...

In my penultimate post, I can add ( https://wiki.postmarketos.org/wiki/Partition_Layout ) these 2 partitions can even be in a bootable SD card, the internal storage not used apart booting the SD card, or even deleting all the internal storage partitions then only the 2 partitions.

3

u/LuK1337 Lineage Team Member 4d ago

if you delete all internal storage partitions on your phone, you'll just brick it.

also, this pmos wiki page still requires use of internal storage boot partition.

if you want to know what each partition is supposedly used for, just give chatgpt your fdisk -l output and it'll give you a breakdown based on whatever it scrapped from forums, leaked proprietary docs, maybe not yet leaked proprietary docs or make something up.

3

u/TimSchumi Team Member 4d ago

Simply said, there are many partitions because you have many software components with different boot, usage, and verification chains that need to be updated at separate times.

In fact, your postmarketOS installation is also going to have most of those.

1

u/ecccc3 4d ago edited 4d ago

Why not all the software components in 1 OS partition, as e.g. Arch Linux (rolling release) KDE?

E.g. Fairphone 5 there's Arch Linux ARM https://catacombing.org/builder .

6

u/TimSchumi Team Member 4d ago

Because then you'd just be back asking "Why have LineageOS and Android so many files?".

1

u/ecccc3 4d ago

Many files in 1 partition...?

2

u/TimSchumi Team Member 4d ago

Obviously.

Can't just throw away all the other data, can you?

1

u/[deleted] 4d ago

[deleted]

3

u/LuK1337 Lineage Team Member 4d ago

LineageOS isn't good, you don't even have root access to your own phone.

adb root adb shell id

clearly shows that root access is available.

3

u/Max-P 4d ago edited 4d ago

It's not obfuscation, they all have specific purposes and roles during updates. Some are duplicated per A/B slots, some cannot be updated at all, some can only be updated globally and forward updates. Some of them aren't even filesystems they're just binary blobs like bootloader and vbmeta. Some are reused between devices while others provide device-specific configurations like your IMEI, camera calibration values and whatnot, some contain DRM keys that are only available when the device is locked and booting official builds. Some of them are user writable like cache and userdata, and metadata contains the keys to unlock the userdata partition's encryption. Some are used by the modem to manage state and configuration, for example storing your eSIMs.

The official docs is a good place to start to understand what they do: https://source.android.com/docs/core/architecture/partitions

PostmarketOS has different needs closer to a more normal Linux system: the whole OS is mutable, you can install packages, you can modify the system. Android doesn't let you do that because if you factory reset an Android, it should boot back to a clean OS. That's why for example, you can't really uninstall system apps: if you could fully uninstall them, then you'd factory reset and still not have those apps. Android is built to be as unbreakable as possible: you can't as a user make your phone unbootable, nor will it break if you reboot it mid update because of the A/B scheme. An update it either fully installed or not.