View previous topic :: View next topic |
Author |
Message |
Fulgurance Veteran


Joined: 15 Feb 2017 Posts: 1258
|
Posted: Thu Mar 06, 2025 10:33 am Post subject: Technical question about mount/remount ro/rw |
|
|
Hi guys, as some know, I am working on my package manager.
I decided to add a lock system that when it install a package, it unlock the /bin /sbin /lib and /libexec directories as rw, but when the installation is finished, it's remounted as ro.
So it work, but I am facing a big problem. When I do this test (so under virtual machine), it look like after a while, I mean after changing from RO to RW few times, I am facing big performance issues. The system become extremly slow (under the VM)
Is it normal ?
Is there any way to improve this ?
Basically when I unlock/lock, I run these commands:
Code: |
sudo mount --rbind -o remount,rw /bin /bin
sudo mount --rbind -o ro /bin /bin
|
_________________ My actual project: https://github.com/Fulgurance/ISM
Ingenius Software Manager is a tool to build and manage a Linux system from scratch.
It will able to manage a linux installation just with a given path to the futur root path |
|
Back to top |
|
 |
pingtoo Veteran


Joined: 10 Sep 2021 Posts: 1520 Location: Richmond Hill, Canada
|
Posted: Thu Mar 06, 2025 12:12 pm Post subject: |
|
|
Not able to tell in you code logic if mount/umount pair were performed or not.
So may be just check use 'mount' command to see if you have many many time mount same directories. |
|
Back to top |
|
 |
Fulgurance Veteran


Joined: 15 Feb 2017 Posts: 1258
|
Posted: Thu Mar 06, 2025 6:09 pm Post subject: |
|
|
I find a better way to do so.
I realized this method wasn't really what I am looking for, because it is not the purpose of rbind option.
Thank you for your help anyway
I will use chattr _________________ My actual project: https://github.com/Fulgurance/ISM
Ingenius Software Manager is a tool to build and manage a Linux system from scratch.
It will able to manage a linux installation just with a given path to the futur root path |
|
Back to top |
|
 |
Hu Administrator

Joined: 06 Mar 2007 Posts: 23156
|
Posted: Thu Mar 06, 2025 6:50 pm Post subject: |
|
|
I think chattr is a worse way. It does not work on all filesystems, and is persistent, so an untimely system halt may leave the directory in the wrong state. Further, it is not recursive.
A read-only mount is a good approach for what you said you want, but you need to do it properly. I would also use a private mount namespace for the read-write mount, so that nothing else has access during the window that your package manager is working on it. |
|
Back to top |
|
 |
szatox Advocate

Joined: 27 Aug 2013 Posts: 3542
|
Posted: Thu Mar 06, 2025 7:39 pm Post subject: |
|
|
Are you looking for union mount?
Overlayfs is in the main kernel, there's a good chance your system already has all the pieces and you can just use it. And since it keeps all changes in a separate directory, you can reset things with a simple rm -rf _________________ Make Computing Fun Again |
|
Back to top |
|
 |
|