[iyunv@fdfs-ds01 ~]# fdisk -l | grep D
Disk /dev/sda: 42.9 GB, 42949672960 bytes
Disk identifier: 0x0002f8b7
Device Boot Start End Blocks Id System
Disk /dev/sdb: 2199.0 GB, 2199023255552 bytes
Disk identifier: 0xc1f030ee
Device Boot Start End Blocks Id System
Disk /dev/mapper/rootvg-lv01: 41.6 GB, 41641050112 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/datavg-lv02: 2146.4 GB, 2146409906176 bytes
Disk identifier: 0x00000000
Disk /dev/sdc: 2199.0 GB, 2199023255552 bytes <==看到硬盘被成功识别出来了
Disk identifier: 0x00000000
三. 格式化新添加的硬盘
[iyunv@fdfs-ds01 ~]# fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x07d85a0a.
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)
WARNING: The size of this disk is 2.2 TB (2199023255552 bytes).
DOS partition table format can not be used on drives for volumes
larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID
partition table format (GPT).
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): n<==命令 n 用于添加新分区
Command action
e extended
p primary partition (1-4) p <==择创建主分区
Partition number (1-4): 1 <==主分区的编号
First cylinder (1-267349, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-267349, default 267349):
Using default value 267349
Command (m for help): w <==保存所有配置并退出
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[iyunv@fdfs-ds01 data]# pvcreate /dev/sdc1
Physical volume "/dev/sdc1" successfully created
[iyunv@fdfs-ds01 data]# vgextend datavg /dev/sdc1
Volume group "datavg" successfully extended
[iyunv@fdfs-ds01 data]# vgdisplay
--- Volume group ---
VG Name datavg
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 2
Act PV 2
VG Size 4.00 TiB <==VG组容量已经从2TB增加到4TB
PE Size 4.00 MiB
Total PE 1048574
Alloc PE / Size 511744 / 1.95 TiB
Free PE / Size 536830 / 2.05 TiB <==主要查看Free PE / Size,说明我们最多可以有2.05TB的扩充空间
VG UUID Z7H7Wd-O7hT-69tE-7iq2-TXNi-0xIO-nCqoIk
--- Volume group ---
VG Name rootvg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size 38.78 GiB
PE Size 32.00 MiB
Total PE 1241
Alloc PE / Size 1241 / 38.78 GiB
Free PE / Size 0 / 0
VG UUID Hnif90-DJXc-elxC-Hn1H-aQfn-Ysvb-iDCJrF
最后,给/data目录增加空间
[iyunv@fdfs-ds01 data]# lvextend -L +1.98T /dev/mapper/datavg-lv02 /dev/sdc1
Rounding size to boundary between physical extents: 1.98 TiB
Extending logical volume lv02 to 3.93 TiB
Logical volume lv02 successfully resized
使用 resize2fs 命令刷新 /dev/mapper/datavg-lv02 文件系统大小
[iyunv@fdfs-ds01 data]# resize2fs /dev/mapper/datavg-lv02
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/datavg-lv02 is mounted on /data; on-line resizing required
old desc_blocks = 125, new_desc_blocks = 252
Performing an on-line resize of /dev/mapper/datavg-lv02 to 1055528960 (4k) blocks.
The filesystem on /dev/mapper/datavg-lv02 is now 1055528960 blocks long.