You can remove a logical volume (due to storage restructuring or hard disk failure). You can use the pvmove tool to similar effect, which clears a physical volume prior to removal. (Using pvmove requires the dm-mirror kernel module to be loaded first.) This is the step-by-step approach however.

  1. Remove the logical volume from the volume group using the lvremove command:

root@george:/home/ubuntu# lvscan
  ACTIVE            '/dev/vol_grp_1/log_vol_1' [[279.48|GB]] inherit
  ACTIVE            '/dev/vol_grp_1/var' [[10.00|GB]] inherit
  ACTIVE            '/dev/vol_grp_1/usr' [[10.00|GB]] inherit
  ACTIVE            '/dev/vol_grp_1/home' [[43.29|GB]] inherit
root@george:/home/ubuntu# lvremove vol_grp_1/var
Do you really want to remove active logical volume "var"? [y/n]: y
  Logical volume "var" successfully removed
root@george:/home/ubuntu# lvscan
  ACTIVE            '/dev/vol_grp_1/log_vol_1' [[279.48|GB]] inherit
  ACTIVE            '/dev/vol_grp_1/usr' [[10.00|GB]] inherit
  ACTIVE            '/dev/vol_grp_1/home' [[43.29|GB]] inherit
  1. Repeat to remove any other logical volumes that are using that volume group.
  2. You can alternatively resize existing logical volumes using lvreduce:

# lvreduce -L 279G /dev/data/media
  1. Reduce the volume group to exclude unused devices using the vgreduce command. Devices still in use will not be altered or removed:

root@george:/home/ubuntu# vgreduce -v --all vol_grp_1
    Finding volume group "vol_grp_1"
    Using all physical volume(s) in volume group
  Physical volume "/dev/sda" still in use
    Archiving volume group "vol_grp_1" metadata.
    Removing "/dev/hde3" from volume group "vol_grp_1"
    Creating volume group backup "/etc/lvm/backup/vol_grp_1"
  Removed "/dev/hde3" from volume group "vol_grp_1"
  1. pvscan will still list the device until it has been physically removed from the system, as it is still initialised for LVM usage. However, it will show that it is not in use by any volume group:

root@george:/home/ubuntu# pvscan
  /dev/hdd: open failed: Input/output error
  PV /dev/sda    VG vol_grp_1   lvm2 [[279.48|GB / 0    free]]
  PV /dev/hde3                  lvm2 [[63.29|GB]]
  Total: 2 [[342.77|GB]] / in use: 1 [[279.48|GB]] / in no VG: 1 [[63.29|GB]]
  1. Alternatively, remove the LVM info from the PV using the pvremove command:

pvmremove /dev/hde3

LogicalVolumeManagement/RemovingDisks (last edited 2010-09-14 19:26:06 by AdamTrickett)