mounting /usr readonly

John Summerfield debian at herakles.homelinux.org
Sun Dec 30 06:29:21 UTC 2007


Robert P. J. Day wrote:
>   something i brought up a while back but, in order to prevent myself
> doing something incredibly dumb and wiping out anything under /usr by
> accident, i like to mount the /usr filesystem as read-only.
> occasionally, when i've tried to do that manually, i've been
> disallowed with the error that that filesystem is currently busy, and
> one of the possible reasons is that prelink was running.
> 
>   more generally, i'm assuming that (re)mounting /usr readonly will
> always be disallowed if anything is currently open for write, and the
> simplest way to check for that that i use is:
> 
> $ fuser -muv /usr
>                      USER        PID ACCESS COMMAND
> /usr:                rpjday     3142 ...e. (rpjday)gnome-keyring-d
>                      rpjday     3143 ...e. (rpjday)gnome-session
>                      rpjday     3208 ...e. (rpjday)dbus-launch
>                      rpjday     3216 ...e. (rpjday)gconfd-2
>                      rpjday     3220 ...e. (rpjday)gnome-settings-
>                      rpjday     3228 ...e. (rpjday)gconf-helper
>                      rpjday     3229 ...e. (rpjday)metacity
>                      rpjday     3230 ...e. (rpjday)gnome-panel
>                      rpjday     3232 ...e. (rpjday)nautilus
>                      rpjday     3236 ...e. (rpjday)gnome-volume-ma
>                      rpjday     3238 ...e. (rpjday)bonobo-activati
>                      rpjday     3245 ...e. (rpjday)gnome-vfs-daemo
>                      rpjday     3247 ...e. (rpjday)bluetooth-apple
>                      rpjday     3253 ...e. (rpjday)nm-applet
>                      rpjday     3254 ...e. (rpjday)puplet
>                      rpjday     3255 ...e. (rpjday)python
>                      rpjday     3261 ...e. (rpjday)pam-panel-icon
>                      rpjday     3262 ...e. (rpjday)gnome-power-man
>                      rpjday     3267 ...e. (rpjday)/usr/bin/sealer
>                      rpjday     3294 ...e. (rpjday)gnome-screensav
>                      rpjday     3306 ...e. (rpjday)mapping-daemon
>                      rpjday     3327 ...e. (rpjday)wnck-applet
>                      rpjday     3329 ...e. (rpjday)trashapplet
>                      rpjday     3347 ...e. (rpjday)gam_server
>                      rpjday     3361 ...e. (rpjday)notification-ar
>                      rpjday     3363 ...e. (rpjday)fast-user-switc
>                      rpjday     3365 ...e. (rpjday)clock-applet
>                      rpjday     3367 ...e. (rpjday)mixer_applet2
>                      rpjday     3371 ...e. (rpjday)gnome-terminal
>                      rpjday     3381 ....m (rpjday)bash
>                      rpjday     3462 f...m (rpjday)firefox
>                      rpjday     3482 f...m (rpjday)run-mozilla.sh
>                      rpjday     3487 f..e. (rpjday)firefox-bin
>                      rpjday     3524 ....m (rpjday)bash
>                      rpjday     3905 f..e. (rpjday)npviewer.bin
>                      rpjday     4062 ....m (rpjday)bash
> 
> 
>   now, according to the man page for fuser, anything open for write
> will be identified with an "F", so the above should be good and, in
> fact, the remount worked.
> 
>   can i assume that, as long as nothing is open for write, the
> read-only remount should work?  is there any other reason that i would
> be told that the device is busy.  put another way, if i run the above
> command and don't see an "F", should the remount always work?
> 
> rday

Add ro to the mount options in /etc/fstab and see what complains.

This is supposed to work, and if you're running 100 or more Linux guests 
on a Zed box (folk run a lot more than this) it's highly likely you want 
to do this.



-- 

Cheers
John

-- spambait
1aaaaaaa at coco.merseine.nu  Z1aaaaaaa at coco.merseine.nu
-- Advice
http://webfoot.com/advice/email.top.php
http://www.catb.org/~esr/faqs/smart-questions.html
http://support.microsoft.com/kb/555375

You cannot reply off-list:-)




More information about the users mailing list