首先,shutdown -y0進入單使用者。然後,将磁盤c3t2d0添加到卷組vg00中:
# pvcreate /dev/rdsk/c3t2d0
# vgextend vg00 /dev/dsk/c3t2d0
接着,我試着将邏輯卷lvol5的大小擴充到1000M,但是出錯:
# lvextend -L 1000 /dev/vg00/lvol5 /dev/dsk/c3t2d0
Warning: rounding up logical volume size to extent boundary at size “1008″ MB.
lvextend: “LogicalExtentsNumber” is not bigger than current setting.
起初,我以為是磁盤容量不足造成的,但是我用diskinfo檢視,發現磁盤c3t2d0 size:8891556 Kbytes。于是,我将邏輯卷擴充大小改為500M,但是仍然出錯。
# diskinfo /dev/rdsk/c3t2d0
SCSI describe of /dev/rdsk/c3t2d0:
vendor: SEAGATE
product id: ST39204LC
type: direct access
size: 8891556 Kbytes
bytes per sector: 512
# lvextend -L 500 /dev/vg00/lvol5 /dev/dsk/c3t2d0
Warning: rounding up logical volume size to extent boundary at size “504″ MB.
lvextend: “LogicalExtentsNumber” is not bigger than current setting.
用vgdisplay -v vg00檢視了下邏輯卷lvol5的大小為1008M,這裡要注意的是:lvextend -L後面的數值大小是你的邏輯卷擴充後的大小,而不是你想在現有基礎上增加多少。
LV Name /dev/vg00/lvol5
LV Status available/syncd
LV Size (Mbytes) 1008
Current LE 63
Allocated PE 63
Used PV 1
# lvextend -L 1024 /dev/vg00/lvol5 /dev/dsk/c3t2d0
Logical volume “/dev/vg00/lvol5″ has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
LV Name /dev/vg00/lvol5
LV Status available/syncd
LV Size (Mbytes) 1024
Current LE 64
Allocated PE 64
Used PV 2
提示擴充成功,lvol5大小為1024M。另外,值得注意的是:一個邏輯卷可以跨越多個實體卷,但是不能跨越多個卷組。一個邏輯卷隻能被延伸到同一卷組的其他磁盤上。
做到這裡并沒有實作真正的擴充,因為隻擴充檔案系統所在的邏輯卷是不能達到擴充檔案系統的。那麼如何擴充檔案系統呢?
# umount /home (先umount檔案系統)
# extendfs -F vsfs /dev/vg00/lvol5 (讓檔案系統可以使用新的extends)
# mount /home
# df /home (檢視容量是否增長)