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的理解还是不太清晰,查询资料 ...
随机推荐
- python-列表,元组,range
# 列表# lst = ["光头强", 1, True, {}, (1, ), {123}, ["周杰伦",[], "周杰", " ...
- 第三篇 功能实现(2) (Android学习笔记)
第三篇 功能实现(2) ●Activity的四种启动模式 Activity的启动模式有四种,分别是standard.singleTop.singleTask和singleInstance. 在Andr ...
- getchar getche getch的区别
getchar 由宏实现:#define getchar() getc(stdin). getchar有一个int型的返回值.当程序调用getchar时.程序就等着用户按键.用户输入的字符被存放在键盘 ...
- C++基础知识:类的静态成员
1.普通成员变量通过对象名能够访问public成员变量每个对象都可以有只属于自己的成员变量成员变量不能在对象之间共享 2.从命名空间的角度:类的静态成员只是类这个命名空间中的全局变量和全局函数不同之处 ...
- FPGA构造spi时序——AD7176为例(转)
reference:https://blog.csdn.net/fzhykx/article/details/79490330 项目中用到了一种常见的低速接口(spi),于是整理了一下关于spi相关的 ...
- Log4j 日志记录
关于Log4j的简单示例 <!--手动配置log4j.properties文件内容:-->1 #level:debug/info/warn/error log4j.rootLogger=O ...
- capjoint中的tel3核心代码teleseis3.f90
为了加入更多层的模型 将 teleseis3.f90 /home/capjoint-master/src/tel3/teleseis3.90的地层模型读取部分改为: program test PARA ...
- 强化学习3-蒙特卡罗MC
之前讲到强化学习可以用马尔科夫决策过程来描述,通常情况下,马尔科夫需要知道 {S A P R γ},γ是衰减因子,那为什么还需要蒙特卡罗呢? 首先什么是蒙特卡罗? 蒙特卡罗实际上是一座赌城的名字,蒙 ...
- pytest的执行规则和顺序
用例运行级别 模块级(setup_module/teardown_module)开始于模块始末,全局的 函数级(setup_function/teardown_function)只对函数用例生效(不在 ...
- 20165214 实验三 敏捷开发与XP实践
一.实验报告封面 课程:Java程序设计 班级:1652班 姓名:朱文远 学号:20165214 指导教师:娄嘉鹏 实验日期:2018年4月28日 实验时间:15:35 - 17:15 实验序号:三 ...