查看挂载盘
[root@linuxtest73b6 ~]# fdisk -l
Disk /dev/sdb: 214.7 GB, 214748364800 bytes, 419430400 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/sda: 53.7 GB, 53687091200 bytes, 104857600 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: 0x000aeaa5
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1640447 819200 83 Linux
/dev/sda2 1640448 104857599 51608576 8e Linux LVM
Disk /dev/mapper/centos-root: 35.7 GB, 35664166912 bytes, 69656576 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/centos-swap: 17.2 GB, 17179869184 bytes, 33554432 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
比如我这边新增的盘是 /dev/sdb , 需要进行简单的磁盘分区处理:
[root@linuxtest73b6 ~]# fdisk /dev/sdb
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.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xa6f173a2.
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-419430399, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-419430399, default 419430399):
Using default value 419430399
Partition 1 of type Linux and of size 200 GiB is set
Command (m for help): w
新建物理卷 /dev/sdb
物理卷组vg新增物理卷pv
[root@linuxtest73b6 ~]# lvextend -L +200G /dev/centos/root
Insufficient free space: 51200 extents needed, but only 51199 available
逻辑分区lv增加空间
[root@linuxtest73b6 ~]# lvextend -L +199G /dev/centos/root
Size of logical volume centos/root changed from 33.21 GiB (8503 extents) to 232.21 GiB (59447 extents).
Logical volume centos/root successfully resized.
刷新xfs的文件系统(xfs_growfs)
[root@linuxtest73b6 ~]# xfs_growfs /dev/centos/root
meta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=2176768 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=8707072, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=4251, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 8707072 to 60873728
[root@linuxtest73b6 ~]# df -lh
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 233G 32G 201G 14% /
devtmpfs 7.9G 0 7.9G 0% /dev
tmpfs 7.9G 0 7.9G 0% /dev/shm
tmpfs 7.9G 797M 7.1G 10% /run
tmpfs 7.9G 0 7.9G 0% /sys/fs/cgroup
/dev/sda1 797M 165M 633M 21% /boot
tmpfs 1.6G 0 1.6G 0% /run/user/1001
tmpfs 1.6G 0 1.6G 0% /run/user/0
[root@linuxtest73b6 ~]# fdisk -l
刷新xfs的文件系统(resize2fs)
[root@linuxteste1bb ~]# resize2fs /dev/datav/data
resize2fs 1.42.9 (28-Dec-2013)
open: No such file or directory while opening /dev/datav/data
[root@linuxteste1bb ~]# resize2fs /dev/centos/root
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/centos/root is mounted on /; on-line resizing required
old_desc_blocks = 5, new_desc_blocks = 30
The filesystem on /dev/centos/root is now 60873728 blocks long.
[root@linuxteste1bb ~]# df -lh
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 229G 18G 202G 8% /
devtmpfs 16G 0 16G 0% /dev
tmpfs 16G 0 16G 0% /dev/shm
tmpfs 16G 12M 16G 1% /run
tmpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/sda1 772M 131M 585M 19% /boot
tmpfs 3.2G 0 3.2G 0% /run/user/0