Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Proper order of unmount for zfs partition / dmcrypt
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
uint
n00b
n00b


Joined: 02 Dec 2024
Posts: 2

PostPosted: Wed Dec 18, 2024 7:35 am    Post subject: Proper order of unmount for zfs partition / dmcrypt Reply with quote

Hi! I have a setup with two disk partitions encrypted with dmcrypt (LUKS), and over them there's a zfs mirrored pool. I also have OpenRC.

At the system boot, the startup order is correct: first I get prompted for the passphrases of the encrypted partitions, then dmcrypt unlocks them, then zfs imports the pool and mounts the partition to the file system.

However, at shutdown it seems that zfs does not unmount its partition, either in time, or at all. This leads to the shutdown log having dmcrypt complaining that encrypted devices cannot be unmounted (as they are busy). I don't have the log at hand, as this normally happens after the syslog-ng shutdown.

This does not seem to do much harm, but still looks messy, and I'd like to set up the correct shutdown order, where:
- zfs partition is unmounted from the fs
- zfs stops the pool (however it calls this operation)
- dmcrypt stops the underlying encrypted partitions

But I'm not sure how to do that, and specifically what controls the order in which OpenRC stops services.
I tried to set
Code:

rc_need="dmcrypt"
ZFS_UNMOUNT='yes'

in the /etc/conf.d/zfs, and indeed zfs tries to unmount the pool, but looks like it fails because it tries to unmount the pool before the mount point in the file system itself is unmounted. Or something like that happens - I am not 100% sure, and cannot check the logs as there are no logs (only terminal output at shutdown)

Can you suggest the proper way to control the unmount order here?
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22837

PostPosted: Wed Dec 18, 2024 12:24 pm    Post subject: Reply with quote

Welcome to the forums.

Could you provide a bit more information about the environment? Specifically, is the affected ZFS for critical filesystems like /, for non-critical filesystems like /home, or both? Is the passphrase prompt at boot handled by the initramfs or by the Gentoo dmcrypt initscript? Can you show us /etc/fstab and the output of grep '^[^#]' /etc/conf.d/dmcrypt (non-blank non-comment lines, since there are a lot of stock comments we don't need here)? Mask out any serial numbers or similar if you like. I only want to see how many devices are in use, and their device-mapper names once unlocked.
Back to top
View user's profile Send private message
uint
n00b
n00b


Joined: 02 Dec 2024
Posts: 2

PostPosted: Wed Dec 18, 2024 2:32 pm    Post subject: Reply with quote

Thank you! ZFS is used for /home and some other non-critical data, so not / . Passphrase is handled by the dmcrypt initscript, not initramfs.
/etc/fstab does not mention the ZFS partition (or underlying partitions) at all - it is mounted by the zfs initscripts. Would you still need it? It has some generic partitions like / , /boot , etc.

/etc/conf.d/dmcrypt is like this:
Code:

dmcrypt_key_timeout=1
dmcrypt_retries=5
target=data-vol1
source='/dev/disk/by-id/wwn-0x5002538f3430a793-part5'
target=data-vol2
source='/dev/disk/by-id/wwn-0x500a0751e6e1d210-part1'
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum