The officially official Devuan Forum!

You are not logged in.

#1 2022-07-24 20:11:33

nahkhiirmees
Member
Registered: 2022-07-24
Posts: 261  

[SOLVED] moving /-partition to LVM after installation (Devuan 4)

Years ago, when i was still using Debian, it was possible to install in a way that the /-partition was a logical volume under a volume group.
Lately i switched to Devuan and refractainstaller does not offer that "root on LVM"-option.

So i used a normal partition for / and later moved /home to a volume group that i made after the install.
And then i tried a) to copy contents of /-partition to another logical volume and b) make the boot process use logical volume as root partition(several times).
Part a) was easy:vgchange -a y+lvcreate+mkfs.ext4+cp -a .
But part b) was not. I wonder if it is possible?

In the /boot/grub/grub.cfg there is line "vmlinuz root=/dev/myvg/newroot".
I know that i have to do something to initrd so that it sets up VG myvg before trying to mount the new root partition (/dev/myvg/newroot).
I think initrd is aware of lvm and it sets up myvg for swap and home. But how do i say that "activate myvg earlier, before mounting /" ?

Commands "update-initramfs -u" and "update-grub" haven't done what i wished. The new root mounted or not. Chrooting to new root part and giving the command from there has been done also. Still the new initrd cannot find /dev/myvg/newroot.
If i have to guess, i should edit  /etc/initramfs-tools/initramfs.conf or  /etc/initramfs-tools/update-initramfs.conf or write a script under those subdirectories.
But what kind of options or scripts?

Or is it easier to just re-install and try some kind of trick before refractainstaller installs GRUB?
Right now i'm not using that computer but i can provide the error messages and stuff later,

Offline

#2 2022-07-24 20:27:29

rolfie
Member
Registered: 2017-11-25
Posts: 1,173  

Re: [SOLVED] moving /-partition to LVM after installation (Devuan 4)

Use the normal net-installer, not the live media for installation. Then you have the option of creating an LVM. I do this all the time for my encrypted installations.

Last edited by rolfie (2022-07-24 20:28:50)

Online

#3 2022-07-25 11:15:59

nahkhiirmees
Member
Registered: 2022-07-24
Posts: 261  

Re: [SOLVED] moving /-partition to LVM after installation (Devuan 4)

Re-install seems to be the easy way out of this situation.
But it could also be very useful to know how to alter initrd in a way that enables it to mount root partition that lives on a volume group.
Last night i was too tired to figure out the right search term for Google.

Offline

#4 2022-07-25 11:22:43

nahkhiirmees
Member
Registered: 2022-07-24
Posts: 261  

Re: [SOLVED] moving /-partition to LVM after installation (Devuan 4)

I also ran into some problems while trying to provide the error messages and screenshots. The computer, where i tried this thing mentioned earlier it this topic, is an old laptop and there seems to be some kind of hardware problem which prevents me from entering the right passwords/passphrases. If i'm lucky its just the keyboard that is broken.

Maybe i can try to reproduce the situation in my desktop, with a virtual machine.

Offline

#5 2022-07-25 16:10:02

nahkhiirmees
Member
Registered: 2022-07-24
Posts: 261  

Re: [SOLVED] moving /-partition to LVM after installation (Devuan 4)

Of course i got some things mixed up last night.
The initrd that works, is aware of luks, not volume groups. It asks for passphrase, so after i give it, activating VG myvg should be possible.
So the problem is:how to modify initrd so that it activates myvg?

Ok, this question does not concern installation so much after message #2. Moderators can transfer it to another area.

Last edited by nahkhiirmees (2022-07-25 16:14:22)

Offline

#6 2022-07-25 16:18:59

nahkhiirmees
Member
Registered: 2022-07-24
Posts: 261  

Re: [SOLVED] moving /-partition to LVM after installation (Devuan 4)

nahkhiirmees wrote:

If i have to guess, i should edit  /etc/initramfs-tools/initramfs.conf or  /etc/initramfs-tools/update-initramfs.conf or write a script under those subdirectories.
But what kind of options or scripts?

https://askubuntu.com/questions/551446/ … -initramfs
https://ogris.de/initramfs.lvm/
maybe something like these are what i'm looking for.

Offline

#7 2022-07-25 23:01:17

ralph.ronnquist
Administrator
From: Battery Point, Tasmania, AUS
Registered: 2016-11-30
Posts: 1,254  

Re: [SOLVED] moving /-partition to LVM after installation (Devuan 4)

Afaik, when you installed lvm2 it should have added itself to initrd. Though my conjecture from your other notes is that you have the lvm2 software installed some other way. Perhaps a package reinstallation would be an option?

Offline

#8 2022-07-26 13:01:47

Marjorie
Member
From: Teignmouth, UK
Registered: 2019-06-09
Posts: 221  

Re: [SOLVED] moving /-partition to LVM after installation (Devuan 4)

Just checking.

Can you post the code for your
/etc/fstab,
the primary menuentry from /etc/boot/grub/grub.cfg
the results of sudo blkid
and the results of sudo fdisk -l?

I'm wondering whether with your copying root partition contents around the UUID have got misaligned or you are using the wrong /dev/ (LVM vols. are usually on /dev/mapper/)

Last edited by Marjorie (2022-07-26 13:29:30)

Offline

#9 2022-07-27 15:33:24

nahkhiirmees
Member
Registered: 2022-07-24
Posts: 261  

Re: [SOLVED] moving /-partition to LVM after installation (Devuan 4)

nahkhiirmees wrote:

I also ran into some problems while trying to provide the error messages and screenshots. The computer, where i tried this thing mentioned earlier it this topic, is an old laptop and there seems to be some kind of hardware problem which prevents me from entering the right passwords/passphrases. If i'm lucky its just the keyboard that is broken.

Maybe i can try to reproduce the situation in my desktop, with a virtual machine.

I thought that it would be easier to reproduce the situation(and take screenshots) in a virtual machine. Not necessarily. Either the installation disk(devuan chimaera live desktop) is scratched or there's a bug in VirtualBox. Managed to take some screenshots from the installation phase but how can i upload those? Or is there any website where i can upload pics without registering?

After installation phase things got complicated. Managed to change /boot partition from non-encrypted to encrypted(tar -c+umount /boot+cryptsetup luksFormat --type luks1+cryptsetup luksOpen+mke2fs+mount+tar -x+nano /etc/default/grub+update-grub+update-initramfs -u). And the virtual machine even booted after that.

Then i remembered, unfortunately,  that i have to re-partition for that encrypted lvm partition. So install again from scratch into pre-existing vhd ... and then there were some previous entries in GRUB menu, none of the entries worked,  new or old. So destroy the vm and create a new one  -> after the installation was done i got into GRUB menu , but after booting the default entry there were complaints about mdadm. Didn't get a chance to give passphrase for / partition. Next try to install and the vm didn't manage to get into GRUB phase.

Enough fighting for one day.

It is propably pointless to use luks on an old laptop which does not even have a working keyboard anymore.

Last edited by nahkhiirmees (2022-07-27 16:21:26)

Offline

#10 2022-07-27 16:01:33

nahkhiirmees
Member
Registered: 2022-07-24
Posts: 261  

Re: [SOLVED] moving /-partition to LVM after installation (Devuan 4)

Marjorie wrote:

Just checking.

Can you post the code for your
/etc/fstab,
the primary menuentry from /etc/boot/grub/grub.cfg
the results of sudo blkid
and the results of sudo fdisk -l?

I'm wondering whether with your copying root partition contents around the UUID have got misaligned or you are using the wrong /dev/ (LVM vols. are usually on /dev/mapper/)

During last weekend i tried more than once, to copy the contents of / to a logical volume(with cp -a , one directory at a time). And update initrd and GRUB menu. It is possible that something went wrong while copying or there were wrong UUIDs in grub.cfg for a while.  But that's not the whole story. I noticed that new entries for new root were wrong in a sense that there weren't any lines for loading luks drivers. (Forgot to mention in 1st message that / partition and PV were "inside" luks.)

I suspect that initrd/initramfs doesn't activate LVM for some reason. Since i could make PV and VG and LVs after installation, the lvm2 package should be ok.

Offline

#11 2022-07-27 19:40:39

fsmithred
Administrator
Registered: 2016-11-25
Posts: 2,486  

Re: [SOLVED] moving /-partition to LVM after installation (Devuan 4)

I've used refractainstaller to install to lvm. You have to use the cli version of the installer, not the gui. And you have to do a lot of the work manually, which you seem to be doing anyway. Maybe something in my Howto will help you.
https://dev1galaxy.org/viewtopic.php?id=2323

One important change. The howto says that your logical volume names should end in a digit. I fixed the installer so that is no longer true. You can use all alpha characters in your /dev/mapper/names.

Offline

#12 2022-07-28 16:01:46

nahkhiirmees
Member
Registered: 2022-07-24
Posts: 261  

Re: [SOLVED] moving /-partition to LVM after installation (Devuan 4)

Maybe that "?id=2323"-link was the "trick" i was looking for last sunday.
I'll have to try those "askubuntu.com" and "ogris.de"- links also. Managed to change the passphrases for partitions by using livecd.

Offline

#13 2023-10-28 17:34:09

nahkhiirmees
Member
Registered: 2022-07-24
Posts: 261  

Re: [SOLVED] moving /-partition to LVM after installation (Devuan 4)

Note to myself, over a year later:in chroot environment mkinitramfs is a better idea than update-initramfs.

Offline

#14 2023-10-29 15:11:48

nahkhiirmees
Member
Registered: 2022-07-24
Posts: 261  

Re: [SOLVED] moving /-partition to LVM after installation (Devuan 4)

I shouldn't have marked this as solved. The problem with initrd still remains. With my new laptop the automagic of mkinitramfs didn't do it's job properly for some reason. I have to learn the hard way to do things with initrd.
This time no root on lvm but still.

Last edited by nahkhiirmees (2023-10-29 15:14:55)

Offline

Board footer