LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices

Reply
 
LinkBack Search this Thread
Old 11-17-2009, 08:02 PM   #1
dagummit
LQ Newbie
 
Registered: Sep 2009
Posts: 26

Rep: Reputation: 0
Mounting RHEL OS / partition as read-only?


I have been desperately trying to figure out a way to mount (on boot up) a RHEL 5.2 root (/) partition.

I started following the instructions here:
http://en.opensuse.org/How-To_Make_t...stem_read-only

but those are tailored to openSUSE and (in those instructions) there isn't an "/etc/init.d/boot.rootfsck" file in RHEL. I have set the /etc/sysconfig/readonly-root file to readonly=yes and symlinked the var and tmp directories (as well as mtab and resolve.conf files) to the tmpfs partition (just like those instructions state).

Being that RHEL doens't have a /etc/init.d/boot.rootfsck file, I created a script (in /etc/init.d/) that runs out of /etc/rc.d/rc5.d (symlinked...perms are 0775) that has the functions that would be changed in the authors file...ie:

touch /dev/shm/resolv.conf
mkdir /dev/shm/tmp
tar -C /dev/shm -zxf /var.tgz

It is named S10readonly, so it runs at the near beginning of bootup.

Does anyone have and links, suggestions, etc. on mounting the / partition as RO on bootup on a RHEL system?

Thanks.
 
Old 11-17-2009, 09:00 PM   #2
Mr-Bisquit
Member
 
Registered: Feb 2009
Distribution: FreeBSD, OpenBSD, NetBSD, Debian, Fedora
Posts: 770
Blog Entries: 52

Rep: Reputation: 66
Have you looked into editing fstab with the information?
 
Old 11-17-2009, 10:09 PM   #3
dagummit
LQ Newbie
 
Registered: Sep 2009
Posts: 26

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Mr-Bisquit View Post
Have you looked into editing fstab with the information?
yes...that is part of those instructions in the link. I set the / partition to be "ro,defaults"
 
Old 11-17-2009, 10:42 PM   #4
vishesh
Member
 
Registered: Feb 2008
Location: india
Distribution: Fedora,RHEL,Ubuntu
Posts: 413

Rep: Reputation: 48
I think you need to edit initrd image. Because if initrd is specified then root setup is specified in initrd.

Thanks
 
Old 11-17-2009, 11:19 PM   #5
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Debian, FreeBSD
Posts: 3,739
Blog Entries: 5

Rep: Reputation: Disabled
Quote:
Originally Posted by dagummit
Does anyone have and links, suggestions, etc. on mounting the / partition as RO on bootup on a RHEL system?
Two questions:
  1. Why do you want to do this?
  2. What is the output of $ df -h ?
 
Old 11-18-2009, 01:19 PM   #6
dagummit
LQ Newbie
 
Registered: Sep 2009
Posts: 26

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by anomie View Post
Two questions:
  1. Why do you want to do this?
  2. What is the output of $ df -h ?
I am doing this as a security criteria. I will be migrating all of my notes, steps, etc over to a CompactFlash card here soon (actually, I have the OS on a CF already, just testing it out on my laptop running RHEL 5.2). Anyhow, I must show how nothing can be written to the CF device itself...the tmpfs partition (in this case /data) will be ran in the onboard RAM.

Here is my /etc/fstab file:



LABEL=/ / ext3 defaults,ro 1 1
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /data tmpfs uid=500,gid=500,mode=775,size=1g 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0

Here is the output from a df -h:

Filesystem Size Used Avail Use% Mounted on
rootfs 71G 2.0G 65G 3% /
/dev/root 71G 2.0G 65G 3% /
/dev 1013M 132K 1013M 1% /dev
tmpfs 1.0G 33M 992M 4% /data
tmpfs 1.0G 33M 992M 4% /data/var/cache/man
tmpfs 1.0G 33M 992M 4% /data/var/gdm
tmpfs 1.0G 33M 992M 4% /data/var/lock
tmpfs 1.0G 33M 992M 4% /data/var/log
tmpfs 1.0G 33M 992M 4% /data/var/run
tmpfs 1.0G 33M 992M 4% /data/tmp
tmpfs 1.0G 33M 992M 4% /data/var/cache/foomatic
tmpfs 1.0G 33M 992M 4% /data/var/cache/logwatch
tmpfs 1.0G 33M 992M 4% /data/var/db/nscd
tmpfs 1.0G 33M 992M 4% /data/var/lib/dhclient
tmpfs 1.0G 33M 992M 4% /data/var/tmp
/dev/root 71G 2.0G 65G 3% /etc/adjtime
/dev/root 71G 2.0G 65G 3% /etc/fstab
/dev/root 71G 2.0G 65G 3% /etc/ntp.conf
tmpfs 1.0G 33M 992M 4% /data/resolv.conf
tmpfs 1.0G 33M 992M 4% /data/var/account
tmpfs 1.0G 33M 992M 4% /data/var/cache/alchemist
tmpfs 1.0G 33M 992M 4% /data/var/lib/logrotate.status
tmpfs 1.0G 33M 992M 4% /data/var/lib/ntp
tmpfs 1.0G 33M 992M 4% /data/var/empty/sshd/etc/localtime
tmpfs 1.0G 33M 992M 4% /data/var/lib/random-seed
/dev/sda1 1.9G 41M 1.8G 3% /boot
 
Old 11-18-2009, 01:23 PM   #7
dagummit
LQ Newbie
 
Registered: Sep 2009
Posts: 26

Original Poster
Rep: Reputation: 0
also, for an update...I figured out how to get the /var /tmp /home and /root directories to load from tar files, which actually lets me login now...and / is mounted RO... (I added some commands in the /etc/sysconfig/readonly-root file)

thing is that many of the services fail to start now (ie auditd, etc). And I can't load any of the gui utilities...such as system-config-users, etc. I get the following error:

Xlib: connection to "0:0" refused by server
Xlib: No protocol specified


I am figuring it is a permission error somewhere in /var (which is symlinked to /data/var)

Last edited by dagummit; 11-18-2009 at 01:24 PM.
 
Old 11-18-2009, 03:27 PM   #8
dagummit
LQ Newbie
 
Registered: Sep 2009
Posts: 26

Original Poster
Rep: Reputation: 0
well, I disabled selinux and everything works fine... imagine that
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with mounting fat32 partition in RHEL 5 gyzer Red Hat 15 09-09-2008 11:08 AM
Mounting Read/Write Fat32 partition triley Linux - General 1 04-19-2007 12:33 PM
Mounted read-write Fat32 partition suddenly becomes read-only?? hohead Linux - General 8 04-05-2007 12:17 PM
Mounting folder in vfat partition as read-only m3rc_2003 Linux - Newbie 2 11-30-2003 01:09 AM
Mounting mounting extended partition and its Logical drives desbyleo Linux - Newbie 10 02-18-2002 03:13 PM


All times are GMT -5. The time now is 11:44 AM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration