Skip to content

[GUIDE] Converting root -> LVM on Ubuntu 24.04 liveCD #44

@amedranogil

Description

@amedranogil

Converting root -> LVM on Ubuntu 24.04.3 Setup

Using the Ubuntu 24.04.3 Live CD to run blocks.

On Your Host

perform the following steps:

  1. Ensure you got everything backed up / snapshot
  2. make sure that filesystems are accessed via UUIDs in /etc/fstab (this is the default)
  3. run: sudo apt install lvm2
  4. make sure that lvm.mod exists under your /boot partition
  5. reboot into your LiveCD

On LiveCD

Open a browser so you can easily copy the following code.
open a terminal and run everything as root:

sudo -i

Patch and install blocks:

apt update
apt install python3 python3-pip git libparted-dev libaugeas0 pkg-config gcc cryptsetup lvm2 liblzo2-dev nilfs-tools reiserfsprogs xfsprogs e2fsprogs
git clone https://github.com/g2p/blocks.git
cd blocks
cat << EOF | git apply

diff --git a/blocks/__main__.py b/blocks/__main__.py
index 5248d77..52f1bec 100644
--- a/blocks/__main__.py
+++ b/blocks/__main__.py
@@ -151,6 +151,7 @@ def mk_dm(devname, table, readonly, exit_stack):
     cmd = 'dmsetup remove --noudevsync --'.split() + [devname]
     if needs_udev_fallback:
     cmd[3:3] = ['--verifyudev']
+    time.sleep(5)
     exit_stack.callback(lambda: quiet_call(cmd))


diff --git a/requirements.txt b/requirements.txt
index 41682e2..ea2e9e7 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,4 @@
-e git+https://github.com/g2p/blocks.git@master#egg=blocks
-e git+https://github.com/g2p/python-augeas.git@v0.4.2a1#egg=python-augeas
-https://github.com/g2p/pyparted/archive/pyparted-3.10a1.tar.gz#egg=pyparted
+pyparted==3.13.0
 
EOF
pip3 install --break-system-packages -r requirements.txt

run blocks (assuming your target patition to convert is /dev/sda1) :

blocks to-lvm /dev/sda1

if you already configured extra disk now you can add and extend the LVM:

pvcreate /dev/sdb
vgextend vg.sda1 /dev/sdb
lvextend -r -l +100%FREE /dev/vg.sda1/sda1

if you want to rename volume group and logical volume:

vgrename vg.sda1 vg.main
lvrename /dev/vg.main/sda1 /dev/vg.main/root

reinstall grub with boot-repair (this will take care of previous steps 2,3&4 on host):

sudo apt install software-properties-common; \
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe"; \
sudo add-apt-repository -y ppa:yannubuntu/boot-repair; \
sudo apt-get update; \
sudo apt-get install -y boot-repair && boot-repair

EDIT: typos.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions