Changing lvm boot disks

NethServer Version: 7.9.2009
Module: LVM

Hello,

I am using NethServer in a VM. Host is TrueNAS Core, running FreeBSD 12 version as main OS and bhyve as the virtualization application.

I got a problem of high cpu use and interrupt errors short period after boot with NethServer (and only with NethServer out of 3 virtual different servers) after a minor main OS upgrade. I’m suggested to switch my disk and network controllers from legacy/AHCI to VirtIO for NethServer VM which is supposed to be a better controller type I presume.

Network controllers switch didn’t cause too much of a trouble. I just needed to setup my networking and all good to go.

Problem is, disk controller. I couldn’t make NethServer boot after switching from AHCI to VirtIO. I have a lot of settings in place and do not like to install NethServer from scratch.

Somebody suggested me to change /dev/sda* definitions to /dev/vda* and I should be good.

It turned out not so easy as I couldn’t find any /dev/sda in my /etc/fstab file. None in /boot/efi/EFI directory structure. I’m told to look for devices.map file which does not exists in my system and grub.cfg file where no /dev/sda exists in it.

It turned out that I installed NethServer on a LVM which I have almost no knowledge of.

Now, if I switch disk controller type, system boot fails and some rescue shell opens up.

When I revert disk controller back to AHCI system boots again.

My internet searches didn’t help me much as people mostly seems adding new disks in lvm and not doing what I’m trying. Some similar situation is explained for VMware, that information didn’t work for me.

I tried to add another disk with VirtIO controller type. Boot up. Build initram to include new driver. Remove second disk, switched to VirtIO and that didn’t help, too. NethServer booted up to rescue shell again.

I wonder if there is a way to make that controller switch without need to install everything from scratch.

Thanks & Regards,
Ertan

Can you identify which rescue-shell?
Or more generic: how far does it boot?

EFI-shell ? most likely it does not find grub2
grub-shell ? most likely it does not find the kernel
dracut-shell ? most likely it does not find the root file system
systemd-shell ? most likely a issue with fstab and/or permissions…

It is dracut shell. Below is a screen capture from what is displayed on console.

I am told that controller change will change disk devices from /dev/sda* to /dev/vda*
I have to do that change in the system somewhere that I do not know.

Thanks.

You are probaly right, and do not know where to do this on a uefi/grub2 system…

To be sure this is the curl pit you should be able to browse the ls /dev directory in the dracut shell and find the device names and id’s of the blockdevices.

Is this of any help:

in short, does control exist (in dracut shell) ls /dev/mapper

Hi @ertank,

Tried to replicate our issue to a certain extend… do not use xxx-BSD so can not really do it, changed from VirtIO SCSI to VMware PVSCSI and back again in Proxmox.

This worked for me after yum install dracut-config-generic and recreating the initramfs.

kernelrelease=$(uname -r)
dracut -f /boot/initramfs-$kernelrelease.img $kernelrelease

dracut-config-generic basically inflates the initramfs by including all commonly used I/O drivers in it.
Not sure if this resolves your issue because you already rebuild it with the VirtIO device added to the machine. (If it helps don’t forget to remove dracut-config-generic afterwards to slim it down again )

In general the sda vs vda should not matter with LVM… lvm lvscan looks at all lvm partitions and tries to make sense of that, (ie rebuild the map).

Hello @mark_nl,

I did eliminate most of my main problems. I was just waiting for an empty time to read and test your first post. Before that, you provided some more feedback.

I did try to run dracut -f without luck. I did not try to install and package though. That would be my first test to do.

Thank you very much for your follow up.

I will get back with my results.

Regards,
Ertan

Just to clarify, did you first install yum package, run initramfs and only after that switch disk controller type in VM?

Yes, again not sure this is your issue.

Here clearly the PVSCSI driver was missing with the result it drop in the dracut shell. Did not have the hard-drive in the shell ls /dev/disk-by-id was empty…

I just tested this on a clone VM and it runs just fine.

My assumption was wrong to build initramfs after switching controller type. System did not load VirtIO driver for that reason.

Missing piece of the puzzle was to install generic initramfs package.

What I did is to run commands in solution marked post with existing AHCI disk controller then shutdown the system. Switch to VirtIO disk controller. Boot system.

Since system will be booting with generic initramfs, it boots OK. Once system is up and running, I erased installed generic package and run same commands on solution marked post, again. Since that is advised to shrink initramfs (and probably its memory footprint).

Thanks again for all the help.

Regards,
Ertan

1 Like