balena-io / docs

Documentation for the balenaCloud platform.
https://docs.balena.io/
Apache License 2.0
68 stars 366 forks source link

balenaOS: partitions diagram incorrectly displays boot and rootA/B partitions as read only #1982

Closed tmigone closed 7 months ago

tmigone commented 3 years ago

Diagram here: https://www.balena.io/docs/reference/OS/overview/2.x/#stateless-and-read-only-rootfs

It states resin-boot, resin-rootA and resin-rootB are "read only" while resin-state and resin-data are read/write. In reality all of them are mounted as rw in balenaOS:

root@d42d6a2:/mnt/boot# lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
mmcblk0     179:0    0  29.7G  0 disk
|-mmcblk0p1 179:1    0    40M  0 part /mnt/boot
|-mmcblk0p2 179:2    0   312M  0 part /mnt/sysroot/active
|-mmcblk0p3 179:3    0   312M  0 part /mnt/sysroot/inactive
|-mmcblk0p4 179:4    0     1K  0 part
|-mmcblk0p5 179:5    0    20M  0 part /mnt/state
`-mmcblk0p6 179:6    0    29G  0 part /mnt/data
zram0       254:0    0 480.3M  0 disk [SWAP]
root@d42d6a2:/mnt/boot# findmnt | grep -e mmcblk -e uuid
|-/mnt/sysroot/active                    /dev/disk/by-uuid/ba1eadef-0170-4242-9221-7354f6c37db9                              ext4       rw,relatime
|-/mnt/data                              /dev/mmcblk0p6                                                                      ext4       rw,relatime
|-/mnt/boot                              /dev/mmcblk0p1                                                                      vfat       rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro
| `-/mnt/sysroot/inactive                /dev/mmcblk0p3                                                                      ext4       rw,relatime
|-/resin-data                            /dev/mmcblk0p6[/resin-data]                                                         ext4       rw,relatime
| |-/var/volatile/lib/docker             /dev/mmcblk0p6[/docker]                                                             ext4       rw,relatime
| |-/var/lib/docker                      /dev/mmcblk0p6[/docker]                                                             ext4       rw,relatime

For details see: https://www.flowdock.com/app/rulemotion/public-s-community/threads/x8Rgs067mIto4OQ6ThUe471Da94

jellyfish-bot commented 3 years ago

[tmigone] This issue has attached support thread https://jel.ly.fish/60de1fe8-7240-4666-9277-fd7c9f48d400

vipulgupta2048 commented 3 years ago

IIRC I think we recently created a new diagram for a blog I was working with @andrewnhem Have to check which blog and if it is actually new. Checking

andrewnhem commented 3 years ago

@vipulgupta2048 @tmigone talking about this one?

image

From Feb 2021 Offline Updates post.

klutchell commented 3 years ago

I think the only incorrect thing there is Boot partition is actually read-write and I think it always has been.

Also the second and third columns should be Root partition A/B, not "Boot".

markcorbinuk commented 3 years ago

Also applies to this one https://www.balena.io/docs/reference/OS/overview/2.x/#image-partition-layout

tmigone commented 3 years ago

@klutchell root partitions are also writable according to my (limited) testing.

klutchell commented 3 years ago

@tmigone It may have looked that way since some directories have the read-write state partition overlayed on top of the active root partition which is otherwise read-only.

root@1582068:~# mount | grep state
/dev/mmcblk0p5 on /mnt/state type ext4 (rw,relatime)
root@1582068:~# mount | grep 0p5  
/dev/mmcblk0p5 on /mnt/state type ext4 (rw,relatime)
/dev/mmcblk0p5 on /etc/machine-id type ext4 (rw,relatime)
/dev/mmcblk0p5 on /etc/fake-hwclock type ext4 (rw,relatime)
/dev/mmcblk0p5 on /etc/NetworkManager/conf.d type ext4 (rw,relatime)
/dev/mmcblk0p5 on /etc/NetworkManager/system-connections type ext4 (rw,relatime)
/dev/mmcblk0p5 on /etc/docker type ext4 (rw,relatime)
/dev/mmcblk0p5 on /etc/balena-supervisor type ext4 (rw,relatime)
/dev/mmcblk0p5 on /etc/hostname type ext4 (rw,relatime)
/dev/mmcblk0p5 on /etc/openvpn type ext4 (rw,relatime)
/dev/mmcblk0p5 on /etc/ssh/hostkeys type ext4 (rw,relatime)
/dev/mmcblk0p5 on /etc/udev/rules.d type ext4 (rw,relatime)
/dev/mmcblk0p5 on /home/root/.docker type ext4 (rw,relatime)
/dev/mmcblk0p5 on /home/root/.rnd type ext4 (rw,relatime)
/dev/mmcblk0p5 on /home/root/.ssh type ext4 (rw,relatime)
/dev/mmcblk0p5 on /usr/share/ca-certificates/balena type ext4 (rw,relatime)
/dev/mmcblk0p5 on /var/lib/NetworkManager type ext4 (rw,relatime)
/dev/mmcblk0p5 on /var/volatile/lib/NetworkManager type ext4 (rw,relatime)
/dev/mmcblk0p5 on /var/lib/bluetooth type ext4 (rw,relatime)
/dev/mmcblk0p5 on /var/volatile/lib/bluetooth type ext4 (rw,relatime)
/dev/mmcblk0p5 on /var/lib/chrony type ext4 (rw,relatime)
/dev/mmcblk0p5 on /var/volatile/lib/chrony type ext4 (rw,relatime)
/dev/mmcblk0p5 on /var/lib/systemd type ext4 (rw,relatime)
/dev/mmcblk0p5 on /var/volatile/lib/systemd type ext4 (rw,relatime)

So on my device any files/directories not in the above list will be read-only. It's a long list of exceptions, and one we wish were shorter to be sure. But it also means we are very intentional when we make a directory read-write, as the default is always read-only.

vipulgupta2048 commented 3 years ago

@klutchell Should we change the diagram then to reflect the current scheme?

klutchell commented 3 years ago

@vipulgupta2048 Yeah, I don't know who has the source for this .png but the boot partition should be changed to read-write. https://www.balena.io/docs/reference/OS/overview/2.x/#stateless-and-read-only-rootfs

Or switch to the new image and make the corrections I listed above.

I think the only incorrect thing there is Boot partition is actually read-write and I think it always has been. Also the second and third columns should be Root partition A/B, not "Boot".

andrewnhem commented 3 years ago

@apexider : Can you please update this image? it's the one we created and used for this blog post (third diagram). Let me know if you need any help interpreting the above.

Corrections by @klutchell and crew:

apexider commented 3 years ago

@andrewnhem Here I updated the diagram to have "read-write" for "boot partition" for both, the post and for the docs :)

cc @klutchell

klutchell commented 3 years ago

Thanks @apexider! I added some comments to the images, but it looks good otherwise!

  1. The two A/B partitions are supposed to be Root not Boot
  2. One of the images says AUDS for the data partition instead of AUFS
apexider commented 3 years ago

@klutchell oh sorry and thank you for the annotations! I've updated the images :)

klutchell commented 3 years ago

Looks good @apexider, thank you!

@vipulgupta2048 How do we update the image in the docs?

andrewnhem commented 3 years ago

@klutchell @vipulgupta2048 Imperfect solution here, but I've added both to our assets repo (how we store editorial-based stuff):

I say it's imperfect because I would much prefer housing images and assets somewhere that better maps to our product architecture. But that kinda thinking is TBD/WIP.

I will update the Offline Updates post. I can update the docs one too, unless Vipul already has this on his mind to do.

Feedback and questions welcome.