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. day14-python异常处理

    1.     异常 异常即是一个事件,该事件会在程序执行过程中发生,影响了程序的正常执行. 一般情况下,在Python无法正常处理程序时就会发生一个异常.异常是Python对象,表示一个错误.当Pyt ...

  2. nginx+vue刷新404

    问题原因:刷新页面时访问的资源在服务端找不到,因为vue-router设置的路径不是真实存在的路径.如上的404现象,是因为在nginx配置的根目录/Data/app/xqsj_wx/dist下面压根 ...

  3. ACID/CAP/BASE 理论知识

    ACID是事务的四大特性,想要成为事务,必须具备这四点. Atomicity 原子性体现在对于一个事务来讲,要么一起执行成功要么一起失败,执行的过程中是不能被打断或者执行其他操作的. Consiste ...

  4. synchronized(八)

    package com.bjsxt.base.sync006;/** * 同一对象属性的修改不会影响锁的情况 * @author alienware * */public class ModifyLo ...

  5. windwos7 vnc连接centos6.6

    一.先配置centos6.6的vnc(已经安装过桌面) #yum  install  fontforge -y   防止字体乱码 #yum tigervnc tigervnc-server -y   ...

  6. ChinaCock界面控件介绍-CCNavigateTitle

    先看一下实际项目中的运行效果,如图,通过品牌的导航栏,显示不同品牌的商品列表. 完全基于ChinaCock控件包中CCNavigateTitle组件实现的,这是一个可视控件,从组件面板上拖放一个到Fo ...

  7. ubuntu安装scrapy方法

    sudo apt-get install python-dev   [默认安装python2] sudo apt-get install python3-dev   [指定安装python3最新的] ...

  8. mysql随机查询记录的高效率方法

    mysql使用rand随机查询记录的高效率方法 一直以为mysql随机查询几条数据,就用 SELECT * FROM `table` ORDER BY RAND() LIMIT 5 就可以了. 但是真 ...

  9. 2017ICPC南宁赛区网络赛 Overlapping Rectangles(重叠矩阵面积和=离散化模板)

    There are nnn rectangles on the plane. The problem is to find the area of the union of these rectang ...

  10. vue 之 Virtual Dom

    什么是Virtual Dom Virtual Dom可以看做一棵模拟了DOM树的JavaScript树,其主要是通过vnode,实现一个无状态的组件,当组件状态发生更新时,然后触发Virtual Do ...