Skip to content

[GUIDE] Converting root -> LVM on Ubuntu 20.04 Setup #41

Description

@ossie-git

This project hasn't been updated in years but I was able to get it working on Ubuntu 20.04. Here is what I did to get it working on a Ubuntu 20.04 host using an Ubuntu 20.04 Live CD to actually run blocks. I ran it successfully both in a VM environment (I did this to test before actually running it on my real environment) and on my desktop machine

Steps

On Your Host

perform the following steps:

make s

  • ure that filesystems are accessed via UUIDs in /etc/fstab (this is the default)
  • then run:
    $ sudo apt install lvm2
  • make sure that lvm.mod exists under your /boot partition
  • reboot into your LiveCD

In Your LiveCD

I was able to get this up and running on an Ubuntu 20.04 LiveCD by doing the following:

# sudo -i
## copy over an /etc/apt/sources.list and overwrite your current /etc/apt/sources.list using it. For example, you can use this: https://gist.github.com/ishad0w/788555191c7037e249a439542c53e170
# apt update
# apt install python3.8 python3-pip git libparted-dev libaugeas0 pkg-config libpython3.8-dev gcc cryptsetup lvm2 liblzo2-dev nilfs-tools reiserfsprogs xfsprogs e2fsprogs vim
# git clone https://github.com/g2p/blocks
# cd blocks
# pip3 install -r requirements.txt

You now have to make a small modification to main.py so you don't run into this issue: #8

vim /home/ubuntu/blocks/src/blocks/blocks/__main__.py

search for:

exit_stack.callback(lambda: quiet_call(cmd))

add this line BEFORE IT:

time.sleep(5)

now you can simply point it to your partition and reboot once it is done:

# blocks to-lvm /dev/vda3
The filesystem (ext4) leaves enough room, no need to shrink it
Copying 4194304 bytes from pos 0 to pos 134872039424... ok
Preparing LVM metadata... ok
If the next stage is interrupted, it can be reverted with:
    dd if=/dev/vda3 of=/dev/vda3 bs=4194304 count=1 skip=32156 conv=notrunc
Installing LVM metadata... ok
LVM conversion successful!
Volume group name: vg.vda3
Logical volume name: vda3
Filesystem uuid: 96c8179b-a4af-478d-ba6a-99908128f18e

now reboot your system and you should be good to go. I successfully ran this in both a VM (to test it out first) + my desktop installation

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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