[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

How to remove a PV from an LVM VG?



I think that my old disk is dying and I want to get the data off of it before that happens. I just had the system drop out of X-windows and lock up completely.

The screen was blank, except for three lines at the top:

[120497,729655] nouveau 0000:01:00.0: Setting dpms mode 3 on vga encoder (output 0) [120497,749909] nouveau 0000:01:00.0: Setting dpms mode 0 on vga encoder (output 0) [120497,749915] nouveau 0000:01:00.0: Output VGA-1 is running on CRTC 0 using Output A

This is the second time that this has happened. I was not home the first time and I found it like that when I got home. I rebooted and everything seemed OK.

This time, on rebooting I was dropped into single user mode. Apparently the system had mounted my OLD / partition from the old drive instead of the new partition on the new drive (neither of these partitions are in the lvm group, they are physical partitions). I reran lilo and the correct partition is being mounted as /, but I don't trust the old disk any more. The old disk is a 40GB drive. I have previously installed a 1TB drive and have added it to the VG. I just need to make sure that I do everything in the correct order so that I don't lose my data.


The old drive is /dev/sda and there are two PVs on the disk /dev/sda3 and /dev/sda4, both are in vg1

The new drive is /dev/sdc and it has only 1 LVM PV and that is /dev/sdc4


$ sudo pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda3
  VG Name               vg1
  PV Size               17.24 GiB / not usable 1.38 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              4414
  Free PE               0
  Allocated PE          4414
  PV UUID               y0A9w2-Es63-ju5z-bSV0-JSbU-AdMj-j2U58I

  --- Physical volume ---
  PV Name               /dev/sda4
  VG Name               vg1
  PV Size               19.47 GiB / not usable 4.05 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              4984
  Free PE               0
  Allocated PE          4984
  PV UUID               hYLZpk-8lWT-Kna5-JwbV-3NpP-f3wP-zvKD63

  --- Physical volume ---
  PV Name               /dev/sdc4
  VG Name               vg1
  PV Size               928.56 GiB / not usable 1.83 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              237710
  Free PE               224910
  Allocated PE          12800
  PV UUID               N30XAD-155f-fRdA-0tch-dLU2-WMxP-z8jLCx



Is this the correct method to preserve my data:

pvmove /dev/sda3 /dev/sdc4

wait for it to finish

pvmove /dev/sda4 /dev/sdc4

once that has finished

vgreduce vg1 /dev/sda3
vgreduce vg1 /dev/sda4

pvremove /dev/sda3
pvremove /dev/sda4


I really need to know that this is the correct procedure and get this done as quickly as possible. I don't want to lose data.

Marc Shapiro


Reply to: