You are not logged in.

#1 2023-07-02 10:55:04

dalu
Member
Registered: 2014-04-16
Posts: 79

[s] lvm: removing a ssd from a vg/lv

I did something stupid. The older I get, the more often that happens wink

Anyhow.
I had a rootfs on a plain partition on /dev/sdb (128GB)
I created a pv and vg and lv on /dev/sda (256GB)

# pvs
  PV         VG      Fmt  Attr PSize    PFree 
  /dev/sda3  vgroot  lvm2 a--  <237.85g     0 
  /dev/sdb1  vgroot  lvm2 a--  <119.24g  6.55g
  /dev/sde1  vgraid0 lvm2 a--   931.51g 46.57g
  /dev/sdf1  vgraid0 lvm2 a--   931.51g 46.57g

# vgs
  VG      #PV #LV #SN Attr   VSize    VFree  
  vgraid0   2   1   0 wz--n-   <1.82t <93.15g
  vgroot    2   1   0 wz--n- <357.09g   6.55g

Since I was able to boot from a lvm rootfs, which was only present on /dev/sda3,
I thought, "why go through the hassle of physically removing the 128GB, let's just re-use it and extend the rootfs".
And so I did create a pv on /dev/sdb1 and added it to vgroot.

# lvs
  LV    VG      Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lvol0 vgraid0 -wi-ao----  <1.73t                                                    
  lvol0 vgroot  -wi-ao---- 350.53g      

/ has only ~80GB used.

Well,
Now a bought a 4070 rtx and it didn't fit.
I spent an annoying day wrestling the components from the current case to a new case, which, I thought, had more room.
Anyhow, components are in the new case, but the new case isn't silent and it's driving me nuts hearing the fans all the time.

So I did some fiddling and removed the floppy/dvd hardware on top in the old case and removed the middle with 4 SSD slots, so that now
there's only 3 SSD slots left and 2 on the side. (Fractal Design R5 if anyone is curious).
That makes 5 SSD slots and I have 6, therefore the /dev/sdb 128GB has to go, and I will spend another day of moving the components back to the old case (FML).

So I need to remove /dev/sdb1 from the lv vg and as a pv, without losing data.

One solution is to stop all unnecessary services,
create a dir on my sufficiently large nvm drive,
rsync all from the rootfs to that nvm's dir,
destroy the lv vg and pv,
format /dev/sda3 with xfs or w/e,
move it all back to /dev/sda3,
run grub-mkconfig.

Is there a simpler solution?
I tried

pvmove /dev/sdb1

I don't know if there already is any data on /dev/sdb1.
I don't know how I can find out.
I would also need to shrink the rootfs.

p.s. Never buy a Thermaltake The Tower 500, I have never seen a worse case in terms of everything, safe the old AT cases in the 90s.

Last edited by dalu (2023-07-02 13:30:20)

Offline

#2 2023-07-02 13:30:02

dalu
Member
Registered: 2014-04-16
Posts: 79

Re: [s] lvm: removing a ssd from a vg/lv

Well, I couldn't wait any longer.

I did it the way I described, only that I booted from an Ubuntu 22.04 server USB stick to do it.

If LVM is *the* solution for disk management, it still has to add convenience features, like data balancing or rather un-balancing.

Offline

Board footer

Powered by FluxBB