赞
踩
[root@nfs-test ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 1024M 0 rom
sr1 11:1 1 442K 0 rom
vda 252:0 0 100G 0 disk
├─vda1 252:1 0 190M 0 part /boot
└─vda2 252:2 0 99.8G 0 part
├─nlas-root 253:0 0 96.1G 0 lvm /
└─nlas-swap 253:1 0 3.7G 0 lvm [SWAP]
vdb 252:16 0 5T 0 disk
└─vdb1 252:17 0 1024G 0 part
[root@nfs-test ~]#
[root@nfs-test ~]# type sgdisk || yum -y install sgdisk
sgdisk is /usr/sbin/sgdisk
[root@nfs-test ~]# fdisk -lu
Disk /dev/vda: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000a0b6c
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 391167 194560 83 Linux
/dev/vda2 391168 209715199 104662016 8e Linux LVM
Disk /dev/vdb: 5497.6 GB, 5497558138880 bytes, 10737418240 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xc988d1e1
Device Boot Start End Blocks Id System
/dev/vdb1 2048 2147483647 1073740800 8e Linux LVM
Disk /dev/mapper/nlas-root: 103.2 GB, 103171489792 bytes, 201506816 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/nlas-swap: 4001 MB, 4001366016 bytes, 7815168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
[root@nfs-test ~]# sgdisk -g /dev/vdb
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory.
The operation has completed successfully.
[root@nfs-test ~]# fdisk -lu
Disk /dev/vda: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000a0b6c
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 391167 194560 83 Linux
/dev/vda2 391168 209715199 104662016 8e Linux LVM
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/vdb: 5497.6 GB, 5497558138880 bytes, 10737418240 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
Disk identifier: FFBA4260-670B-4B79-8C45-B37234D43B4F
Start End Size Type Name
1 2048 2147483647 1024G Linux LVM Linux LVM
Disk /dev/mapper/nlas-root: 103.2 GB, 103171489792 bytes, 201506816 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/nlas-swap: 4001 MB, 4001366016 bytes, 7815168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
[root@nfs-test ~]# fdisk /dev/vdb
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk /dev/vdb: 5497.6 GB, 5497558138880 bytes, 10737418240 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
Disk identifier: FFBA4260-670B-4B79-8C45-B37234D43B4F
Start End Size Type Name
1 2048 2147483647 1024G Linux LVM Linux LVM
Command (m for help): n
Partition number (2-128, default 2):
First sector (34-10737418206, default 2147483648):
Last sector, +sectors or +size{K,M,G,T,P} (2147483648-10737418206, default 10737418206):
Created partition 2
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@nfs-test ~]#
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 1024M 0 rom
sr1 11:1 1 442K 0 rom
vda 252:0 0 100G 0 disk
├─vda1 252:1 0 190M 0 part /boot
└─vda2 252:2 0 99.8G 0 part
├─nlas-root 253:0 0 96.1G 0 lvm /
└─nlas-swap 253:1 0 3.7G 0 lvm [SWAP]
vdb 252:16 0 5T 0 disk
└─vdb1 252:17 0 1024G 0 part
└─qmt_nfs-qmt_nfs_lv1 253:2 0 1023G 0 lvm [root@nfs-test ~]# partprobe /dev/vdb
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 1024M 0 rom
sr1 11:1 1 442K 0 rom
vda 252:0 0 100G 0 disk
├─vda1 252:1 0 190M 0 part /boot
└─vda2 252:2 0 99.8G 0 part
├─nlas-root 253:0 0 96.1G 0 lvm /
└─nlas-swap 253:1 0 3.7G 0 lvm [SWAP]
vdb 252:16 0 5T 0 disk
├─vdb1 252:17 0 1024G 0 part
│ └─qmt_nfs-qmt_nfs_lv1 253:2 0 1023G 0 lvm
Physical volume “/dev/vdb2” successfully created.
PV VG Fmt Attr PSize PFree
/dev/vda2 nlas lvm2 a-- 99.81g 0
/dev/vdb1 qmt_nfs lvm2 a-- <1024.00g 1020.00m
/dev/vdb2 lvm2 — <4.00t <4.00t
— Physical volume —
PV Name /dev/vdb1
VG Name qmt_nfs
PV Size <1024.00 GiB / not usable 3.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 262143
Free PE 255
Allocated PE 261888
PV UUID 8wrQGf-Tu65-x3gZ-nOrO-KBbV-uc7b-nuMsy8
— Physical volume —
PV Name /dev/vda2
VG Name nlas
PV Size 99.81 GiB / not usable 0
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 25552
Free PE 0
Allocated PE 25552
PV UUID 9TkfbX-n8wt-ML97-jlmY-ED7b-Lz8u-fGI1Kx
“/dev/vdb2” is a new physical volume of “<4.00 TiB”
— NEW Physical volume —
PV Name /dev/vdb2
VG Name
PV Size <4.00 TiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID sB1dLQ-eFnx-SGx2-k801-ovyx-DiSB-qiiQbj
VG #PV #LV #SN Attr VSize VFree
nlas 1 2 0 wz–n- 99.81g 0
qmt_nfs 1 1 0 wz–n- <1024.00g 1020.00m
Volume group “qmt_nfs” successfully extended
VG #PV #LV #SN Attr VSize VFree
nlas 1 2 0 wz–n- 99.81g 0
qmt_nfs 2 1 0 wz–n- <5.00t 4.00t
— Volume group —
VG Name qmt_nfs
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 5
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 0
Max PV 0
Cur PV 2
Act PV 2
VG Size <5.00 TiB
PE Size 4.00 MiB
Total PE 1310718
Alloc PE / Size 261888 / 1023.00 GiB
Free PE / Size 1048830 / 4.00 TiB
VG UUID FQAifA-Eu2F-fjjC-AOS1-9z5y-wuML-8GesMZ
— Volume group —
VG Name nlas
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 99.81 GiB
PE Size 4.00 MiB
Total PE 25552
Alloc PE / Size 25552 / 99.81 GiB
Free PE / Size 0 / 0
VG UUID rLL3CP-YX4o-5ciU-Y5Zx-coDq-3Cus-B6r5Q7
lvextend -L +4T qmt_nfs_lv1 mt_nfs ##表示为qmt_nfs_lv1增加4T容量
lvextend -L /dev/mapper/qmt_nfs_lv1 /dev/vdb2 ## 表示将/dev/vdb2的所有空间都给到该逻辑卷(前提是vdb2已经是物理卷了)
lvextend -l +100%FREE /dev/mapper/qmt_nfs-qmt_nfs_lv1 ## 表示将该卷组内的所有空间都新增给该逻辑卷
扩容完成之后还需要扩展的容量,这里需要看文件系统格式了!!!!!!!注意这里做的是扩展,并不会影响原有数据
XFS 使用xfs_growfs /dev/mapper/qmt_nfs-qmt_nfs_lv1
ext4 使用 resize2fs /dev/mapper/qmt_nfs-qmt_nfs_lv1
完成之后就可以验证当前容量是否扩容完成了
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/nlas-root xfs 97G 86G 11G 90% /
devtmpfs devtmpfs 16G 0 16G 0% /dev
tmpfs tmpfs 16G 0 16G 0% /dev/shm
tmpfs tmpfs 16G 25M 16G 1% /run
tmpfs tmpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/vda1 xfs 187M 140M 48M 75% /boot
tmpfs tmpfs 60M 0 60M 0% /var/log/rtlog
tmpfs tmpfs 3.2G 0 3.2G 0% /run/user/0
/dev/mapper/qmt_nfs-qmt_nfs_lv1 xfs 1023G 33M 1023G 1% /TRS
meta-data=/dev/mapper/qmt_nfs-qmt_nfs_lv1 isize=512 agcount=4, agsize=67043328 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=268173312, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=130944, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 268173312 to 1342175232
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/nlas-root xfs 97G 86G 11G 90% /
devtmpfs devtmpfs 16G 0 16G 0% /dev
tmpfs tmpfs 16G 0 16G 0% /dev/shm
tmpfs tmpfs 16G 25M 16G 1% /run
tmpfs tmpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/vda1 xfs 187M 140M 48M 75% /boot
tmpfs tmpfs 60M 0 60M 0% /var/log/rtlog
tmpfs tmpfs 3.2G 0 3.2G 0% /run/user/0
/dev/mapper/qmt_nfs-qmt_nfs_lv1 xfs 5.0T 33M 5.0T 1% /TRS
mpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/vda1 xfs 187M 140M 48M 75% /boot
tmpfs tmpfs 60M 0 60M 0% /var/log/rtlog
tmpfs tmpfs 3.2G 0 3.2G 0% /run/user/0
/dev/mapper/qmt_nfs-qmt_nfs_lv1 xfs 5.0T 33M 5.0T 1% /TRS
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。