Re: OT: remount a dir r/o

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



list user wrote:
> Sorry for the OT post but I've been experimenting with exporting filesystems, 
> xen, and lvm and would like to change the mount permissions on a subtree of a 
> filesystem.
> 
> I've tried all sorts of permutations of the "mount" command and
> succeed only in getting "help".
> 
> I would like to remount "/usr" to be read only.  Anybody willing to
> take a stab at this?

I take it /usr isn't a filesystem on its own -- it's part of the /
filesystem.

Short answer -- Can't Be Done. Unix doesn't work that way.

Unix files have a much more vague concept of where they are in the
filesystem tree than you might expect. Nearly everything is done
internally in terms of "inodes", which don't necessarily have one
filesystem location associated with them -- they can have no entry in
the filesystem (they're "unlinked" [1]), or they can have many.

Your best option is to create a /usr filesystem, and mount that
read-only.

Depending on *precisely* what you want to do, you could try marking
every file under /usr as immutable (chattr +Ri /usr) or even try
changing the permissions (chmod -R a-w /usr).

But if you do either of those, be prepared to rebuild your Fedora
install from scratch.

And if you're going to reinstall from scratch *anyway*, why not do it
now and create a separate /usr filesystem in the first place?

Incidentally, I don't consider this post off-topic.

James.

[1] This is often used for temporary files which need to go away when
the process finishes. Unlinked files only exist on disk while there's a
program using them. If the program or system shuts down or crashes, then
the kernel understands the inode and related filesystem blocks to be
unused.

-- 
E-mail address: james |    John's Inverse Law of Physics:
@westexe.demon.co.uk  | You do Physics -- you get inverted.


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux