ZFS Mounting ZFS Block device || Resetting VM password

Hello everyone,

I am using FreeBSD as a host system and as a guest inside a bhyve-VM. Unfortunately I do no longer have access to the root password of the guest. (Wrote it on a piece of paper and left it in a different country. Due to Corona I cannot go there atm.) The virtual machine is based on the freebsd-zvol.conf template so I use one of these 'sparse-zvols's. Mounting it directly does not seems to work. Neither does mounting via the /dev/zvol/.../disk0.
My plan is to mount the device in /mnt and then chroot into it to change the password.
I also tried setting the volmode to geom (default is dev) but it doesnt seem to change much.

Does anyone have an idea on how to approach this?
 
Thank you for your reply.

In case someone else finds this thread in the future: Put loader_timeout="20" into your virtual machine's conf file.
 
Sorry for waking up an old thread, but I have a similar problem where I need to access files in filesystems contained in zvols, so I thought expanding this thread would be better than creating a new one.

I have autoboot_delay=-1 set in /boot/loader.conf which seems to prevent me from making any choices during boot. I could probably attach the zvols as secondary disks to a operational VM, but it has to be an easier way where I could just mount them in the host. Any suggestions?

One of the zvols:

Code:
# fdisk /dev/zvol/system/vm/log/disk0
******* Working on device /dev/zvol/system/vm/log/disk0 *******
parameters extracted from in-core disklabel are:
cylinders=1305 heads=255 sectors/track=63 (16065 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=1305 heads=255 sectors/track=63 (16065 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 238 (0xee),(EFI GPT)
    start 1, size 20971519 (10239 Meg), flag 0
    beg: cyl 0/ head 0/ sector 2;
    end: cyl 1023/ head 255/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>
 
I managed to solve it. The zvols on my system (FreeBSD 13.1-RELEASE) is created using sysutils/vm-bhyve. This procedure sets volmode=dev which results in partitions being hidden from the OS. It's further explained in zfsprops(7)

Code:
     volmode=default|full|geom|dev|none
       This property specifies how volumes should be exposed to the OS.
       Setting it to full exposes volumes as fully fledged block devices,
       providing maximal functionality.  The value geom is just an alias for
       full and is kept for compatibility.  Setting it to dev hides its
       partitions.  Volumes with property set to none are not exposed outside
       ZFS, but can be snapshotted, cloned, replicated, etc, that can be
       suitable for backup purposes.  Value default means that volumes
       exposition is controlled by system-wide tunable zvol_volmode, where
       full, dev and none are encoded as 1, 2 and 3 respectively.  The default
       value is full.

If I set volmode to full I managed to mount the containing filesystems:

Code:
# zfs set volmode=full system/vm/vm1/disk0
# gpart show /dev/zvol/system/vm/vm1/disk0
=>      40  20971440  zvol/system/vm/vm1/disk0  GPT  (10G)
        40         8                            - free -  (4.0K)
        48    409600                         1  efi  (200M)
    409648  20561824                         2  freebsd-ufs  (9.8G)
  20971472         8                            - free -  (4.0K)
# mount /dev/zvol/system/vm/vm1/disk0p2
 
Back
Top