Let’s say you have a volume named datavg
$ pvs -o+pv_used
PV VG Fmt Attr PSize PFree Used /dev/sda2 cl lvm2 a-- <118.24g 0 <118.24g /dev/sdb datavg lvm2 a-- <223.57g 0 <223.57g /dev/sdc1 datavg lvm2 a-- <465.76g 0 <465.76g /dev/sdd1 lvm2 --- 931.51g 931.51g 0
Kami ingin mengganti disk /dev/sdb
dan /dev/sdc1
dengan disk baru /dev/sdd1
Create a physical volume on sdd1
$ pvcreate /dev/sdd1
You can now extend your Volume Group datavg
with the new disk
$ vgextend datavg /dev/sdd1
You can now start moving data
$ pvmove /dev/sdb /dev/sdd1
Wait to finish
/dev/sdb: Moved: 10.0% ... /dev/sdb: Moved: 50.0% ... /dev/sdb: Moved: 100.0%
Check
$ pvs -o+pv_used
PV VG Fmt Attr PSize PFree Used /dev/sda2 cl lvm2 a-- <118.24g 0 <118.24g /dev/sdb lvm2 --- 223.57g 223.57g 0 /dev/sdc1 datavg lvm2 a-- <465.76g 0 <465.76g /dev/sdd1 datavg lvm2 a-- <931.51g 707.94g <223.57g
Now you can remove /dev/sdb
from the datavg
group
$ vgreduce datavg /dev/sdb