HAMMER2 - mounting root from dm_crypt

Aaron LI aly at aaronly.me
Fri Jan 18 07:02:45 PST 2019


On Fri, 18 Jan 2019 14:05:53 +0100
Daniel Bilik <ddb at neosystem.org> wrote:

> 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 at ROOT /mnt

Since the HAMMER2 FS was created with '-L ROOT', it requires '@ROOT' to be
mounted.  If no label provided, hammer2(8) will determine one for it.  For
this device (/dev/mapper/root), the '@DATA' will be used, so the mount fails.

> 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 rc scripts in the initrd(7) are simple and can be much improved (I have
to find time to finished my patches).

Another simple way to workaround your issues is use the following setting
in /boot/loader.conf:

vfs.root.realroot="crypt:hammer2:/dev/serno/<serial-of-disk>.s1d:rootd"

Note the final 'd'!


Cheers,
-- 
Aaron


More information about the Users mailing list