Is it possible to mount an entire disk device read only?
petter at synth.no
Sun Sep 6 10:51:22 UTC 2015
On Sun, 06 Sep 2015 19:37:08 +1000
Karl Auer <kauer at biplane.com.au> wrote:
> On Sun, 2015-09-06 at 11:18 +0200, Petter Adsen wrote:
> > Karl Auer <kauer at biplane.com.au> wrote:
> > > That is, can I have a read-only /dev/sdb?
> > Check the manufacturer info, I've seen drives that have jumpers to do
> > just that.
> I know - I used to have several, back in the day. But I haven't seen
> that for a long time now.
This was also years ago, I must admit I haven't really looked into what
the jumpers do on the drives I have now. Just thought it was a
> > If it's possible to do in software I have no idea, but it's an
> > interesting question.
> I wonder what effect it would have on journaling file systems, on drives
> that automatically remap bad sectors and so on...
As long as the file system is also mounted read only the journalling
shouldn't pose a problem, I would think, but I have no idea how the
remapping would be handled. At a guess such an attempt would just fail
in a way similar to how it would fail if there were no free sectors to
remap failed ones into. There might be very good reasons why no such
jumper is available on modern drives, the drive firmware is probably a
lot more complex than it used to be.
Have you looked into whether there is a kernel option to mark a drive
read only? Again, just a guess.
I can see why you would want to do this, I just wonder if it would
cause subtle problems. You can get USB sticks that can be physically set
to read only, could you use that instead of a disk? With mdadm you can
mark an array as read only, could that be a solution? It all depends on
what problem you are trying to solve.
"Are you sure?"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 213 bytes
Desc: OpenPGP digital signature
More information about the ubuntu-users