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

贴一篇自己写的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.
<p></p><pre code_snippet_id="182965" snippet_file_name="blog_20140210_1_8231303">
 

                
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值