Gentoo Archives: gentoo-user

From: tastytea <gentoo@××××××××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Encrypted hard drives on LVM and urgent power shutdowns.
Date: Mon, 12 Sep 2022 03:40:12
Message-Id: 20220912054004.26e25524@ventiloplattform.tastytea.de
In Reply to: [gentoo-user] Encrypted hard drives on LVM and urgent power shutdowns. by Dale
1 On 2022-09-11 20:56-0500 Dale <rdalek1967@×××××.com> wrote:
2
3 > Howdy,
4 >
5 > Last night we had some bad weather where I live and we ended up with
6 > some power problems.  Ironically they went out a few hours after the
7 > storm was gone.  Anyway.  I had all sorts of encrypted drives open.
8 > My usual drives inside my puter plus the large 14TB external backup
9 > drive that is still copying files over.  Glad my UPS held up while I
10 > closed all those drives and did a proper shutdown.  Doing all that
11 > tho, it made me think about if I wasn't here to do all that.  Being
12 > Linux, I'd suspect that upsmon would tell the puter to do a proper
13 > shutdown which includes unmounting the file system, closing the
14 > encrypted drives, like I do with cryptsetup close <name> etc and then
15 > shutting down.  However, one has to ask, is it set up to do so by
16 > default?  I manage the encrypted drives manually.  I don't use the
17 > crypt services for that like people do when all of the system
18 > drive(s) is encrypted or when just /home is encrypted.  My encrypted
19 > stuff is mounted within /home or for the external backups, in /mnt.
20 > Thing is, some aren't open unless I'm using them or are external.
21 > Since I do it manually, is there a tool that sees they need
22 > unmounting and closing and does it or do I need to do something to
23 > make sure it is done before a shutdown? 
24 >
25 > I suspect this would happen on its own but I'd like to make sure.  I'd
26 > hate to mess up the file system badly on any of my drives or in a
27 > worst case scenario, brick a hard drive with some 1 in a million
28 > chance problem.
29 >
30 > I thought about having a drive connected, open and mounted that I
31 > don't really need and just do a shutdown, see what happens.  Then
32 > again, why not ask and see if anyone else has had this happen and if
33 > things turned out OK or if there was problems.  I'm lucky, most of
34 > the time I'm either home or very close by.  Still, it can happen when
35 > I'm not here.  I already wonder if upsmon will kick in correctly and
36 > do a proper shutdown.  After all, it has never had to before.  I'm
37 > running on faith that it will.  I hope I'm right. 
38 >
39 > Thoughts?  Default will take care of things?  I need to take steps to
40 > be sure in case I'm not here?  Personal experience?  A good theory?
41 > ;-)
42
43 Yes, /etc/init.d/mount-ro will take care of that. It first calls `sync`
44 and then calls `umount -r` on everything. It's set up to ruin on
45 shutdown by default. I'm sure systemd does something similar.
46
47 I don't think `cryptsetup luksClose` is necessary on shutdown, since it
48 only sets up the mapping(?).
49
50 Kind regards, tastytea

Replies

Subject Author
Re: [gentoo-user] Encrypted hard drives on LVM and urgent power shutdowns. Dale <rdalek1967@×××××.com>