0

We did the following:

  1. Added a volume (500G) to the volume group
  2. Extended the logical volume on the volume group

We did not extend the filesystem on the logical volume.

Then we decided, that it is not a good idea.

Now we want to safely remove the volume again.

The plan:

  1. lvreduce the logical volume exactly to the file system
  2. vgreduce

Questions:

  1. How to exactly find out the size of the file system?
  2. Does LVM automatically detect, that the space provided by the new phyiscal volume is no longer used and allows unplugging of the volume?

2 Answers 2

0

First of all, make sure you have backups.

Hardest part is determining the exact size of your old filesystem. Either you have and can use the --resizefs option to lvreduce/lvresize in which case you can use lvreduce safely, or else reduce the filesystem first to something less than what you will give to lvreduce. That's assuming the FS isn't already full! dumpe2fs -h $FSMOUNTPOINT | grep '^Block ' will give a block count and size, but I wouldn't rely on it. resize2fs will however accept a target size, that you can then give to lvreduce.

After you have reduced your lv to something that will fit on the disks you want to keep, pvs will tell you if your volume is used. If it is, use pvmove $BADDEVICE $KEEPDEVICE to make it unused, and then you can use vgreduce $VG $BADDEVICE to remove the device from the VG.

0
0

Debian seems to create backups of the vg configuration at /etc/lvm/archive - it should be possible to use such an old config.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .