DEV Community

Jesse Phillips
Jesse Phillips

Posted on

Removing Physical disk from LVM

Since I've obtained new fast NVME drives, and I'm trying to manage my disk allocation with LVM I have a desire to migrate my currently Linux installation to the new drives.

I already have some LVM data spanning a couple of disks, one of which needs to be removed. Luckily for me the data I needed to move could fit within the freespace on my other disk. This results in touching a number of LVM commands and strategy.

First I needed to create space within Logical Volume so data in the other Logical Volume can fit on the disk. This includes a step of shrinking the filesystem.

Now lets move the data off the Physical Volume.

Now we tell LVM to move the Volume Group off the physical disk.

Working with LVM requires remembering the layers and ensuring the each layer gets the needed attention. There are some protections to help ensure you've taken desired steps to save your data.

One of the things I learned is that the LVM tools provide arguments to perform the Filesystem sizing for you. --resizefs added to the lvreduce or lvextend commands performs the desired operations if possible. This was nice to realize because these commands also provide the ability to resize relative to the existing size.

I'm a little surprised that asking to vgreduce does not handle the pvmove (moving data off the physical volume).

Top comments (0)