I’m trying to put GRUB on a Logical Volume of LVM.
My scenario with VirtualBox is like this
I created 3 HDD: /dev/sda
(10GB), /dev/sdb
(5GB), /dev/sdc
(3GB). The total size ~18GB.
I booted with NixOS 20.03 Live CD. I used the following commands to create 3 logical volumes: /dev/data/boot
, /dev/data/root
, /dev/data/swap
# Create 3 physical volumes
sudo pvcreate /dev/sda1 /dev/sdb1 /dev/sdc1
# Join all 3 into 1 big volume group named 'data'
sudo vgcreate data /dev/sda1 /dev/sdb1 /dev/sdc1
# Create 3 logical volumes
sudo lvcreate -n boot -L 500M data
sudo lvcreate -n root -L 16G data
sudo lvcreate -n swap -l 100%FREE data
Then, I set filesystem for each of them and mount
sudo mkfs.fat /dev/data/boot
sudo mkfs.ext4 /dev/data/root
sudo mkswap /dev/data/swap
sudo mount /dev/data/root /mnt
sudo mkdir /mnt/boot
sudo mount /dev/data/boot /mnt/boot
sudo swapon /dev/data/swap
I put configuration.nix
into /mnt
with
sudo nixos-generate-config --root /mnt
I set the following value in the file
boot.loader.grub.device = "/dev/data/root"
Then I installed the OS with sudo nixos-install
However, I got the following error
I saw this guy [Nix-dev] grub2, and booting from lvm/raid who reported that he successfully implements this scenario.
Could you please point out where I did wrong?