Thứ Hai, 5 tháng 12, 2016

Managing Disk Space with LVM -04

Adding A Hard Drive And Removing Another One

We haven't used /dev/sdf until now. We will now create the partition /dev/sdf1 (25GB) and add that to our fileserver volume group.
kilo:~#fdisk /dev/sdf
kilo:~# pvcreate /dev/sdf1
  Physical volume "/dev/sdf1" successfully created
Add /dev/sdf1 to our fileserver volume group:
kilo:~#:vgextend fileserver /dev/sdf1
kilo:~#:vgdisplay
That's it. /dev/sdf1 has been added to the fileserver volume group. Now let's remove /dev/sdb1. Before we do this, we must copy all data on it to /dev/sdf1
kilo:~# pvmove /dev/sdb1 /dev/sdf1
  /dev/sdb1: Moved: 1.9%
  . . .
  /dev/sdb1: Moved: 100.0%

Next we remove /dev/sdb1 from the fileserver volume group:
kilo:~# vgreduce fileserver /dev/sdb1
  Removed "/dev/sdb1" from volume group "fileserver"
kilo:~# vgdisplay
kilo:~#  pvremove /dev/sdb1 
kilo:~#  pvdisplay

You could now remove /dev/sdb from the system (if this was a real system and not a virtual machine).

Không có nhận xét nào:

Đăng nhận xét