mount SD read-only and use overlay ramfs #70

Open
fsagbuya wants to merge 1 commits from fsagbuya/nix-servo:sd_readonly into master
Collaborator

Description

  • mount SD read-only by default and use overlay ramfs
  • Add option to easily mount SD r/w for development

Boot log:

[    2.160993] EXT4-fs (mmcblk0p2): mounted filesystem 44444444-4444-4444-8888-888888888888 ro with ordered data mode. Quota mode: disabled.

Runtime:

bash-5.2# df -h
Filesystem      Size  Used Avail Use% Mounted on
overlay         1.0G   48K  1.0G   1% /
devtmpfs        469M     0  469M   0% /dev
tmpfs           487M  4.0K  487M   1% /run
tmpfs           487M     0  487M   0% /dev/shm

Closes #69

### Description - mount SD read-only by default and use overlay ramfs - Add option to easily mount SD r/w for development Boot log: ``` [ 2.160993] EXT4-fs (mmcblk0p2): mounted filesystem 44444444-4444-4444-8888-888888888888 ro with ordered data mode. Quota mode: disabled. ``` Runtime: ``` bash-5.2# df -h Filesystem Size Used Avail Use% Mounted on overlay 1.0G 48K 1.0G 1% / devtmpfs 469M 0 469M 0% /dev tmpfs 487M 4.0K 487M 1% /run tmpfs 487M 0 487M 0% /dev/shm ``` Closes #69
fsagbuya added 1 commit 2025-01-09 16:07:30 +08:00
Owner

Add option to easily mount SD r/w for development

If I understand correctly you currently have to replace the entire SD image to use that option. Doesn't sound very easy.

Would be easier to manually remount the SD card RW and modify some file to activate the option.

> Add option to easily mount SD r/w for development If I understand correctly you currently have to replace the entire SD image to use that option. Doesn't sound very easy. Would be easier to manually remount the SD card RW and modify some file to activate the option.
Author
Collaborator

Upon testing, it seems manually remounting as RW in runtime is not possible in an overlayfs setup. Running mount -o remount,rw / fails because the root is mounted as an overlay type, combining a read-only SD card mount at /mnt.ro with a RAM-based overlay at /mnt.overlay. This actually makes sense for our goal of preventing SD card corruption, since all writes go to RAM while keeping the SD card safe.

Let me know if you had a different approach in mind.

Upon testing, it seems manually remounting as RW in runtime is not possible in an `overlayfs` setup. Running `mount -o remount,rw /` fails because the root is mounted as an overlay type, combining a read-only SD card mount at `/mnt.ro` with a RAM-based overlay at `/mnt.overlay`. This actually makes sense for our goal of preventing SD card corruption, since all writes go to RAM while keeping the SD card safe. Let me know if you had a different approach in mind.
Owner

There's always the option of having a third partition with configuration. Or just use the FAT boot partition for that.

There's always the option of having a third partition with configuration. Or just use the FAT boot partition for that.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u sd_readonly:fsagbuya-sd_readonly
git checkout fsagbuya-sd_readonly
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/nix-servo#70
No description provided.