有一个服务器通过 targetcli 分发 lvm 部分,比如块磁盘。在 lvextend 的帮助下扩展,lv_pub 部分从 300 GB 增加到 350 GB。
# pvs
PV VG Fmt Attr PSize PFree
/dev/md126 centos_tgt4 lvm2 a-- 465.13g 160.00m
/dev/sda1 vg_tgt4 lvm2 a-- 16.37t 3.22t
# vgs
VG #PV #LV #SN Attr VSize VFree
centos_tgt4 1 4 0 wz--n- 465.13g 160.00m
vg_tgt4 1 5 0 wz--n- 16.37t 3.22t
# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
home centos_tgt4 -wi-ao---- 429.06g
root centos_tgt4 -wi-ao---- 9.96g
swap centos_tgt4 -wi-ao---- 15.96g
var centos_tgt4 -wi-ao---- 10.00g
lv_cub vg_tgt4 -wi-ao---- 1.00t
lv_group vg_tgt4 -wi-ao---- 4.50t
lv_home vg_tgt4 -wi-ao---- 1.50t
lv_doc vg_tgt4 -wi-ao---- 5.81t
lv_pub vg_tgt4 -wi-ao---- 350.00g
#targetcli
targetcli shell version 2.1.fb41
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.
/> ls
o- / ......................................................................................................................... [...]
o- backstores .............................................................................................................. [...]
| o- block .................................................................................................. [Storage Objects: 5]
| | o- cub ................................................................... [/dev/vg_tgt4/lv_cub (1.0TiB) write-thru activated]
| | o- group ........................................................ [/dev/mapper/vg_tgt4-lv_group (4.5TiB) write-thru activated]
| | o- home .......................................................... [/dev/mapper/vg_tgt4-lv_home (1.5TiB) write-thru activated]
| | o- doc ............................................................ [/dev/mapper/vg_tgt4-lv_doc (5.8TiB) write-thru activated]
| | o- pub ................................................................. [/dev/vg_tgt4/lv_pub (350.0GiB) write-thru activated]
在客户端上看不到空间增加了:
# pvs
PV VG Fmt Attr PSize PFree
/dev/sdc vg_cub lvm2 a-- 1024.00g 24.00g
/dev/sde vg_pub lvm2 a-- 300.00g 10.00g
fdisk,看到磁盘被放大了,但是没有看到分区:
# fdisk /dev/sde
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xa81facb2.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): p
Disk /dev/sde: 375.8 GB, 375809638400 bytes
255 heads, 63 sectors/track, 45689 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 262144 bytes
Disk identifier: 0xa81facb2
Device Boot Start End Blocks Id System
Command (m for help): ^C