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的更多相关文章

  1. 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 ...

  2. 1-16-1 LVM管理和ssm存储管理器使用&磁盘配额

    大纲: 1-1- LVM逻辑卷的管理 1-2- SSM管理工具的使用 1-3- 磁盘配额技巧 ====================================== 问题描述: 当我们需要在一个 ...

  3. 【转载】Linux磁盘管理:LVM逻辑卷管理

    Linux学习之CentOS(二十五)--Linux磁盘管理:LVM逻辑卷基本概念及LVM的工作原理 这篇随笔将详细讲解Linux磁盘管理机制中的LVM逻辑卷的基本概念以及LVM的工作原理!!! 一. ...

  4. Linux LVM学习总结——创建卷组VG

    在Linux平台如何创建一个卷组(VG)呢?下面简单介绍一下卷组(VG)的创建步骤.本文实验平台为Red Hat Enterprise Linux Server release 6.6 (Santia ...

  5. lvm的vg扩容

    本次扩容的目的是要扩展 / 的整体容量,具体操作如下: 1.首先查看是否存在未分配的磁盘 [root@NH-Test-44 ~]# fdisk -l Disk /dev/vda: 53.7 GB, 5 ...

  6. 修复lvm的逻辑卷

    一.背景 公司传统的服务器不知道什么朝代的朝臣用lvm分区,1T的硬盘分了50G挂载到根目录"/"里面有/var./usr--,剩下的挂载到了"/home"目录 ...

  7. LVM扩展学习日志

    lvm是逻辑卷管理的简称,它将一个或多个物理硬盘分区(PV)组成一个逻辑硬盘(VG)来使用,  然后从这个VG中划分出逻辑分区(LV), 以上概念是我理解的东西,可能和书上的不一样. 以下所有命令都是 ...

  8. LVM 镜像硬盘更换、数据恢复(centos7.4 redhat7.5)

      案例说明 Centos7 VG:vg LV:vg-lvRedhat 7.5VG:vgtest LV:lvtest 目的:模拟硬盘 /dev/sdb损坏.在线添加新硬盘/dev/sdc,lv镜像数据 ...

  9. linux中LVM介绍及实验过程

    LVM LVM这个词不仅一次出现过,在安装Centos时,磁盘分区时,默认分区就是使用LVM方式分区:再一个就是在OpenStack部署时候用到LVM作为后端存储.对LVM的理解还是不太清晰,查询资料 ...

随机推荐

  1. 八、启动linux内核并修改开机logo

    1. 编译并烧写linux内核 1)先准备好内核源码包urbetter-linux2.6.28-v1.0.tgz,输入命令:tar -zxvf urbetter-linux2.6.28-v1.0.tg ...

  2. Linux下Ganglia集群监控安装、配置笔记

    http://www.blogjava.net/henry14/archive/2011/12/17/ganglia.html 枪声依旧 Linux下Ganglia集群监控安装.配置笔记 Gangli ...

  3. Vue.js与WdatePicker日历控件冲突问题的解决方案

    问题:同时使用Vue.js与WdatePicker时,双向绑定的日期字段获取不到界面输入的值,而且别的字段的值改变后,日期控件的内容会被清空 原因:WdatePicker不是Vue的插件,不能响应Vu ...

  4. springboot (spring mvc)集成swagger

    最近用springboot构建rest接口,考虑到最方便的验证接口,想到了引入swagger. 基本的步骤大致如下: 1.pom中引入swagger依赖: <dependency> < ...

  5. python day09作业

  6. 训练 の Bessie的体重问题

    Bessie的体重问题 题目描述 Bessie像她的诸多姊妹一样,因为从Farmer John的草地吃了太多美味的草而长出了太多的赘肉.所以FJ将她置于一个及其严格的节食计划之中.她每天不能吃多过H ...

  7. Spring Batch框架流程的简单介绍

    Spring Batch流程介绍: 上图描绘了Spring Batch的执行过程.说明如下: 每个Batch都会包含一个Job.Job就像一个容器,这个容器里装了若干Step,Batch中实际干活的也 ...

  8. 如何让你的 React Native 应用在键盘弹出时优雅地响应

    原文地址:How to make your React Native app respond gracefully when the keyboard pops up 原文作者:Spencer Car ...

  9. 支付宝异步通知(notify_url)与return_url.

    支付宝接口使用文档说明 支付宝异步通知(notify_url)与return_url. 现支付宝的通知有两类. A服务器通知,对应的参数为notify_url,支付宝通知使用POST方式 B页面跳转通 ...

  10. 2.15 富文本(richtext)

    2.15 富文本(richtext) 前言     富文本编辑框是做web自动化最常见的场景,有很多小伙伴不知从何下手,本篇以博客园的编辑器为例,解决如何定位富文本,输入文本内容一.加载配置    1 ...