热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

linux在线扩容磁盘,Linux在线硬盘扩容的几种解决办法

贴一篇自己写的Linux在线硬盘扩容的几种解决办法,算是经验总结吧。注:转帖请注明出处!Ifdiskspacenotenoughissue

贴一篇自己写的Linux在线硬盘扩容的几种解决办法,算是经验总结吧。  注:转帖请注明出处!

If disk space not enough issue can't be fixed by deleted unused or unnecessary temp files. We could use resize2fs command to extend the disk space on line, will not infect the system.

I neatened a guide in details about how to extend the disk space on line including the normal situation and abnormal status here.

resize2fs - ext2/ext3/ext4 file system resize, listed on different RHEL system, the according command. Ps. Should use root account do the admin operation.

On RHEL6 # e.g. /sbin/resize2fs/dev/vg00/lvol9

On RHEL5 # e.g. /sbin/resize3fs/dev/vg00/lvol9

On RHEL4 # e.g. /sbin/ext2online/dev/vg00/lvol9

The resize2fs program will resize ext2, ext3, or ext4 file systems. It can be used to enlarge or shrink an un-mounted file system located on device.

If the file system is mounted, it can be used to expand the size of the mounted file system, assuming the kernel supports on-line resizing. (As of

this writing, the Linux 2.6 kernel supports on-line resize for file-systems mounted using ext3 only). Using the command to check the kernel version

# uname -r

2.6.32-71.el6.x86_64

Normal Situation

1. Extended the disk space on line:

# /sbin/tune2fs -l /dev/mapper/vg00-lvol9 //To check how much space we can extend.

# /usr/sbin/vgdisplay //To check whether it can be extended or not.

Free PE / Size 30354 / 118.57 GiB

# df -h /opt //To check where it will be extended

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/vg00-lvol9

50G 0G 50G 100% /opt

# /usr/sbin/lvextend -L+5G /dev/mapper/vg00-lvol9 //Extend on line.

# /sbin/resize2fs /dev/vg00/lvol9 //To take it into effect

Abnormal Situation

1. Situation when device is busy

# fuser -m /opt //identify processes using files or sockets

/opt: 1244c 2721c 16747c 19635c

# kill -9 1244 2721 16747 19635 //kill all the processes.

# umount /opt //umount the directory

# /sbin/resize2fs /dev/vg00/lvol9

resize2fs 1.35 (28-Feb-2004)

Please run 'e2fsck -f /dev/vg00/lvol9' first.

# e2fsck -f /dev/vg00/lvol9 //To check ext2|ext3|ext4 file system correctness!

e2fsck 1.35 (28-Feb-2004)

Pass 1: Checking inodes, blocks, and sizes

Pass 2: Checking directory structure

Pass 3: Checking directory connectivity

Pass 4: Checking reference counts

Pass 5: Checking group summary information

/dev/vg00/lvol9: 1406312/6553600 files (2.8% non-contiguous), 12277130/13107200 blocks

# /sbin/resize2fs /dev/vg00/lvol9

resize2fs 1.35 (28-Feb-2004)

Resizing the filesystem on /dev/vg00/lvol9 to 14417920 (4k) blocks.

The filesystem on /dev/vg00/lvol9 is now 14417920 blocks long.

# mount /opt

# df -h /opt

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/vg00-lvol9

55G 47G 5.4G 90% /opt

2. Situation when volume group mapper doesn't exist…

# /usr/sbin/lvextend -L+5G /dev/mapper/vg00-lvol9

Volume group mapper doesn't exist

# /usr/sbin/lvextend -L+5G /dev/vg00/lvol9

3. Situation when iNode of '/' directory is full…

# df -ih//To check the iNode usage touched 100% or not. If it is. Extended / directory first, after that then adding others disk space.



推荐阅读
  • 在Docker中,将主机目录挂载到容器中作为volume使用时,常常会遇到文件权限问题。这是因为容器内外的UID不同所导致的。本文介绍了解决这个问题的方法,包括使用gosu和suexec工具以及在Dockerfile中配置volume的权限。通过这些方法,可以避免在使用Docker时出现无写权限的情况。 ... [详细]
  • 本文介绍了设计师伊振华受邀参与沈阳市智慧城市运行管理中心项目的整体设计,并以数字赋能和创新驱动高质量发展的理念,建设了集成、智慧、高效的一体化城市综合管理平台,促进了城市的数字化转型。该中心被称为当代城市的智能心脏,为沈阳市的智慧城市建设做出了重要贡献。 ... [详细]
  • Commit1ced2a7433ea8937a1b260ea65d708f32ca7c95eintroduceda+Clonetraitboundtom ... [详细]
  • Metasploit攻击渗透实践
    本文介绍了Metasploit攻击渗透实践的内容和要求,包括主动攻击、针对浏览器和客户端的攻击,以及成功应用辅助模块的实践过程。其中涉及使用Hydra在不知道密码的情况下攻击metsploit2靶机获取密码,以及攻击浏览器中的tomcat服务的具体步骤。同时还讲解了爆破密码的方法和设置攻击目标主机的相关参数。 ... [详细]
  • Spring特性实现接口多类的动态调用详解
    本文详细介绍了如何使用Spring特性实现接口多类的动态调用。通过对Spring IoC容器的基础类BeanFactory和ApplicationContext的介绍,以及getBeansOfType方法的应用,解决了在实际工作中遇到的接口及多个实现类的问题。同时,文章还提到了SPI使用的不便之处,并介绍了借助ApplicationContext实现需求的方法。阅读本文,你将了解到Spring特性的实现原理和实际应用方式。 ... [详细]
  • 本文详细介绍了Linux中进程控制块PCBtask_struct结构体的结构和作用,包括进程状态、进程号、待处理信号、进程地址空间、调度标志、锁深度、基本时间片、调度策略以及内存管理信息等方面的内容。阅读本文可以更加深入地了解Linux进程管理的原理和机制。 ... [详细]
  • Linux磁盘的分区、格式化的观察和操作步骤
    本文介绍了如何观察Linux磁盘的分区状态,使用lsblk命令列出系统上的所有磁盘列表,并解释了列表中各个字段的含义。同时,还介绍了使用parted命令列出磁盘的分区表类型和分区信息的方法。在进行磁盘分区操作时,根据分区表类型选择使用fdisk或gdisk命令,并提供了具体的分区步骤。通过本文,读者可以了解到Linux磁盘分区和格式化的基本知识和操作步骤。 ... [详细]
  • 自动轮播,反转播放的ViewPagerAdapter的使用方法和效果展示
    本文介绍了如何使用自动轮播、反转播放的ViewPagerAdapter,并展示了其效果。该ViewPagerAdapter支持无限循环、触摸暂停、切换缩放等功能。同时提供了使用GIF.gif的示例和github地址。通过LoopFragmentPagerAdapter类的getActualCount、getActualItem和getActualPagerTitle方法可以实现自定义的循环效果和标题展示。 ... [详细]
  • 本文介绍了三种方法来实现在Win7系统中显示桌面的快捷方式,包括使用任务栏快速启动栏、运行命令和自己创建快捷方式的方法。具体操作步骤详细说明,并提供了保存图标的路径,方便以后使用。 ... [详细]
  • 成功安装Sabayon Linux在thinkpad X60上的经验分享
    本文分享了作者在国庆期间在thinkpad X60上成功安装Sabayon Linux的经验。通过修改CHOST和执行emerge命令,作者顺利完成了安装过程。Sabayon Linux是一个基于Gentoo Linux的发行版,可以将电脑快速转变为一个功能强大的系统。除了作为一个live DVD使用外,Sabayon Linux还可以被安装在硬盘上,方便用户使用。 ... [详细]
  • 本文讨论了clone的fork与pthread_create创建线程的不同之处。进程是一个指令执行流及其执行环境,其执行环境是一个系统资源的集合。在调用系统调用fork创建一个进程时,子进程只是完全复制父进程的资源,这样得到的子进程独立于父进程,具有良好的并发性。但是二者之间的通讯需要通过专门的通讯机制,另外通过fork创建子进程系统开销很大。因此,在某些情况下,使用clone或pthread_create创建线程可能更加高效。 ... [详细]
  • WhenIusepythontoapplythepymysqlmoduletoaddafieldtoatableinthemysqldatabase,itdo ... [详细]
  • IjustinheritedsomewebpageswhichusesMooTools.IneverusedMooTools.NowIneedtoaddsomef ... [详细]
  • 先看官方文档TheJavaTutorialshavebeenwrittenforJDK8.Examplesandpracticesdescribedinthispagedontta ... [详细]
  • JDK源码学习之HashTable(附带面试题)的学习笔记
    本文介绍了JDK源码学习之HashTable(附带面试题)的学习笔记,包括HashTable的定义、数据类型、与HashMap的关系和区别。文章提供了干货,并附带了其他相关主题的学习笔记。 ... [详细]
author-avatar
甜心菇
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有