In this tutorial we want to replace /dev/sdc1 with /dev/sdd1. Read on.
1. prepare the disk for lvm:
jupiter:~# pvcreate /dev/sdd1
Physical volume "/dev/sdd1" successfully created
2. add the disk in the volume group:
jupiter:~# vgextend squidvg /dev/sdd1
Volume group "squidvg" successfully extended
jupiter:~# pvscan | grep squidvg
PV /dev/sdc1 VG squidvg lvm2 [30.00 GiB / 5.00 GiB free]
PV /dev/sdd1 VG squidvg lvm2 [30.00 GiB / 30.00 GiB free]
3. Now we need to move the data from one disk to another and we can do with
pvmovecommand.
jupiter:~# lvscan | grep squidvg
ACTIVE '/dev/squidvg/cache' [25.00 GiB] inherit
jupiter:~# pvmove -n cache /dev/sdc1 /dev/sdd1
/dev/sdc1: Moved: 0.0%
/dev/sdc1: Moved: 2.3%
/dev/sdc1: Moved: 3.8%
/dev/sdc1: Moved: 5.3%
[..cut useless output..]
/dev/sdc1: Moved: 98.0%
/dev/sdc1: Moved: 98.9%
/dev/sdc1: Moved: 100.0%
jupiter:~# pvscan | grep squidvg
PV /dev/sdc1 VG squidvg lvm2 [30.00 GiB / 30.00 GiB free]
PV /dev/sdd1 VG squidvg lvm2 [30.00 GiB / 5.00 GiB free]
4. Remove the disk from volume group and lvm:
jupiter:~# vgreduce squidvg /dev/sdc1
Removed "/dev/sdc1" from volume group "squidvg"
jupiter:~# pvremove /dev/sdc1
Labels on physical volume "/dev/sdc1" successfully wiped
And that is it!
- Log in to post comments
- 20718 views