LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to mount a readonly file system? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-mount-a-readonly-file-system-323161/)

redsector 05-13-2005 12:07 PM

how to mount a readonly file system?
 
I have a near working installation on mandrake 10.1.
Once I get it in a perfect state, I wuold like to use the disk as a readonly, because I will leave the machine running without display/monitor/keyboard and probably someone will powerdown the machine frequenty.
in details I have the root partition, the swap partitions and the data partition.
i want to freeze the root partition and the data partition (i think that them woul be mounted as RW with a command when needed)
Is that a possible scenario?

the swap partition will suffer or will get damaged?

and also, how is possible to disable the autocheck of the filesystems in the startup sequence?

(i need this strange working method for my application)

thanks!

Mara 05-13-2005 04:48 PM

You can do it. Just add 'ro' in the mounting options - if you want it as default, edit /etc/fstab (4th column).

There are things you need to take into account, however. With data partition there should be no problem. It can be read-only. It's more complicated with system - it wants to write to logs, for example (in /var/logs). If you turn off all logging and all other processes that may use for example /tmp for temporary files (or move the directories to another partition) it should work OK.

Don't make swap read-only. It makes it completely unusable. There are no problems with swap when you reboot. It doesn't get corrupt, because it's initilalized at every boot.

redsector 05-14-2005 03:10 AM

my fstab is like this:

/dev/hda1 / ext3 defaults,ro 1 1
/dev/hdc /mnt/cdrom auto umask=0,user,iocharset=iso8859-1,codepage=850,noauto,ro
,exec,users 0 0
none /proc proc defaults 0 0
/dev/hda6 /data ext3 defaults,ro 1 2
/dev/hda5 swap swap defaults 0 0

if I ask mounts the resul is

/dev/hda1 on / type ext3 (ro)
none on /proc type proc (rw)
none on /proc/bus/usb type usbfs (rw)
none on /sys type sysfs (rw)
/dev/hda6 on /data type ext3 (ro)

there are still some other questions..
what is the proc line in fstab and in mounts?
what is the the sys line in the mount?
how i set the ro for those filesystems if is it possible?
and why i s possible to write file in /?

I search the net maybe i faount the andwher myself ;)


How i will create a ramdisk and get it mounted where logs and temp data are writte?
Or I get my system not to write to the disk things like logs?


too many questions.. :newbie:

Mara 05-15-2005 02:23 PM

Quote:

Originally posted by redsector
what is the proc line in fstab and in mounts?
what is the the sys line in the mount?

proc and sys are both special filesystems. They don't exist on disk. They're created dynamically.
Quote:

how i set the ro for those filesystems if is it possible?
It's not a good idea :)
Quote:

and why i s possible to write file in /?
Where and as which user?

Quote:

How i will create a ramdisk and get it mounted where logs and temp data are writte?
Use ramfs filesystem. having logs gone after one boot is not a ery good idea, maybe a script that will copy it to another machine from time to time?
Quote:

Or I get my system not to write to the disk things like logs?
Turn off daemons syslogd and klogd.

redsector 05-16-2005 01:48 AM

I have modified the fstab adding in the 4th column after the "defaults" "ro", so that the results seemed like "defaults,ro" but when i logged in the machine as root, i was able to write in the disks.
The next step was tryiing to remove the "defaults" part and leaving only the "ro" parts of fstab, and that produced a really readonlysystem, but the system were no more working. I wan not more able to modify the fstab file so i had to reinstall everythings. I have tried the remount option of remount, but probably i was wrong.

the problem with ramdisk, is that i have to know where and how create it, and hoe to mount the ramdisks "ghosting" the root filesystem to have a readonly systems that continue to work.

for sure is not a good idea having a machine like that, but I keep in mind that this will be an application machine and if somthing will fail, i will reput a drive image on the disk to the initial status.

i will search on how to disable those daemons!

thanks!


All times are GMT -5. The time now is 12:33 AM.