磁盘初始化
fdisk -l
Disk /dev/xvdg: 2147.5 GB, 2147483648000 bytes
255 heads, 63 sectors/track, 261083 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
可以看到新增的磁盘/dev/xvdg已经识别,大小为2T,现需对磁盘进行格式化操作
parted /dev/xvdg
[root@dzzz-db1 ~]# parted /dev/xvdg
GNU Parted 2.1
Using /dev/xvdg
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Error: /dev/xvdg: unrecognised disk label
(parted) mklabel gpt
(parted) mkpart primary 0 100%
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? Ignore
(parted) print
Model: Xen Virtual Block Device (xvd)
Disk /dev/xvdg: 2147GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 17.4kB 2147GB 2147GB primary
(parted) quit
Information: You may need to update /etc/fstab.
[root@dzzz-db1 ~]#
1、使用print
命令查看磁盘信息,提示Error: /dev/xvdg: unrecognised disk label
;
2、需使用mklabel gpt
命令,对磁盘创建分区表;
3、使用mkpart primary 0 100%
命令,出现警告输入Ignore
忽略;
4、使用print
即可查看新的分区信息,使用quit
退出
fdisk -l /dev/xvdg
Disk /dev/xvdg: 2147.5 GB, 2147483648000 bytes
255 heads, 63 sectors/track, 261083 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/xvdg1 1 261084 2097151999+ ee GPT
新磁盘分区为/dev/xvdg1
pvcreate /dev/xvdg1
[root@dzzz-db1 ~]# pvcreate /dev/xvdg1
Physical volume "/dev/xvdg1" successfully created
pvdisplay
可查看物理卷信息动态扩容
使用vgdisplay
可以看到我们需要扩容的卷组名为license
VG Name license
System ID
Format lvm2
Metadata Areas 3
Metadata Sequence No 7
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 3
Act PV 3
VG Size 2.93 TiB
PE Size 4.00 MiB
Total PE 767995
Alloc PE / Size 767995 / 2.93 TiB
Free PE / Size 0 / 0
VG UUID ds1M8o-udP6-xtBa-xf5Z-6xYf-O0jE-Kiu0bY
使用vgextend license /dev/xvdg1
将物理卷xvdg1加入license卷组
[root@dzzz-db1 ~]# vgextend license /dev/xvdg1
Volume group "license" successfully extended
使用lvextend -l +100%FREE /dev/license/license-data
将余空间全部扩容到l/dev/license/license-data逻辑卷中
[root@dzzz-db1 ~]# lvextend -l +100%FREE /dev/license/license-data
Extending logical volume license-data to 4.88 TiB
Logical volume license-data successfully resized
可以看到已扩容成功2T空间
使用resize2fs /dev/license/license-data
刷新文件系统
[root@dzzz-db1 ~]# resize2fs /dev/license/license-data
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/license/license-data is mounted on /license; on-line resizing required
old desc_blocks = 188, new_desc_blocks = 313
Performing an on-line resize of /dev/license/license-data to 1310713856 (4k) blocks.
此时已开始扩容,容量会逐步增加,可使用df -h
命令查看/dev/license/license-data大小