概念:聽說默認centos都是基於LVM的html
LVM:LVM是邏輯盤卷管理(Logical Volume Manager)的簡稱,它是Linux環境下對磁盤分區進行管理的一種機制.node
LVM 更加詳細的說明可點這裏:http://www.cnblogs.com/mchina/p/linux-centos-logical-volume-manager-lvm.htmllinux
fdisk 命令用法http://blog.sina.com.cn/s/blog_66b448620100ibay.htmlcentos
查看磁盤空間,根目錄過小了,但願增長磁盤app
在vsphere上修改磁盤的大小,重啓進來。ide
[root@ucx-auto ~]# df -lh Filesystem Size Used Avail Use% Mounted on /dev/mapper/centos-root 30G 23G 7.1G 76% / devtmpfs 5.8G 0 5.8G 0% /dev tmpfs 5.8G 0 5.8G 0% /dev/shm tmpfs 5.8G 8.9M 5.8G 1% /run tmpfs 5.8G 0 5.8G 0% /sys/fs/cgroup /dev/sda1 497M 155M 343M 32% /boot tmpfs 1.2G 0 1.2G 0% /run/user/0
1、查看下LVorm
[root@ucx-auto ~]# lvdisplay --- Logical volume --- LV Path /dev/centos/swap LV Name swap VG Name centos LV UUID trGefC-4mxg-BkS6-sywT-ie3O-deA3-WC0EDQ LV Write Access read/write LV Creation host, time localhost, 2016-07-26 17:38:31 +0800 LV Status available # open 2 LV Size 2.02 GiB Current LE 516 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:0 --- Logical volume --- LV Path /dev/centos/root LV Name root VG Name centos LV UUID MRmrQV-MDKZ-ZJbQ-cvDP-nMEY-hWJk-xFCceo LV Write Access read/write LV Creation host, time localhost, 2016-07-26 17:38:31 +0800 LV Status available # open 1 LV Size 66.49 GiB Current LE 17022 Segments 2 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:1
二:查看機器所掛硬盤個數及分區狀況htm
[root@ucx-auto ~]# fdisk -l Disk /dev/sda: 75.2 GB, 75161927680 bytes, 146800640 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x000cfb48 Device Boot Start End Blocks Id System /dev/sda1 * 2048 1026047 512000 83 Linux /dev/sda2 1026048 67108863 33041408 8e Linux LVM Disk /dev/mapper/centos-swap: 2164 MB, 2164260864 bytes, 4227072 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk /dev/mapper/centos-root: 31.7 GB, 31666995200 bytes, 61849600 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes
如上 有一塊磁盤/dev/sda 有兩個分區。就用了33G,說明還有未分區的blog
三:/dev/sda進行分區,作這個時候忘記截圖了 ,大概是下面這樣,若是讓你輸入分區號,順延下去便可。ip
3.換個姿式再來一次
[root@ucx-auto dev]# xfs_growfs /dev/mapper/centos-root
meta-data=/dev/mapper/centos-root isize=256 agcount=4, agsize=1932800 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0
data = bsize=4096 blocks=7731200, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal bsize=4096 blocks=3775, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 7731200 to 17430528
4.看到根目錄已經擴大了
[root@ucx-auto dev]# df -lhFilesystem Size Used Avail Use% Mounted on/dev/mapper/centos-root 67G 23G 45G 34% /devtmpfs 5.8G 0 5.8G 0% /devtmpfs 5.8G 0 5.8G 0% /dev/shmtmpfs 5.8G 8.9M 5.8G 1% /runtmpfs 5.8G 0 5.8G 0% /sys/fs/cgroup/dev/sda1 497M 155M 343M 32% /boottmpfs 1.2G 0 1.2G 0% /run/user/0