To remount bootable partion of sd card in read only form

Technical issues/questions of an intermediate or advanced nature.
Post Reply
mudit.s
White ninja
White ninja
Posts: 15
Joined: 24 Jan 2020, 11:39
Distribution: Porteus 3.2.2 Xfce

To remount bootable partion of sd card in read only form

Post#1 by mudit.s » 30 Jan 2020, 15:03

Hi,
I have made two partition of my sd card , out of which I kept one partition as bootable and installed porteus in that.
I want to make this partition as read only.

I used the following command for that

Code: Select all

mount -o remount,ro /[device partition path]
But seems like, It is working fine when I use this partition into different system but if I boot porteus using this partition only then the partition no longer remains read only.

How can we remount the partition as read only, even when porteus is booted using the same partition only. Any help would be surely appreciated.

jssouza
DEV Team
DEV Team
Posts: 1165
Joined: 09 Jul 2015, 14:17
Distribution: Porteus x86 arm

To remount bootable partion of sd card in read only form

Post#2 by jssouza » 30 Jan 2020, 17:35

You could try using mopt cheatcode.
mopt

... This cheatcode will allow you to customize your filesystem
mount options. By default, the mount options for all
filesystems in Porteus are: "noatime,nodiratime,suid,dev,exec,async".
Each option must be separated with a comma "," with no spaces
between any characters.
Example: 'mopt=realtime,sync,users,nosuid,noexec'
See 'man mount' for more information on specific mount options.
So use the cheatcode as mopt=noatime,nodiratime,suid,dev,exec,async,ro to add the ro option while preserving the existing default options.

The problem is it might mount both your partitions as read only :)
I guess you could then remount the other partition that you do not want as ro to rw in say rc.local.

mudit.s
White ninja
White ninja
Posts: 15
Joined: 24 Jan 2020, 11:39
Distribution: Porteus 3.2.2 Xfce

To remount bootable partion of sd card in read only form

Post#3 by mudit.s » 31 Jan 2020, 10:17

Thanks.
I tried to write this cheat code inside my porteus.cfg file under the text mode as following

Code: Select all

APPEND mopt=noatime,nodiratime,suid,dev,exec,async,ro
But it started working as read only for mnt/sda1/.. inside its contents. but It is still not working for the porteus filesystem and its contents (like Desktop, Downloads, etc folders ) still their contents can be changed or are writable, I want to make the filesystem also read only in addition to the bootable partition sda1 .

Additionally I also want to see my porteus filesystem contents ( Desktop, Downloads, etc, opt folders) apart from bootable partition folders (Boot, Porteus, EFI etc ) if I mount my card to another linux machine. Right now I am not able to see that.

Any suggestions please?

jssouza
DEV Team
DEV Team
Posts: 1165
Joined: 09 Jul 2015, 14:17
Distribution: Porteus x86 arm

To remount bootable partion of sd card in read only form

Post#4 by jssouza » 01 Feb 2020, 01:45

mudit.s wrote:
31 Jan 2020, 10:17
but It is still not working for the porteus filesystem and its contents (like Desktop, Downloads, etc folders ) still their contents can be changed or are writable, I want to make the filesystem also read only in addition to the bootable partition sda1 .
The porteus filesystem(s) are read only squashfs file systems made read write with an aufs writeble branch. Not sure what you mean by porteus filesystem ius writeable. It is writeable only in memory, does not write to physical medium. Making the live system readonly will not only work, but also dont see the point of it.
mudit.s wrote:
31 Jan 2020, 10:17
Additionally I also want to see my porteus filesystem contents ( Desktop, Downloads, etc, opt folders) apart from bootable partition folders (Boot, Porteus, EFI etc ) if I mount my card to another linux machine.
You need to mount the porteus modules as loop devices to see them on another linux. Mounting them as loop devices will also make them read only, which is what you wanted in the first place.

EDIT: I see you asked it elsewhere and got a similar response.

Post Reply