追风赶月莫停留,平芜尽处是春山。这篇文章主要讲述模拟逻辑卷扩容相关的知识,希望能为你提供帮助。
?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 --分区步骤不作说明??确认/dev/sdc2 分区成功:?
?# partprobe?
?# 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??可以确认到/data容量增加到9.9G.?
?# 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 ?
?# 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?
推荐阅读
- MySQL启动脚本
- #yyds干货盘点#解决 bash: telnet: command not found 问题
- 应用运维工程师基础能力总结
- Linux基础操作(如何在 Linux 中复制文件夹())
- Apache优化相关#yyds干货盘点#
- Linux系统数据备份不再头疼,Rdiff-backup来帮忙!
- Linux 示例中的 apt 命令大全,建议收藏!
- #私藏项目实操分享# Ngnix--day01
- Linux 的无障碍设置如何操作()