模拟逻辑卷扩容
Posted Liujun_Deng
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了模拟逻辑卷扩容相关的知识,希望对你有一定的参考价值。
1、准备逻辑卷
1.1、主机添加磁盘
在主机添加1块20g磁盘
1.2、磁盘分区
先将此磁盘分出5g空间:
# fdisk /dev/sdc --分区步骤不作说明
# partprobe
做成逻辑卷:
# pvcreate /dev/sdc1
# vgcreate data /dev/sdc1
# lvcreate -n oradata -l 100%free data
# blkid |grep oradata
/dev/mapper/data-oradata: UUID="eb3f07ea-1400-46ca-bf87-7885591f4070" TYPE="xfs"
# vim /etc/fstab
末尾添加如下:
UUID="eb3f07ea-1400-46ca-bf87-7885591f4070" /data xfs defaults 0 0
# mount -a
确认:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 55G 7.1G 48G 13% /
devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 3.9G 10M 3.9G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/sda1 2.0G 178M 1.9G 9% /boot
/dev/mapper/rhel-home 35G 37M 35G 1% /home
tmpfs 783M 4.0K 783M 1% /run/user/42
tmpfs 783M 28K 783M 1% /run/user/1000
tmpfs 783M 0 783M 0% /run/user/0
/dev/mapper/data-oradata 5.0G 33M 5.0G 1% /data
# lsblk -p
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
/dev/sda 8:0 0 100G 0 disk
├─/dev/sda1 8:1 0 2G 0 part /boot
└─/dev/sda2 8:2 0 98G 0 part
├─/dev/mapper/rhel-root 253:0 0 55G 0 lvm /
├─/dev/mapper/rhel-swap 253:1 0 8G 0 lvm [SWAP]
└─/dev/mapper/rhel-home 253:2 0 35G 0 lvm /home
/dev/sdb 8:16 0 1G 0 disk
└─/dev/sdb1 8:17 0 1023M 0 part [SWAP]
/dev/sdc 8:32 0 20G 0 disk
└─/dev/sdc1 8:33 0 5G 0 part
└─/dev/mapper/data-oradata 253:3 0 5G 0 lvm /data
/dev/sr0 11:0 1 1024M 0 rom
2、模拟扩容
现给/data增加容量,将其增加到10g
2.1、分区
将/dev/sdc再次分出5g:
# fdisk /dev/sdc --分区步骤不作说明
# partprobe
确认/dev/sdc2 分区成功:
# lsblk -p
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
/dev/sda 8:0 0 100G 0 disk
├─/dev/sda1 8:1 0 2G 0 part /boot
└─/dev/sda2 8:2 0 98G 0 part
├─/dev/mapper/rhel-root 253:0 0 55G 0 lvm /
├─/dev/mapper/rhel-swap 253:1 0 8G 0 lvm [SWAP]
└─/dev/mapper/rhel-home 253:2 0 35G 0 lvm /home
/dev/sdb 8:16 0 1G 0 disk
└─/dev/sdb1 8:17 0 1023M 0 part [SWAP]
/dev/sdc 8:32 0 20G 0 disk
├─/dev/sdc1 8:33 0 5G 0 part
│ └─/dev/mapper/data-oradata 253:3 0 5G 0 lvm /data
└─/dev/sdc2 8:34 0 5G 0 part
/dev/sr0 11:0 1 1024M 0 rom
现在将新分区加入卷组:
# pvcreate /dev/sdc2
# vgextend data /dev/sdc2 --在VG内增加PV
# lvextend -L +5G /dev/mapper/data-oradata
Insufficient free space: 1280 extents needed, but only 1279 available
# lvextend -L +4.9G /dev/mapper/data-oradata --在LV里增加容量
Rounding size to boundary between physical extents: 4.90 GiB.
Size of logical volume data/oradata changed from <5.00 GiB (1279 extents) to <9.90 GiB (2534 extents).
Logical volume data/oradata successfully resized.
# xfs_growfs /dev/mapper/data-oradata
可以确认到/data容量增加到9.9G.
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 55G 7.1G 48G 13% /
devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 3.9G 10M 3.9G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/sda1 2.0G 178M 1.9G 9% /boot
/dev/mapper/rhel-home 35G 37M 35G 1% /home
tmpfs 783M 4.0K 783M 1% /run/user/42
tmpfs 783M 28K 783M 1% /run/user/1000
tmpfs 783M 0 783M 0% /run/user/0
/dev/mapper/data-oradata 9.9G 33M 9.9G 1% /data
以上是关于模拟逻辑卷扩容的主要内容,如果未能解决你的问题,请参考以下文章