[linux-lvm] Reduce an LVM volume split on two physical disks
chris-procter at talk21.com
Mon Mar 29 21:41:25 UTC 2010
>I have an LVM volume of 1.8TB split on two physical disk that have a 900 someting GB partition on each of them.
>I need to change the second disk, and only 396GB og the 1.8TB is used...so can I reduce the size of the LVM volume to only the first disk, change the second disk and expand after the LVM volume to the second disk?
You should be able to do this.
You'll need to reduce the size of the filesystem (using resize2fs if its ext3) so it will fit on the one disk, it will probably need to be unmounted for this bit, and its not entirely risk free so make sure you have a good backup before you start.
Then you can use lvreduce to shrink the lv down so its small enough to fit on the one disk.
vgdisplay should then show how many PE are in use on each disk, if you're lucky then the whole lv will be on the right disk already, if not then you can use pvmove to migrate all the used pe on the 2nd disk onto the first disk. This should leave the second disk completly empty (i.e. all of its pe free)
Once the lv is entirely on the disk you want to keep then you can use vgreduce to remove the unused second disk from the vg.
Then replace the disk and use vgextend to add the replaced disk into the volume group, lvextend the lv back up to the original size, and extend2fs will expand the filesystem to file the newly resized lv.
But its late so you probably want to read the appropriate man pages and check my logic before you do anything :)
More information about the linux-lvm