Extend a root LVM partition online
There is also a quick remedy for the emergency situation when your root partition runs out of disk space. There is a feature specific to ext3 and ext4 that can help the goal of resolving the full disk situation. Unless explicitly changed during filesystem creation, both by default reserve five percent (5%) of a volume capacity to the superuser (root).

# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/vg_main-lv_root
ext4 .4G .0G 952K % /
tmpfs tmpfs 499M 499M % /dev/shm
/dev/vda1 ext4 485M 33M 428M % /boot # dumpe2fs /dev/vg_main/lv_root | grep 'Reserved block count'
dumpe2fs 1.41. (-May-)
Reserved block count:
It turned out 111513 of 4KB blocks were reserved for the superuser, which was exactly five percent of the volume capacity.
How to enable it?
# tune2fs -m /dev/vg_main/lv_root
tune2fs 1.41. (-May-)
Setting reserved blocks percentage to % ( blocks)
# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/vg_main-lv_root
ext4 .4G .0G 437M % /
tmpfs tmpfs 499M 499M % /dev/shm
/dev/vda1 ext4 485M 33M 428M % /boot
Now that we have some free space on the root partition to work on we can extend the LVM partition:
Create a new partition of appropriate size using fdisk
fdisk /dev/sdb1
This is a key sequence on the keyboard to create a new LVM type (8e) partition:
n, p, 1, enter (accept default first sector), enter (accept default last sector), t, 8e, w
Create a new Physical Volume
# pvcreate /dev/sdb1
Writing physical volume data to disk "/dev/sdb1"
Physical volume "/dev/sdb1" successfully created
Extend a Volume Group
# vgextend vg_main /dev/sdb1
Volume group "vg_main" successfully extended
Extend your LVM
- extend the size of your LVM by the amount of free space on PV
# lvextend /dev/vg_main/lv_root /dev/sdb1
Extending logical volume lv_root to 18.50 GiB
Logical volume lv_root successfully resized
- or with a given size
lvextend -L +10G /dev/vg_main/lv_root
Finally resize the file system on-line
# resize2fs /dev/vg_main/lv_root
resize2fs 1.41. (-May-)
Filesystem at /dev/vg_main/lv_root is mounted on /; on-line resizing required
old desc_blocks = , new_desc_blocks =
Performing an on-line resize of /dev/vg_main/lv_root to (4k) blocks.
The filesystem on /dev/vg_main/lv_root is now blocks long.
- or use xfs_growfs for xfs file system
# xfs_growfs /dev/vg_main/lv_root
Now we can set the reserved blocks back to the default percentage - 5%
# tune2fs -m /dev/mapper/vg_main-lv_root
Results: # df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/vg_main-lv_root
ext4 19G .0G .4G % /
tmpfs tmpfs 499M 499M % /dev/shm
/dev/vda1 ext4 485M 33M 428M % /boot
Extend a root LVM partition online的更多相关文章
- Fedora 19: How to resize/extend (LVM) partition?
Enlarge the disk using fdisk fdisk -l (to see the partition layout, typically we're dealing with /de ...
- 1-16-1 LVM管理和ssm存储管理器使用&磁盘配额
大纲: 1-1- LVM逻辑卷的管理 1-2- SSM管理工具的使用 1-3- 磁盘配额技巧 ====================================== 问题描述: 当我们需要在一个 ...
- 【转载】Linux磁盘管理:LVM逻辑卷管理
Linux学习之CentOS(二十五)--Linux磁盘管理:LVM逻辑卷基本概念及LVM的工作原理 这篇随笔将详细讲解Linux磁盘管理机制中的LVM逻辑卷的基本概念以及LVM的工作原理!!! 一. ...
- Linux LVM学习总结——创建卷组VG
在Linux平台如何创建一个卷组(VG)呢?下面简单介绍一下卷组(VG)的创建步骤.本文实验平台为Red Hat Enterprise Linux Server release 6.6 (Santia ...
- lvm的vg扩容
本次扩容的目的是要扩展 / 的整体容量,具体操作如下: 1.首先查看是否存在未分配的磁盘 [root@NH-Test-44 ~]# fdisk -l Disk /dev/vda: 53.7 GB, 5 ...
- 修复lvm的逻辑卷
一.背景 公司传统的服务器不知道什么朝代的朝臣用lvm分区,1T的硬盘分了50G挂载到根目录"/"里面有/var./usr--,剩下的挂载到了"/home"目录 ...
- LVM扩展学习日志
lvm是逻辑卷管理的简称,它将一个或多个物理硬盘分区(PV)组成一个逻辑硬盘(VG)来使用, 然后从这个VG中划分出逻辑分区(LV), 以上概念是我理解的东西,可能和书上的不一样. 以下所有命令都是 ...
- LVM 镜像硬盘更换、数据恢复(centos7.4 redhat7.5)
案例说明 Centos7 VG:vg LV:vg-lvRedhat 7.5VG:vgtest LV:lvtest 目的:模拟硬盘 /dev/sdb损坏.在线添加新硬盘/dev/sdc,lv镜像数据 ...
- linux中LVM介绍及实验过程
LVM LVM这个词不仅一次出现过,在安装Centos时,磁盘分区时,默认分区就是使用LVM方式分区:再一个就是在OpenStack部署时候用到LVM作为后端存储.对LVM的理解还是不太清晰,查询资料 ...
随机推荐
- Java反射《二》获取构造器
package com.study.reflect; import java.lang.reflect.Constructor; import java.lang.reflect.Invocation ...
- Java正则表达式的总结
Java正则表达式,可以用于很多类型的文本处理, 如匹配,搜索,提取和分析结构化内容. 判断用户的输入是否符合实际需求. 匹配Email地址的正则表达式:\w+([-+.]\w+)*@\w+([-.] ...
- 十七. Python基础(17)--正则表达式
十七. Python基础(17)--正则表达式 1 ● 正则表达式 定义: Regular expressions are sets of symbols that you can use to cr ...
- DevExpress v18.1新版亮点——CodeRush for VS篇(一)
用户界面套包DevExpress v18.1日前正式发布,本站将以连载的形式为大家介绍各版本新增内容.本文将介绍了CodeRush for Visual Studio v18.1 的新功能,快来下载试 ...
- Android开发 ---从互联网上下载文件,回调函数,图片压缩、倒转
Android开发 ---从互联网上下载文件,回调函数,图片压缩.倒转 效果图: 描述: 当点击“下载网络图像”按钮时,系统会将图二中的照片在互联网上找到,并显示在图像框中 注意:这个例子并没有将图 ...
- OpenStack之queens版本创建负载均衡器时报错问题!
采用kolla-ansible部署完毕后,创建负载均衡器时会提示如下的报错 解决办法: 修改网络节点的neutron-lbaas-agent容器 进入lbaas容器里 [root@openstack0 ...
- 70 多表查询的分组F 聚合 Q 查询
聚合查询和分组查询 聚合 aggregate()是QuerySet 的一个终止子句,意思是说,它返回一个包含一些键值对的字典.键的名称是聚合值的标识符,值是计算出来的聚合值.键的名称是按照字段和聚合函 ...
- Strict Standards: Declaration of UserModel::toJSON() should be compatible with that of BaseModel::toJSON()
使用php报了这个错误: 错误的意思是: 严格标准: usermodel中的 toJSON() 方法 应该 同 BaseModel中的toJson() 方法是兼容的. php要求 子类的方法如果同父 ...
- python 正则进阶常用方法
表达式 描述 正则表达式示例 符号 literal 匹配文本字符串的字面值literal foo rel1|rel2 匹配正则表达式rel1或rel2 foo|bar . 匹配任何字符(除了\n之外) ...
- java问题排查工具之一板斧jstack——使用 jstack 定位 java进程CPU过高的问题
jstack主要用来查看某个Java进程内的线程堆栈信息.语法格式如下: jstack [option] pid jstack [option] executable core jstack [opt ...