LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Blogs > mike47
User Name
Password

Notices

Rate this Entry

'/' root filesystem is read-only! YaY no more useradd requests!!

Posted 01-16-2009 at 01:32 PM by mike47
Updated 01-20-2009 at 11:49 AM by mike47

Interesting and frustrating problem, well 2 problems...

I seem to have somehow caused the '/' partition to become read-only
AND my /etc/vfstab entry for '/' has this error:
the mount point is /dev/dsk/c1t0d0s0, and
mirror /dev/md/rdsk/d0 is set as the 'filesystem to fsck'.

After much hunting, searching, and thinking, I believe I've found a solution:
Did I mention that my root (/) partition is mirrored?

This is how my mirror should look
# metastat
d0: Mirror
Submirror 0: d1
State: Okay
Submirror 1: d2
State: Okay
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 41945472 blocks (20 GB)

d1: Submirror of d0
State: Okay
Size: 41945472 blocks (20 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c1t0d0s0 0 No Okay Yes


d2: Submirror of d0
State: Okay
Size: 41945472 blocks (20 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c1t1d0s0 0 No Okay Yes

d0 is the root (/) partition.
with d1 and d2 comprising the two submirrors.

This is how the entry in /etc/vfstab should look:
#DTM DTF MP FS FP MAB MO
~
/dev/md/dsk/d0 /dev/md/rdsk/d0 / ufs 1 no -
~

Remember the problem is I can not write anywhere on the "/" filesystem.
For instance I attempted to copy a file and received an error message similar to
cp: cannot create "/path/filename" Read-only file system

This was bad. I was attempting to make a backup of the vfstab file before modification.
well maybe not so bad, the system was running, and I really didn't have to worry about any
rouge administrator changing file permissions, overwriting critical files, or adding groups
to the server. ( I hope my boss doesn't forget his password...)

The solution I came to me after stepping away and playing a game of chess:

I need to
boot to maintenance mode
check the filesystem for errors
mount or remount '/' in the correct 'mode
correct the error i'd found in the vfstab using the metaroot command
reboot into multiuser mode
attach and sync submirror d2 (the submirror was not attached at the time the filesystem
went read-only)

steps:

1. boot to maintenance mode

# init s
~
# Type Ctrl-d to proceed with normal startup,
(or give root password for system maintenance):


2. check the filesystem for errors

# fsck /dev/mdm/rdsk/d0
~
(this takes a few minutes...)
~


3. mount or remount '/' in the correct 'mode

the next command mounts '/' making it read - write
and is required for correcting the bigger issue of the inconsistent line in vfstab

# mount -o rw,remount /dev/md/dsk/d0 /


4. correct the error i'd found in the vfstab using the metaroot command

the following command edits both /etc/vfstab and /etc/system
so's the OS knows where and how to boot.

# metaroot d0

then check that vfstab to make sure the correct entry is there for '/'
# cat /etc/vfstab

### /dev/md/dsk/d0 /dev/md/rdsk/d0 / ufs 1 no -


5. reboot into multiuser mode

# reboot

at this point my filesystem is read/write I'd verified with the following:

# cp /etc/vfstab /etc/vfstab.backup


6. attach and sync submirror d2

# metattach d0 d2

after the synchronization completed my system is operating normally.

Mike
Posted in Uncategorized
Views 1616 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



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

Main Menu
Advertisement

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 Google+: linuxquestions
Open Source Consulting | Domain Registration