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).

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay