CentOS 7 系统部署之四:磁盘扩容与调整
许多情况之下,我们初期无法准确判断业务系统磁盘消耗需求或业务突发式暴增超过预期规划。此时,我们需要通过LVM特性来扩展磁盘分区。
[操作步骤]
1.检查当前的容量信息
[root@zabbix01 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/cl_zabbix01-root 50G 8.1G 42G 17% / < 扩大
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 185M 1.7G 10% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/sda1 1014M 139M 876M 14% /boot
/dev/mapper/cl_zabbix01-home 445G 33M 445G 1% /home < 缩小
tmpfs 380M 0 380M 0% /run/user/0
2.将HOME挂载点容量进行缩小,缩减为100G;
※ 比较郁闷,我2次操作lvreduct都最终会出现superblock错误…有空再研究的
A.备份HOME挂载点数据
cp /home /home_bak
B.卸载HOME挂载点
umount /home
※ 如果无法卸载,请查询什么进程正在操作目录。
fuser -m -v -i -k /home
C.查询LV信息
[root@zabbix01 ~]# lvdisplay --- Logical volume ---LV Path /dev/cl_zabbix01/swapLV Name swapVG Name cl_zabbix01LV UUID Q5THVE-tuqB-fDXZ-m2q9-CpDw-TM0w-ab3atVLV Write Access read/writeLV Creation host, time zabbix01, 2017-08-24 14:02:35 +0800LV Status available# open 2LV Size 3.88 GiBCurrent LE 992Segments 1Allocation inheritRead ahead sectors auto- currently set to 8192Block device 253:1--- Logical volume ---LV Path /dev/cl_zabbix01/homeLV Name homeVG Name cl_zabbix01LV UUID QA7rqX-o7dJ-RBEa-sosC-T1gH-58fv-oKFQJqLV Write Access read/writeLV Creation host, time zabbix01, 2017-08-24 14:02:35 +0800LV Status available# open 0LV Size 445.12 GiBCurrent LE 113950Segments 1Allocation inheritRead ahead sectors auto- currently set to 8192Block device 253:2--- Logical volume ---LV Path /dev/cl_zabbix01/rootLV Name rootVG Name cl_zabbix01LV UUID i99Cqt-SB7n-cCmv-kEIZ-Q4ax-6TLm-uEVMvULV Write Access read/writeLV Creation host, time zabbix01, 2017-08-24 14:02:37 +0800LV Status available# open 1LV Size 50.00 GiBCurrent LE 12800Segments 1Allocation inheritRead ahead sectors auto- currently set to 8192Block device 253:0
D.删除HOME挂载点LV
[root@zabbix01 ~]# lvremove /dev/cl_zabbix01/home
Do you really want to remove active logical volume cl_zabbix01/home? [y/n]: yLogical volume "home" successfully removed
[root@zabbix01 ~]# lvdisplay --- Logical volume ---LV Path /dev/cl_zabbix01/swapLV Name swapVG Name cl_zabbix01LV UUID Q5THVE-tuqB-fDXZ-m2q9-CpDw-TM0w-ab3atVLV Write Access read/writeLV Creation host, time zabbix01, 2017-08-24 14:02:35 +0800LV Status available# open 2LV Size 3.88 GiBCurrent LE 992Segments 1Allocation inheritRead ahead sectors auto- currently set to 8192Block device 253:1--- Logical volume ---LV Path /dev/cl_zabbix01/rootLV Name rootVG Name cl_zabbix01LV UUID i99Cqt-SB7n-cCmv-kEIZ-Q4ax-6TLm-uEVMvULV Write Access read/writeLV Creation host, time zabbix01, 2017-08-24 14:02:37 +0800LV Status available# open 1LV Size 50.00 GiBCurrent LE 12800Segments 1Allocation inheritRead ahead sectors auto- currently set to 8192Block device 253:0
E.重建HOME挂载点LV
[root@zabbix01 ~]# lvcreate -L 100G -n home cl_zabbix01
WARNING: xfs signature detected on /dev/cl_zabbix01/home at offset 0. Wipe it? [y/n]: yWiping xfs signature on /dev/cl_zabbix01/home.
WARNING: xfs_external_log signature detected on /dev/cl_zabbix01/home at offset 82432. Wipe it? [y/n]: yWiping xfs_external_log signature on /dev/cl_zabbix01/home.
WARNING: xfs_external_log signature detected on /dev/cl_zabbix01/home at offset 84480. Wipe it? [y/n]: yWiping xfs_external_log signature on /dev/cl_zabbix01/home.
WARNING: xfs_external_log signature detected on /dev/cl_zabbix01/home at offset 86016. Wipe it? [y/n]: yWiping xfs_external_log signature on /dev/cl_zabbix01/home.
WARNING: xfs_external_log signature detected on /dev/cl_zabbix01/home at offset 87040. Wipe it? [y/n]: yWiping xfs_external_log signature on /dev/cl_zabbix01/home.
WARNING: xfs_external_log signature detected on /dev/cl_zabbix01/home at offset 88064. Wipe it? [y/n]: yWiping xfs_external_log signature on /dev/cl_zabbix01/home.
WARNING: xfs_external_log signature detected on /dev/cl_zabbix01/home at offset 89088. Wipe it? [y/n]: yWiping xfs_external_log signature on /dev/cl_zabbix01/home.
WARNING: xfs_external_log signature detected on /dev/cl_zabbix01/home at offset 94720. Wipe it? [y/n]: yWiping xfs_external_log signature on /dev/cl_zabbix01/home.
WARNING: xfs_external_log signature detected on /dev/cl_zabbix01/home at offset 95744. Wipe it? [y/n]: yWiping xfs_external_log signature on /dev/cl_zabbix01/home.Logical volume "home" created.
[root@zabbix01 ~]# lvdisplay --- Logical volume ---LV Path /dev/cl_zabbix01/swapLV Name swapVG Name cl_zabbix01LV UUID Q5THVE-tuqB-fDXZ-m2q9-CpDw-TM0w-ab3atVLV Write Access read/writeLV Creation host, time zabbix01, 2017-08-24 14:02:35 +0800LV Status available# open 2LV Size 3.88 GiBCurrent LE 992Segments 1Allocation inheritRead ahead sectors auto- currently set to 8192Block device 253:1--- Logical volume ---LV Path /dev/cl_zabbix01/rootLV Name rootVG Name cl_zabbix01LV UUID i99Cqt-SB7n-cCmv-kEIZ-Q4ax-6TLm-uEVMvULV Write Access read/writeLV Creation host, time zabbix01, 2017-08-24 14:02:37 +0800LV Status available# open 1LV Size 50.00 GiBCurrent LE 12800Segments 1Allocation inheritRead ahead sectors auto- currently set to 8192Block device 253:0--- Logical volume ---LV Path /dev/cl_zabbix01/homeLV Name homeVG Name cl_zabbix01LV UUID pR0etd-9Ey7-Nfvd-eESr-aoz9-BJfh-ETZK07LV Write Access read/writeLV Creation host, time zabbix01, 2019-09-04 20:48:42 +0800LV Status available# open 0LV Size 100.00 GiBCurrent LE 25600Segments 1Allocation inheritRead ahead sectors auto- currently set to 8192Block device 253:2
F.创建文件系统与挂载
[root@zabbix01 ~]# mkfs.xfs /dev/cl_zabbix01/home
meta-data=/dev/cl_zabbix01/home isize=512 agcount=4, agsize=6553600 blks= sectsz=512 attr=2, projid32bit=1= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=26214400, imaxpct=25= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=12800, version=2= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[root@zabbix01 ~]# mount /dev/cl_zabbix01/home /home
[root@zabbix01 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/cl_zabbix01-root 50G 8.1G 42G 17% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 185M 1.7G 10% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/sda1 1014M 139M 876M 14% /boot
tmpfs 380M 0 380M 0% /run/user/0
/dev/mapper/cl_zabbix01-home 100G 33M 100G 1% /home
3.扩容ROOT挂载点LV,扩容大小100G
[root@zabbix01 ~]# vgdisplay --- Volume group ---VG Name cl_zabbix01System ID Format lvm2Metadata Areas 1Metadata Sequence No 6VG Access read/writeVG Status resizableMAX LV 0Cur LV 3Open LV 3Max PV 0Cur PV 1Act PV 1VG Size 499.00 GiBPE Size 4.00 MiBTotal PE 127743Alloc PE / Size 39392 / 153.88 GiBFree PE / Size 88351 / 345.12 GiBVG UUID 17Rk41-gnyW-z1Z1-E1fZ-eNeA-kZcr-5OwoxH[root@zabbix01 ~]# lvextend -L +100G /dev/mapper/cl_zabbix01-rootSize of logical volume cl_zabbix01/root changed from 50.00 GiB (12800 extents) to 150.00 GiB (38400 extents).Logical volume cl_zabbix01/root successfully resized.
[root@zabbix01 ~]# xfs_growfs /dev/mapper/cl_zabbix01-root
meta-data=/dev/mapper/cl_zabbix01-root isize=512 agcount=4, agsize=3276800 blks= sectsz=512 attr=2, projid32bit=1= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=13107200, imaxpct=25= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=6400, version=2= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 13107200 to 39321600
※ 如果不操作xfs_growfs,df是无法看到扩展容量,但lvdisplay已经看到扩展容量。
最终容量状态
[root@zabbix01 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/cl_zabbix01-root 150G 8.1G 142G 6% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 185M 1.7G 10% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/sda1 1014M 139M 876M 14% /boot
tmpfs 380M 0 380M 0% /run/user/0
/dev/mapper/cl_zabbix01-home 100G 33M 100G 1% /home[root@zabbix01 ~]# lvdisplay --- Logical volume ---LV Path /dev/cl_zabbix01/swapLV Name swapVG Name cl_zabbix01LV UUID Q5THVE-tuqB-fDXZ-m2q9-CpDw-TM0w-ab3atVLV Write Access read/writeLV Creation host, time zabbix01, 2017-08-24 14:02:35 +0800LV Status available# open 2LV Size 3.88 GiBCurrent LE 992Segments 1Allocation inheritRead ahead sectors auto- currently set to 8192Block device 253:1--- Logical volume ---LV Path /dev/cl_zabbix01/rootLV Name rootVG Name cl_zabbix01LV UUID i99Cqt-SB7n-cCmv-kEIZ-Q4ax-6TLm-uEVMvULV Write Access read/writeLV Creation host, time zabbix01, 2017-08-24 14:02:37 +0800LV Status available# open 1LV Size 150.00 GiBCurrent LE 38400Segments 2Allocation inheritRead ahead sectors auto- currently set to 8192Block device 253:0--- Logical volume ---LV Path /dev/cl_zabbix01/homeLV Name homeVG Name cl_zabbix01LV UUID pR0etd-9Ey7-Nfvd-eESr-aoz9-BJfh-ETZK07LV Write Access read/writeLV Creation host, time zabbix01, 2019-09-04 20:48:42 +0800LV Status available# open 1LV Size 100.00 GiBCurrent LE 25600Segments 1Allocation inheritRead ahead sectors auto- currently set to 8192Block device 253:2
CentOS 7 系统部署之四:磁盘扩容与调整相关推荐
- linux系统下进行磁盘扩容
前言 本文中的前提是基于在虚拟化平台中进行扩容,在虚拟化平台中有个centos7.qcow2镜像格式安装的centos7的系统,前面的扩容步骤是针对qcow2格式的:如果使用虚拟机,除前面两大步骤不一 ...
- redhat7扩容linux,vmware中Centos 7 linux的LVM磁盘扩容
系统是RHEL7(centos7差不多一样) 关闭系统,在vmware.设置.硬盘.扩展.输入数字大于当前系统内存.点击扩展. 开机再查看磁盘信息 fdisk -l 注意:可以看出sda磁盘增加了,但 ...
- CentOS(/dev/mapper/centos-root)进行磁盘扩容
转载:http://www.zxyf.net/show-8869.html 一.虚拟机上先扩展分区: 二.centos系统root登入,新建分区 2.1 [fdisk -l] 最大分区为/dev/sd ...
- Linux/Centos 7 系统硬盘扩容、挂载
一.磁盘分区,常见指令说明: 1.判断磁盘属于MBR还是GPT(gpt 用gdisk,mbr用fdisk): 1.1 lsblk 列出系统上的所有磁盘列表 2.df -h 查看硬盘使用情况 3. fd ...
- 虚拟机系统的磁盘扩容妙招及案例
转载请通知老方,获许后方可(本文首发于CUblog). 随着服务器虚拟化在企业中的应用越来越广,对寄宿其上的虚拟机系统的管理也越来越受到重视,在本文中,笔者通过实例来帮助大家如何实现虚拟机系统在磁盘空 ...
- 在CentOS 6.7部署wordpress博客系统Discuz论坛系统
在CentOS 6.7部署wordpress博客系统Discuz论坛系统 服务器操作系统:CentOS6.7 博客部署服务器:Httpd-2.2 后台语言:PHP 数据库:MySql 前端框架:Wor ...
- 虚拟服务器怎么给系统扩容,虚拟服务器磁盘扩容
虚拟服务器磁盘扩容 内容精选 换一换 您可以创建VBD类型的共享磁盘和SCSI类型的共享磁盘.建议将共享磁盘挂载至位于同一个反亲和性云服务器组内的ECS,以提高业务可靠.VBD类型的共享磁盘:创建的共 ...
- linux 卸载libtiff5,【转】centos卸载系统与环境部署
卸载mysql rpm -qa|grep -i mysql rpm -ev MySQL-server-4.0.14-0 MySQL-client-4.0.14-0 卸载后/var/lib/mysql中 ...
- lxd linux系统视频教程,使用snap在CentOS 7系统下部署LXD的方法
本文向你展示在CentOS 7服务器/系统桌面下安装和使用LXD的简单方法. LXD的特点 如下是LXD的最大特色: 设计安全(无特权的容器,资源限制等) 可扩展(来自数千个计算节点上的容器) 直观( ...
最新文章
- 10个有毒的设计神器
- 批量操作WinRAR实用技巧七招
- c语言24点程序,C语言24点问题
- LeetCode算法入门- Implement strStr() -day22
- 06 ansible剧本功能实践介绍
- 【英语学习】【Level 08】U02 Movie Time L4 From the page to the big screen
- Tun/Tap接口教材-[翻译:Tun/Tap interface tutorial]
- 基于JAVA+Servlet+JSP+MYSQL的网络考试系统
- CakePHP中文手册【翻译】-基本概念
- php导出excel出现乱码,php导出excel出现乱码怎么办
- VSCode如何返回上一步
- 计算机信息计量单位中的1k代表多少字节,1k等于多少字节
- 【MapReduce】猫眼电影数据库传输数据
- JavaWeb_CSS(14)_文字处理_字体和字号
- 【XJTUSE计算机图形学】第四章 真实感图形学(2)——简单光照明模型
- php垃圾回收,PHP垃圾回收机制的理解
- 修复未能连接一个window服务器,未能连接一个windows服务的修复方法
- 基于springboot+bboss整合的elasticsearch(好用的一匹)
- 使用webgl绘制一个点
- 银行计算机安全工作会议记录,如何发表课题相关论文_横向课题成果能发论文吗...