Is it possible to mount an entire disk device read only?
binarydepth at gmail.com
Sun Sep 6 22:56:08 UTC 2015
Hardware and software are two separate things. The disk is "mounted"
entirely it's just that the disks says it has two, one or more partitions.
The disk's description is read when plugged. When you mount you're using
the software part not the hardware nature of the disk.
On Sun, Sep 6, 2015, 6:20 PM Colin Watson <cjwatson at ubuntu.com> wrote:
> On Sun, Sep 06, 2015 at 05:59:13PM +1000, Karl Auer wrote:
> > While looking at another poster's issue I started wondering whether it
> > is possible to attach an entire hard disk drive in read-only mode.
> > Mounting a partition read-only is easy, but I'm not talking about
> > partitions here - I mean the entire drive.
> > That is, can I have a read-only /dev/sdb?
> (Disclaimer: some of the following is from reading kernel code and I
> haven't actually tried it on a whole disk device.)
> "blockdev --setro" is a useful tool that makes a block device read-only.
> In and of itself I do not believe that applying it to a disk device,
> e.g. "blockdev --setro /dev/sdb", automatically applies it to all the
> partitions on that disk. However, when a new partition is added, it
> inherits the read-only policy from its disk; so I believe that if you
> mark the disk and all its partitions read-only using "blockdev --setro"
> after it appears (and figure out a non-racy way to do this), then that
> should be sufficient.
> Does that help? It should at least give you something to experiment
> Some people mentioned journalling filesystems: if the block device is
> read-only, those will simply refuse to "mount -oro" if they still need
> to make changes such as replaying a journal. For such cases, grub-mount
> can be useful since it can read most filesystems but entirely lacks
> write support, so it can safely be used to inspect things in a
> guaranteed read-only mode.
> Colin Watson [cjwatson at ubuntu.com]
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the ubuntu-users