From: Ondrej Kozina <okozina@redhat.com>
To: Dev Chakraborty <ujjwaldev003@gmail.com>, dm-crypt@saout.de
Subject: Re: [dm-crypt] LUKS Root Volume encryption.
Date: Mon, 14 Sep 2020 11:08:17 +0200 [thread overview]
Message-ID: <3085755d-7a3e-e9f6-aed0-5e2eaa9e9ea1@redhat.com> (raw)
In-Reply-To: <CACcM9iXPzZCOh67mbwPf5mTn-cVmciTBX2hw6_fOP5NA+6WaXg@mail.gmail.com>
On 9/11/20 8:09 AM, Dev Chakraborty wrote:
> Hi,
>
> We have root volume and additional disks, I can encrypt the additional
> volume but If I do root it says root is busy can't do, how can I encrypt
> the root on the fly without detaching?
> Say we have already on prod machines, how can we achieve this for prod
> systems without affecting anything.
>
You can't do it while filesystem is mounted. You must take filesystem
offline for the short time to allow introduction of new device-mapper
device underneath your filesystem.
I'd recommend to read reencryption man page (especially the implications
of cryptsetup reencrypt action with --reduce-device-size argument), but
in very short you'd need following list of commands:
You can do it with detached LUKS2 header put in separate file like follows:
1) umount /dev/sdx (your fs)
2) cryptsetup reencrypt --encrypt --init-only --header file.x /dev/sdx
encrypted_sdx
This will create LUKS2 header in file.x ready for online encryption of
device /dev/sdx. It would also activate dm device 'encrypted_sdx'. Note
that unless you finish full device encryption some part of /dev/sdx are
still exposed as plaintext.
3) mount /dev/mapper/encrypted_sdx /mnt/path
4) cryptsetup reencrypt /dev/sdx --header file.x
----------------
Or if you can shrink your filesystem (or extend size of underlying
/dev/sdx), you may use this:
1) umount /dev/sdx (your fs)
2) cryptsetup reencrypt --encrypt --init-only --reduce-device-size 32m
/dev/sdx encrypted_sdx
Really, be *carefull* with --reduce-device-size. You *HAVE* to be sure
you're using it correctly. This option can destroy your fs if used
wrong. Otherwise it has same effect as step 2) above
3) mount /dev/mapper/encrypted_sdx /mnt/path
4) cryptsetup reencrypt /dev/sdx
Regards
O.
prev parent reply other threads:[~2020-09-14 9:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-11 6:09 [dm-crypt] LUKS Root Volume encryption Dev Chakraborty
2020-09-14 9:08 ` Ondrej Kozina [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3085755d-7a3e-e9f6-aed0-5e2eaa9e9ea1@redhat.com \
--to=okozina@redhat.com \
--cc=dm-crypt@saout.de \
--cc=ujjwaldev003@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).