logical volume management (LVM)

I use a lot of raster data in my work. I also use a lot of csv and txt data, but of the magnitude that it takes up hundreds of gigabytes. I save it in the cloud for backup, but I need it locally for faster processing. But that’s a lot of space that gets sucked up. So I have quite a number of large internal drives. I have six internal 500GB and 1TB drives. One 500GB is for my Windows boot and another 1TB is for my / (root) Linux boot. The other drives are for storage. But it’s hard to store things across so many drives. I also use Dropbox, which gets finnicky if you don’t host the folder in your /home directory. How do we fix this?

 

Logical Volume Management – or LVM – is a way to virtually combine all these drives into one logical and virtual drive which you can partition any which way you want, regardless of the underlying physical drives. It also allows you to add some RAID like properties – but we will get to that later.

 

The gist of the system is that you format your physical drives to LVM2 (this will, however, erase your drives). You can then make volume groups of which you can then create logical volumes. I could have created two volume groups, in which one I could make one logical volume and in the other three logical volumes. But for me all I wanted is to combine them all, so I put all four physical volumes into one volume group and then into one logical volume. I also specified it to be striped, somewhat similar to RAID0, meaning the data is split across the disks, allowing for faster read/write. 

 

One of my problems was that my /home directory was already established on another partition. Thus I had to copy that to the new logical volume, change the /etc/fstab configuration file to boot with the new home directory as /home, delete the old /home directory, and add that partition to the volume group and logical volume. 

 

Below I will lead you through the steps I took.


INSTALLING PACKAGES

 

ADDING PHYSICAL VOLUMES

First, scan to see if you have any LVM2 formatted physical drives. If you don’t have any, you need to add them. Thus, you will first need to identify what your disks are and what their identities are. 

ADDING VOLUME GROUPS

Whatever physical drives you have

ADDING LOGICAL VOLUMES

Volume groups

ADDING /HOME TO NEW LOGICAL VOLUME

Using rsync

#List all detached screens with ID numbers
screen -ls
#Reattach a screen with ID number
screen -r ID-NUMBER