Dietpi-drive_manager, how to make RFS read-only?

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
GeEg
Posts: 5
Joined: Wed Jan 03, 2018 2:18 pm

Dietpi-drive_manager, how to make RFS read-only?

Post by GeEg »

Hello.
I wonder how to use dietpi-drive_manager read-only state on /root (p02) partition , since it shows message "failed, drive busy (mounted)".
Found on https://github.com/Fourdee/DietPi/issues/229

"Completed.

Supports toggling R/W R/O on all partitions, including RootFS."

But how to achieve that?
User avatar
MichaIng
Site Admin
Posts: 2332
Joined: Sat Nov 18, 2017 6:21 pm

Re: Dietpi-drive_manager, how to make RFS read-only?

Post by MichaIng »

I am wondering, that the option is still available for rootfs/bootfs, since many DietPi functions require r/w access on those drives. However it is available and during test on my Stretch VM it worked. I needed to remove the swapfile from the drive first (also possible via drive manager):

Code: Select all

[ SUB1 ] DietPi-Swapfile > Apply
[  OK  ] DietPi-Swapfile | Disable swapfile
[  OK  ] DietPi-Swapfile | swapoff -a
[ INFO ] DietPi-Swapfile | Deleting existing swapfile (/var/swap)
[ INFO ] DietPi-Swapfile | Setting /tmp tmpfs size: 498M
[  OK  ] DietPi-Swapfile | mount -o remount,size=498M tmpfs /tmp
[ INFO ] DietPi-Drive_Manager | Detecting drives, please wait...
[  OK  ] DietPi-Drive_Manager | Detecting currently mounted drives, please wait...
[ INFO ] DietPi-Drive_Manager |  - Detected: /dev/sda1 > /
[  OK  ] DietPi-Drive_Manager | Detecting unmounted drives, please wait...
dumpe2fs 1.43.4 (31-Jan-2017)
[ INFO ] DietPi-Drive_Manager | Detecting drives, please wait...
[  OK  ] DietPi-Drive_Manager | Detecting currently mounted drives, please wait...
[ INFO ] DietPi-Drive_Manager |  - Detected: /dev/sda1 > /
[ INFO ] DietPi-Drive_Manager | RootFS is currently set to R/O. DietPi-Drive_Manager requires R/W access.
[ SUB1 ] DietPi-Services > start
[  OK  ] DietPi-Services | start : cron
[ SUB2 ] DietPi-Process_tool > Apply
[  OK  ] DietPi-Process_tool | Completed
[  OK  ] DietPi-Drive_Manager | RootFS currently set to R/O.
[ INFO ] DietPi-Drive_Manager | Please run "dietpi-drive_manager" again, if you want to re-enable RootFS R/W.
root@VM-Stretch:~# mount
...
/dev/sda1 on / type ext4 (ro,noatime,data=ordered)
...
GeEg
Posts: 5
Joined: Wed Jan 03, 2018 2:18 pm

Re: Dietpi-drive_manager, how to make RFS read-only?

Post by GeEg »

Thank You, I managed to remove swap and dietpi user files from root partition and moved to another (p03). But cannot switch it (root) to RO. It shows that impossible to change to RO since drive is busy (mounted). Tried on Odroid C2. I don't know how to unmount root partition on running system. Sounds like mission impossible ;)
Regarding write requests from system (logs, temps etc), I guess it might be done by ramdisk.
User avatar
MichaIng
Site Admin
Posts: 2332
Joined: Sat Nov 18, 2017 6:21 pm

Re: Dietpi-drive_manager, how to make RFS read-only?

Post by MichaIng »

Hmm, during my tests, ramdisk (+ramlog) was up as well. But yeah, was VM, there things might be different. Maybe there is some network share or other process up that keeps the file system busy/on edit?

Definitely worth to investigate. We could either hide the R/O setting, based on the found condition or resolve the condition after warning/asking user about it :?.
betojsp
Posts: 1
Joined: Sun Apr 19, 2020 11:03 pm

Re: Dietpi-drive_manager, how to make RFS read-only?

Post by betojsp »

Hi, the problem is dhclient.leases config a static ip and tried again.

# lsof / | awk '$4 ~ /[0-9].*w/'

.
Post Reply