Table of Contents
[root@C111 ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 485M 0 485M 0% /dev tmpfs 496M 0 496M 0% /dev/shm tmpfs 496M 7.1M 489M 2% /run tmpfs 496M 0 496M 0% /sys/fs/cgroup /dev/mapper/centos-root 2.6G 2.1G 534M 80% / /dev/sda1 1014M 168M 847M 17% /boot tmpfs 100M 0 100M 0% /run/user/0
[root@C111 ~]# fdisk -l Disk /dev/sda: 6442 MB, 6442450944 bytes, 12582912 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: 0x000cb77f Device Boot Start End Blocks Id System /dev/sda1 * 2048 2099199 1048576 83 Linux /dev/sda2 2099200 8388607 3144704 8e Linux LVM Disk /dev/mapper/centos-root: 2785 MB, 2785017856 bytes, 5439488 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: 432 MB, 432013312 bytes, 843776 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/sda , /dev/sda5
[root@C111 ~]# fdisk -l Disk /dev/sda: 6442 MB, 6442450944 bytes, 12582912 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: 0x000cb77f Device Boot Start End Blocks Id System /dev/sda1 * 2048 2099199 1048576 83 Linux /dev/sda2 2099200 8388607 3144704 8e Linux LVM /dev/sda3 8388608 12582911 2097152 5 Extended /dev/sda5 8390656 12582911 2096128 83 Linux Disk /dev/mapper/centos-root: 2785 MB, 2785017856 bytes, 5439488 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: 432 MB, 432013312 bytes, 843776 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
创建 PV
[root@C111 ~]# pvcreate /dev/sda5 Physical volume "/dev/sda5" successfully created. [root@C111 ~]# pvdisplay --- Physical volume --- PV Name /dev/sda2 VG Name centos PV Size <3.00 GiB / not usable 3.00 MiB Allocatable yes (but full) PE Size 4.00 MiB Total PE 767 Free PE 0 Allocated PE 767 PV UUID C0yRML-QxbR-8pkp-qtEJ-Vu22-uoGz-dVFKhs --- Physical volume --- PV Name /dev/sda5 VG Name centos PV Size <2.00 GiB / not usable 3.00 MiB Allocatable yes (but full) PE Size 4.00 MiB Total PE 511 Free PE 0 Allocated PE 511 PV UUID HeWNxb-qvt5-RuU2-Ni1I-33Xw-BJw8-qORUsF
/dev/sda5 加入到 VG centos 下
[root@C111 ~]# vgextend centos /dev/sda5 Volume group "centos" successfully extended
剩余 100% 容量分给 centos/root 分区
[root@C111 ~]# lvextend -l +100%FREE /dev/centos/root Size of logical volume centos/root changed from 2.59 GiB (664 extents) to <4.59 GiB (1175 extents). Logical volume centos/root successfully resized.
刷新分区表
[root@C111 ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 485M 0 485M 0% /dev tmpfs 496M 0 496M 0% /dev/shm tmpfs 496M 7.1M 489M 2% /run tmpfs 496M 0 496M 0% /sys/fs/cgroup /dev/mapper/centos-root 2.6G 2.1G 534M 80% / /dev/sda1 1014M 168M 847M 17% /boot tmpfs 100M 0 100M 0% /run/user/0 [root@C111 ~]# xfs_growfs /dev/mapper/centos-root meta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=169984 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=0 spinodes=0 data = bsize=4096 blocks=679936, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=1 log =internal bsize=4096 blocks=2560, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 data blocks changed from 679936 to 1203200 [root@C111 ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 485M 0 485M 0% /dev tmpfs 496M 0 496M 0% /dev/shm tmpfs 496M 7.1M 489M 2% /run tmpfs 496M 0 496M 0% /sys/fs/cgroup /dev/mapper/centos-root 4.6G 2.1G 2.6G 46% / /dev/sda1 1014M 168M 847M 17% /boot tmpfs 100M 0 100M 0% /run/user/0
评论前必须登录!
注册