Mounting an LVM volume on Ubuntu is very useful, this is how you may access the partitions inside an LVM volume using Ubuntu.
Install the required packages on Ubuntu.
┏jcartwright@jcartwright-System-Version╼╸╸╸╸╸╸╾ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━◉:~/Videos$ sudo apt install lvm2 [sudo] password for jcartwright: Reading package lists... Done Building dependency tree... Done Reading state information... Done The following packages were automatically installed and are no longer required: linux-headers-6.5.0-21 linux-headers-6.5.0-21-generic linux-image-6.5.0-21-generic linux-modules-6.5.0-21-generic linux-modules-extra-6.5.0-21-generic linux-modules-nvidia-535-6.5.0-21-generic linux-objects-nvidia-535-6.5.0-21-generic linux-signatures-nvidia-6.5.0-21-generic nvidia-firmware-535-535.154.05 Use 'sudo apt autoremove' to remove them. The following additional packages will be installed: dmeventd libdevmapper-event1.02.1 liblvm2cmd2.03 thin-provisioning-tools The following NEW packages will be installed: dmeventd libdevmapper-event1.02.1 liblvm2cmd2.03 lvm2 thin-provisioning-tools 0 upgraded, 5 newly installed, 0 to remove and 1 not upgraded. Need to get 2,460 kB of archives. After this operation, 8,968 kB of additional disk space will be used. Do you want to continue? [Y/n] y |
Then, run this command to scan for the LVM volumes you wish to access.
┏jcartwright@jcartwright-System-Version╼╸╸╸╸╸╸╾ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━◉:~/Videos$ sudo vgscan Found volume group "almalinux" using metadata type lvm2 |
The volume group “almalinux” has been located, and now I can activate the volume group.
┏jcartwright@jcartwright-System-Version╼╸╸╸╸╸╸╾ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━◉:~/Videos$ sudo vgchange -a y 3 logical volume(s) in volume group "almalinux" now active |
The lvscan utility will list all discovered partitions inside the volume group.
┏jcartwright@jcartwright-System-Version╼╸╸╸╸╸╸╾ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━◉:~/Videos$ sudo lvscan ACTIVE '/dev/almalinux/swap' [7.80 GiB] inherit ACTIVE '/dev/almalinux/home' [852.12 GiB] inherit ACTIVE '/dev/almalinux/root' [70.00 GiB] inherit |
The /dev/almalinux/home is the device I wish to mount.
┏jcartwright@jcartwright-System-Version╼╸╸╸╸╸╸╾ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━◉:~/Videos$ sudo mount /dev/almalinux/home /mnt/ |
Now, the partition is mounted and the files may be accessed. This is not too difficult.
┏jcartwright@jcartwright-System-Version╼╸╸╸╸╸╸╾ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━◉:~/Videos$ ls -lhua /mnt/ total 16K drwxr-xr-x. 7 root root 78 Apr 3 12:41 . drwxr-xr-x 20 root root 4.0K Apr 3 11:31 .. drwx--x---+ 45 jcartwright jcartwright 8.0K Apr 3 12:41 jcartwright drwx------. 3 1004 1004 92 Jan 31 11:39 johann drwx------. 3 1001 1001 92 Jul 17 2023 user1 drwx------. 3 1002 1002 92 Jul 17 2023 user2 drwx------. 3 1003 1003 113 Jul 17 2023 user3 |
I plugged in an old Rocky Linux SSD with a USB cable and now I can see the volume group for that as well. So this is how to mount an old LVM group on an external drive as well.
┏jcartwright@jcartwright-System-Version╼╸╸╸╸╸╸╾ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━◉:~/Videos$ sudo vgscan Found volume group "rl" using metadata type lvm2 Found volume group "almalinux" using metadata type lvm2 |