Page 1 of 1

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

Posted: Sun Oct 28, 2018 11:24 am
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?

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

Posted: Sun Oct 28, 2018 2:38 pm
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)
...

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

Posted: Sun Oct 28, 2018 8:56 pm
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.

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

Posted: Sun Oct 28, 2018 9:36 pm
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 :?.

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

Posted: Sun Apr 19, 2020 11:11 pm
by betojsp
Hi, the problem is dhclient.leases config a static ip and tried again.

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

.