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. 每天CSS学习之text-overflow

    text-overflow是CSS3的一个属性,其作用是当文本溢出包含它的元素时,应该裁剪还是将多余的字符用省略号来表示. 该属性一般和overflow:hidden属性一起使用. text-over ...

  2. Cracking The Coding Interview4.5

    //原文: // // Write an algorithm to find the 'next' node (i.e., in-order successor) of a given node in ...

  3. log4j的参数配置(转)

    转载:log4j.properties文件各参数含义与配置   以下是配置文件log4j.properties的一些属性: log4j.rootLogger=WARN, stdout, Rlog4j. ...

  4. ubuntu apache ssl配置

    参考连接: http://blog.csdn.net/sky_qing/article/details/44303221 http://blog.sina.com.cn/s/blog_6ad62438 ...

  5. L256 阅读理解

    1主旨题 2细节题 题干关键词 人名,地名,专有名词,时间,和主题相关的核心词汇,带特殊标点的词汇 干扰项 词意猜测

  6. 在 Andriod/IOS 程序中使用自定义字体

    很早就遇到这个问题,QDAC作者也在这里给出了方案.

  7. Script Encryption

    一.shc加密 加密软件shcshc是linux的一款加密脚本的插件东西比较安全我们可以利用wget将文件放在root目录下也可以通过sftp放在root目录也可以直接利用cd命令选择目录 wget ...

  8. Microsoft Project 常用快捷键

    任务升级 : ALT  +  SHIFT + 向左键 任务降级: ALT  +  SHIFT + 向右键 滚动到表头(第一个任务):Ctrl + HOME 滚动到表尾(最后一个任务):Ctrl + E ...

  9. 莫烦tensorflow(4)-placeholder

    import tensorflow as tf input1 = tf.placeholder(tf.float32)input2 = tf.placeholder(tf.float32) outpu ...

  10. 4--Selenium环境准备---chromedriver.exe 与chrome版本匹配

    0.jdk8 和eclipse 4.6 https://www.eclipse.org/downloads/packages/release/neon/3 1.selenium-server-stan ...