|
本帖最后由 denglj 于 2022-2-24 10:13 编辑
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
说明:逻辑卷/dev/mapper/data-oradata成功挂载到/data
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 --将LV容量扩充到整个文件系统
meta-data=/dev/mapper/data-oradata isize=512 agcount=4, agsize=327424 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=1309696, 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 1309696 to 2594816
可以确认到/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
|
|