Hi.
After getting enough courage from responses on this mailing list [1], I've
decided to migrate my system to hammer2 on dm_target_crypt(4)ed volume.
Basically, I've been following "Manual Crypto Installation" guide [2],
just making newfs_hammer2 instead of newfs_hammer. But there was a problem
when mounting the filesystem. Instead of...
mount /dev/mapper/root /mnt
... which gave me "Invalid argument" error, I had to...
mount /dev/mapper/root@ROOT /mnt
Then I've placed the system there, modified loader.conf(5) to include...
vfs.root.realroot="crypt:hammer2:/dev/serno/<serial-of-disk>.s1d:root"
... and rebooted the machine, but initrd failed to mount rootfs. Looking at
the content of initrd, I've found out that /etc/rcmount_crypt is trying to
do the right thing (ie. to mount hammer2 rootfs) but the same wrong way
(ie. with missing "@ROOT" suffix). So I've modified the script (see
attachment) and regenerated initrd. The system is now booting fine,
properly mounting hammer2 rootfs from a crypted partition.
The question is... Does hammer2 really require "@" suffix to be mounted,
even for the root of the filesystem? Or have I created my hammer2
filesystem some wrong way? If it's by design and "@" is required,
then /etc/rcmount_crypt from initrd is probably missing that bit... Is
my modification of the script sufficiently generic to be pushed to master?
Thank you.
--
Daniel
[1] http://lists.dragonflybsd.org/pipermail/users/2018-December/358019.html
[2] http://www.dragonflybsd.org/docs/handbook/Installation/#index5h1
diff --git a/initrd/etc/rcmount_crypt b/initrd/etc/rcmount_crypt
index 4454fc341..d4f2a0b37 100644
--- a/initrd/etc/rcmount_crypt
+++ b/initrd/etc/rcmount_crypt
@@ -5,6 +5,8 @@ MOUNTFROM="/dev/${3#/dev/}"
VOLUME=$4
OPTIONS=$5
+[ "$FSTYPE" = "hammer2" ] && ROOT="@ROOT" || ROOT=""
+
cryptsetup isLuks $MOUNTFROM || return 1
cryptsetup $OPTIONS luksOpen $MOUNTFROM $VOLUME || return 2
-mount -o ro -t $FSTYPE /dev/mapper/$VOLUME $NEW_ROOT || return 3
+mount -o ro -t $FSTYPE /dev/mapper/$VOLUME$ROOT $NEW_ROOT || return 3