Loopback to directory

5,535

I would imagine that mount -o bind,ro /some/directory /where/you/want/it/to/be/readonly should do the trick.

Share:
5,535
Avdi
Author by

Avdi

These bios always end up going stale. Head over to https://avdi.codes for something semi-current.

Updated on September 17, 2022

Comments

  • Avdi
    Avdi almost 2 years

    How do I create a loopback mount which exposes a given directory as a read-only filesystem? As contrasted with a loopback mount which exposes a file as a filesystem?

  • Spence
    Spence almost 15 years
    Just be sure that you're on at least a 2.6.26 kernel or this will silently bind mount with the same options as the original mount-point. See: lwn.net/Articles/281157
  • Avdi
    Avdi almost 15 years
    Works like a charm, thanks! And thanks for the caveat, Evan.
  • warren
    warren over 14 years
    should be able to do mount --bind -o ro, too