On 2022-09-11 20:56-0500 Dale <[email protected]> wrote: > Howdy, > > Last night we had some bad weather where I live and we ended up with > some power problems. Ironically they went out a few hours after the > storm was gone. Anyway. I had all sorts of encrypted drives open. > My usual drives inside my puter plus the large 14TB external backup > drive that is still copying files over. Glad my UPS held up while I > closed all those drives and did a proper shutdown. Doing all that > tho, it made me think about if I wasn't here to do all that. Being > Linux, I'd suspect that upsmon would tell the puter to do a proper > shutdown which includes unmounting the file system, closing the > encrypted drives, like I do with cryptsetup close <name> etc and then > shutting down. However, one has to ask, is it set up to do so by > default? I manage the encrypted drives manually. I don't use the > crypt services for that like people do when all of the system > drive(s) is encrypted or when just /home is encrypted. My encrypted > stuff is mounted within /home or for the external backups, in /mnt. > Thing is, some aren't open unless I'm using them or are external. > Since I do it manually, is there a tool that sees they need > unmounting and closing and does it or do I need to do something to > make sure it is done before a shutdown? > > I suspect this would happen on its own but I'd like to make sure. I'd > hate to mess up the file system badly on any of my drives or in a > worst case scenario, brick a hard drive with some 1 in a million > chance problem. > > I thought about having a drive connected, open and mounted that I > don't really need and just do a shutdown, see what happens. Then > again, why not ask and see if anyone else has had this happen and if > things turned out OK or if there was problems. I'm lucky, most of > the time I'm either home or very close by. Still, it can happen when > I'm not here. I already wonder if upsmon will kick in correctly and > do a proper shutdown. After all, it has never had to before. I'm > running on faith that it will. I hope I'm right. > > Thoughts? Default will take care of things? I need to take steps to > be sure in case I'm not here? Personal experience? A good theory? > ;-)
Yes, /etc/init.d/mount-ro will take care of that. It first calls `sync` and then calls `umount -r` on everything. It's set up to ruin on shutdown by default. I'm sure systemd does something similar. I don't think `cryptsetup luksClose` is necessary on shutdown, since it only sets up the mapping(?). Kind regards, tastytea

