一、新增磁盘/dev/sdf
[root@sc-report-center ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 500G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 499G 0 part
├─centos-root 253:0 0 2.4T 0 lvm /
└─centos-swap 253:1 0 4G 0 lvm [SWAP]
sdb 8:16 0 500G 0 disk
└─centos-root 253:0 0 2.4T 0 lvm /
sdc 8:32 0 500G 0 disk
└─centos-root 253:0 0 2.4T 0 lvm /
sdd 8:48 0 500G 0 disk
└─centos-root 253:0 0 2.4T 0 lvm /
sde 8:64 0 500G 0 disk
└─centos-root 253:0 0 2.4T 0 lvm /
sdf 8:80 0 5T 0 disk
sr0 11:0 1 4.5G 0 rom /run/media/root/CentOS 7 x86_64
loop0 7:0 0 4.5G 1 loop /media
二、创建分区---gdisk
fdisk只能识别2T以内的磁盘,超过2T需要用gdisk命令
[root@sc-report-center ~]# gdisk /dev/sdf
GPT fdisk (gdisk) version 0.8.10
Partition table scan:
MBR: not present
BSD: not present
APM: not present
GPT: not present
Creating new GPT entries.
Command (? for help): n ---创建新分区
Partition number (1-128, default 1):
First sector (34-10737418206, default = 2048) or {+-}size{KMGTP}:
Last sector (2048-10737418206, default = 10737418206) or {+-}size{KMGTP}:
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300):
Changed type of partition to 'Linux filesystem'
Command (? for help): p ---打印分区信息
Disk /dev/sdf: 10737418240 sectors, 5.0 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 4C8ADAB2-4DEC-492F-AB42-D06E459F9568
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 10737418206
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)
Number Start (sector) End (sector) Size Code Name
1 2048 10737418206 5.0 TiB 8300 Linux filesystem
Command (? for help): w ---保存
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/sdf.
The operation has completed successfully.
三、查看信息 partprobe -s
[root@sc-report-center ~]# partprobe -s
/dev/sda: msdos partitions 1 2
/dev/sdf: gpt partitions 1
Warning: 无法以读写方式打开 /dev/sr0 (只读文件系统)。/dev/sr0 已按照只读方式打开。
/dev/sr0: msdos partitions 2
四、扩容
[root@sc-report-center ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 500G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 499G 0 part
├─centos-root 253:0 0 2.4T 0 lvm /
└─centos-swap 253:1 0 4G 0 lvm [SWAP]
sdb 8:16 0 500G 0 disk
└─centos-root 253:0 0 2.4T 0 lvm /
sdc 8:32 0 500G 0 disk
└─centos-root 253:0 0 2.4T 0 lvm /
sdd 8:48 0 500G 0 disk
└─centos-root 253:0 0 2.4T 0 lvm /
sde 8:64 0 500G 0 disk
└─centos-root 253:0 0 2.4T 0 lvm /
sdf 8:80 0 5T 0 disk
└─sdf1 8:81 0 5T 0 part
sr0 11:0 1 4.5G 0 rom /run/media/root/CentOS 7 x86_64
loop0 7:0 0 4.5G 1 loop /media
[root@sc-report-center ~]# pvcreate /dev/sdf1
Physical volume "/dev/sdf1" successfully created.
[root@sc-report-center ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 5 2 0 wz--n- 2.44t 0
[root@sc-report-center ~]# vgextend centos /dev/sdf1
Volume group "centos" successfully extended
[root@sc-report-center ~]# df -Th
文件系统 类型 容量 已用 可用 已用% 挂载点
devtmpfs devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs tmpfs 3.9G 410M 3.5G 11% /run
tmpfs tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/mapper/centos-root xfs 2.5T 2.3T 158G 94% /
/dev/sda1 xfs 1014M 171M 844M 17% /boot
tmpfs tmpfs 799M 24K 799M 1% /run/user/42
/dev/loop0 iso9660 4.5G 4.5G 0 100% /media
tmpfs tmpfs 799M 48K 799M 1% /run/user/0
/dev/sr0 iso9660 4.5G 4.5G 0 100% /run/media/root/CentOS 7 x86_64
[root@sc-report-center ~]# lvextend /dev/mapper/centos-root /dev/sdf1
Size of logical volume centos/root changed from <2.44 TiB (638715 extents) to <7.44 TiB (1949434 extents).
Logical volume centos/root successfully resized.
[root@sc-report-center ~]# xfs_growfs /dev/mapper/centos-root
meta-data=/dev/mapper/centos-root isize=512 agcount=21, agsize=32440064 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=654044160, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=63359, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 654044160 to 1996220416
[root@sc-report-center ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 3.9G 410M 3.5G 11% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/mapper/centos-root 7.5T 2.3T 5.2T 31% /
/dev/sda1 1014M 171M 844M 17% /boot
tmpfs 799M 24K 799M 1% /run/user/42
/dev/loop0 4.5G 4.5G 0 100% /media
tmpfs 799M 48K 799M 1% /run/user/0
/dev/sr0 4.5G 4.5G 0 100% /run/media/root/CentOS 7 x86_64