Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do i mount a fs as read only?

Status
Not open for further replies.

farley99

MIS
Feb 12, 2003
413
US
It tried mount -r /dev/hda2 but it wouldnt let me

[root@localhost root]# mount -r /dev/hda2
mount: /dev/hda2 already mounted or /usr busy
mount: according to mtab, /dev/hda2 is already mounted on /usr

I also tried to unmount it but it removed it from /etc/fstab and not i cant get that computer to run kde
 
try some thing like this
mount -t <user fs type> -o ro remount /dev/hda2 /usr


I am not sure about the sequence of the options but -o remount is used to remount the already mounted FS

Read man page for mount specifically -o options.
 

mount -o remount,ro /usr

will do it.

Cheers

Henrik Morsing
Certified AIX 4.3 Systems Administration
& p690 Technical Support
 
It still advises me not to do it, got any tips?...
sh-2.05a# mount -o remount,ro /usr
sh-2.05a# fsck /usr
fsck 1.27 (8-Mar-2002)
e2fsck 1.27 (8-Mar-2002)
/dev/hda2 is mounted.

WARNING!!! Running e2fsck on a mounted filesystem may cause
SEVERE filesystem damage.

Do you really want to continue (y/n)? no

check aborted.
 
You asked how to mount a directory read-only, not how to check the filesystem. The directory is mounted read-only right now, you have to unmount it to run fsck on it cleanly.

Type mount to see which partitions are currently mounted. It will tell you whether or not its mounted read-only or read-write.

ChrisP
 
Is there an easy way to fsck all partitions at once?
 
&quot;fsck -A&quot; will check all partitions listed in the /etc/fstab file that have a number other than 0 in the 6th field of the file.

Chris
 
umount -a will unmount everything in /etc/mtab, as described in the man page.
 

farley,
fsck'ing won't hurt a read-only filesystem. In fact, the root filesystem is checked while mounted everytime you boot.
cheers


Henrik Morsing
Certified AIX 4.3 Systems Administration
& p690 Technical Support
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top