lvm extend vg_centos-lv_root 大小
遇到的問題:在建立表空間時候發現/u01下的空間不夠用,df -h 之後發現根目錄下空間不足50G,使用率99%,而/home目錄下卻又3.2T使用率不足1%,故而把/home目錄下多餘空間重新劃分到/root下
一、目的
在使用CentOS6.3版本linux系統的時候,發現根目錄(/)的空間不是很充足,而其他目錄空間有很大的空閒,所以本文主要是針對現在已有的空間進行調整。首先,先來檢視一下系統的空間分配情況:
- [root@CentOS-78 /]# df -h
- Filesystem Size Used Avail Use% Mounted on
- /dev/mapper/vg_centos-lv_root
- 50G 14G 34G 30% /
- tmpfs 1.9G 0 1.9G 0% /dev/shm
- /dev/sda1 485M 37M 423M 8% /boot
- /dev/mapper/vg_centos-lv_home
- 404G 670M 382G 1% /home
二、詳細步驟
1、解除安裝vg_centos-lv_home分割槽
- [root@CentOS-78 /]# umount /home
- [root@CentOS-78 /]# df -h
- Filesystem Size Used Avail Use% Mounted on
- /dev/mapper/vg_centos-lv_root
- 50G 14G 34G 30% /
- tmpfs 1.9G 0 1.9G 0% /dev/shm
- /dev/sda1 485M 37M 423M 8% /boot
2、從新設定vg_home-lv_home的大小
- [root@CentOS-78 /]# resize2fs -p /dev/mapper/vg_centos-lv_home 282G
- resize2fs 1.41.12 (17-May-2010)
- Please run 'e2fsck -f /dev/mapper/vg_centos-lv_home' first.
- [root@CentOS-78 /]# e2fsck -f /dev/mapper/vg_centos-lv_home
- e2fsck 1.41.12 (17-May-2010)
- 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/mapper/vg_centos-lv_home: 1386/26836992 files (0.9% non-contiguous), 1855856/107344896 blocks
- [root@CentOS-78 /]# resize2fs -p /dev/mapper/vg_centos-lv_home 282G
- resize2fs 1.41.12 (17-May-2010)
- Resizing the filesystem on /dev/mapper/vg_centos-lv_home to 73924608 (4k) blocks.
- Begin pass 2 (max = 43)
- Relocating blocks XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
- Begin pass 3 (max = 3276)
- Scanning inode table XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
- Begin pass 4 (max = 266)
- Updating inode references XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
- The filesystem on /dev/mapper/vg_centos-lv_home is now 73924608 blocks long.
- [root@CentOS-78 /]# mount /home
- [root@CentOS-78 /]#
- [root@CentOS-78 /]# df -h
- Filesystem Size Used Avail Use% Mounted on
- /dev/mapper/vg_centos-lv_root
- 50G 14G 34G 30% /
- tmpfs 1.9G 0 1.9G 0% /dev/shm
- /dev/sda1 485M 37M 423M 8% /boot
- /dev/mapper/vg_centos-lv_home
- 278G 663M 263G 1% /home
- [root@CentOS-78 /]#
- [root@CentOS-78 /]# lvreduce -L 282G /dev/mapper/vg_centos-lv_home
- WARNING: Reducing active and open logical volume to 282.00 GiB
- THIS MAY DESTROY YOUR DATA (filesystem etc.)
- Do you really want to reduce lv_home? [y/n]: y
- Reducing logical volume lv_home to 282.00 GiB
- Logical volume lv_home successfully resized
- [root@CentOS-78 /]#
查詢卷組的資訊:
- [root@CentOS-78 /]# vgdisplay
- --- Volume group ---
- VG Name vg_centos
- System ID
- Format lvm2
- Metadata Areas 1
- Metadata Sequence No 5
- VG Access read/write
- VG Status resizable
- MAX LV 0
- Cur LV 3
- Open LV 3
- Max PV 0
- Cur PV 1
- Act PV 1
- VG Size 465.27 GiB
- PE Size 4.00 MiB
- Total PE 119109
- Alloc PE / Size 86472 / 337.78 GiB
- Free PE / Size 32637 / 127.49 GiB
- VG UUID 1k4ooN-RFV9-uyf1-uMYf-aERG-YaGs-ZNoSD6
Free PE / Size指定的應該是現在可在分配的空間。
將可用的空間新增到vg_centos-lv_root分割槽上面:
- [root@CentOS-78 /]# lvextend -L +127.40G /dev/mapper/vg_centos-lv_root
- Rounding up size to full physical extent 127.40 GiB
- Extending logical volume lv_root to 177.40 GiB
- Logical volume lv_root successfully resized
- [root@CentOS-78 /]#
- [root@CentOS-78 /]# resize2fs -p /dev/mapper/vg_centos-lv_root
- resize2fs 1.41.12 (17-May-2010)
- Filesystem at /dev/mapper/vg_centos-lv_root is mounted on /; on-line resizing required
- old desc_blocks = 4, new_desc_blocks = 12
- Performing an on-line resize of /dev/mapper/vg_centos-lv_root to 46504960 (4k) blocks.
- The filesystem on /dev/mapper/vg_centos-lv_root is now 46504960 blocks long.
- [root@CentOS-78 /]# df -h
- Filesystem Size Used Avail Use% Mounted on
- /dev/mapper/vg_centos-lv_root
- 175G 14G 153G 9% /
- tmpfs 1.9G 0 1.9G 0% /dev/shm
- /dev/sda1 485M 37M 423M 8% /boot
- /dev/mapper/vg_centos-lv_home
- 278G 663M 263G 1% /home
三、所遇到的問題
1、在解除安裝/home目錄的時候失敗
可先執行如下fuser命令,然後再umount即可:
- [root@CentOS-78 /]# fuser -m /home
- [root@CentOS-78 /]#
3、在設定lv_root的大小時,不要把Free PE / Size的空間全部都用上,這很可能會出現Free PE空間不足的現象,建議保留一點Free PE的空間。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29952014/viewspace-2120452/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- LVM管理之減少LV的大小LVM
- lvm 線上擴充 / 目錄的大小LVM
- 使用LVM擴充Linux邏輯卷大小LVMLinux
- $.extend()和$.fn.extend()區別
- $.extend()和$.fn.extend()函式用法函式
- jquery.fn.extend與jquery.extendjQuery
- SCSS @extendCSS
- 理解jquery的$.extend()、$.fn和$.fn.extend()jQuery
- jQuery.extend()jQuery
- jQuery.extend和jQuery.fn.extend的區別jQuery
- jquery的$.extend和$.fn.extend作用及區別jQuery
- jQuery - 函式 $.extend 和 $.fn.extend 的說明jQuery函式
- jQuery外掛開發中$.extend和$.fn.extend辨析jQuery
- 理解jquery的$.extend()jQuery
- jQuery.fn.extend()jQuery
- jquery 擴充套件方法($.fn.extend/$.extend) 自定義外掛 拖拽jQuery套件
- LVMLVM
- Chunk Extend and OverlappingAPP
- Chunk extend OverlappingAPP
- Sass中的mixin,function,extendFunction
- jquery中extend的實現jQuery
- LVM : 快照LVM
- LVM管理LVM
- 增加LVMLVM
- implementation 'com.guo.android_extend:android-extend:1.0.6'失敗解決方法Android
- sass的mixin,extend,placeholder,functionFunction
- jQuery原始碼學習之extendjQuery原始碼
- How to Diagnose and Resolve UNABLE TO EXTEND ErrorsError
- The Extend Concept css-tricks.comCSS
- less @import and extend及mixin詳解Import
- LVM : 簡介LVM
- LVM磁碟管理LVM
- lvm的使用LVM
- LVM管理操作LVM
- aix lvm 管理AILVM
- LVM日常使用LVM
- Linux LVMLinuxLVM
- lvm實戰LVM