[dm-crypt] Toggle read-only status of mapping
gmazyland at gmail.com
Thu Oct 25 17:20:42 CEST 2012
On 10/25/2012 04:50 PM, Dennis Birkholz wrote:
> Am 25.10.2012 12:15, schrieb Milan Broz:
> The reason is relatively easy: if my raid is read-only, it can crash and
> I can reassemble it without a problem, but I cannot make it read-only if
> the crypt-mapping is read-write.
If you raid is mapped read-write, and there is a device failure, it either
continue to be read-write (in degraded mode, that's exactly what "redundant"
in RAID means) or the array is lost completely (then you must deactivate
mapped device anyway).
And raid allows resync while read-write so I really do not see real
use for this switch.
(And even read-only fs mount sometime means filesystem journal reply,
specifically after fs crash.)
Anyway, it is easily to be done with dmsetup:
NAME=<your crypt device name>
# load identical but read-only table into inactive slot
dmsetup reload $NAME --readonly --table "$(dmsetup table --showkeys $NAME)"
# switch tables
dmsetup resume $NAME
More information about the dm-crypt