来自 localhost.localdomain 的消息: There is no more space for virtual disk ftp-000001.vmdk. You might be able to continue this session by freeing disk space on the elevant volume, and clicking _Retry. Click Cancel to terminate this session. 


esxi报错There is no more space for virtual disk--逻辑卷缩减!_第1张图片

问题:磁盘空间分配不合理。

解决方式,合理分配磁盘空间。磁盘做的逻辑卷,温习一下。

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

温习下逻辑卷:

1、物理卷创建

[root@node6 ~]# vgcreate renzhiyuan_vg /dev/sd[bcd]

  Physical volume "/dev/sdb" successfully created

  Physical volume "/dev/sdc" successfully created

  Physical volume "/dev/sdd" successfully created

  Volume group "renzhiyuan_vg" successfully created

[root@node6 ~]# pvdisplay 

  --- Physical volume ---

  PV Name               /dev/sdb

  VG Name               renzhiyuan_vg

  PV Size               1.00 GiB / not usable 4.00 MiB

  Allocatable           yes 

  PE Size               4.00 MiB

  Total PE              255

  Free PE               255

  Allocated PE          0

  PV UUID               qwEDNa-gBDf-oQXK-Rlqk-j3OS-Zh05-MKJBUZ

   

  --- Physical volume ---

  PV Name               /dev/sdc

  VG Name               renzhiyuan_vg

  PV Size               1.00 GiB / not usable 4.00 MiB

  Allocatable           yes 

  PE Size               4.00 MiB

  Total PE              255

  Free PE               255

  Allocated PE          0

  PV UUID               n1E2Ej-W4jN-5AB5-fewR-j8df-2mZt-zrb05b

   

  --- Physical volume ---

  PV Name               /dev/sdd

  VG Name               renzhiyuan_vg

  PV Size               1.00 GiB / not usable 4.00 MiB

  Allocatable           yes 

  PE Size               4.00 MiB

  Total PE              255

  Free PE               255

  Allocated PE          0

  PV UUID               GkCwJI-B7Eo-tqD2-lR95-MDh9-qeGq-szacD4

   

  --- Physical volume ---

  PV Name               /dev/sda2

  VG Name               vg_node6

  PV Size               19.51 GiB / not usable 3.00 MiB

  Allocatable           yes (but full)

  PE Size               4.00 MiB

  Total PE              4994

  Free PE               0

  Allocated PE          4994

  PV UUID               jg3eKt-8cF0-JvMa-xyge-WBW4-kzOc-6iKXa6

   

[root@node6 ~]# 

#[root@node6 ~]# pv

pvchange   pvck       pvcreate   pvdisplay  pvmove     pvremove   pvresize   pvs        pvscan     

[root@node6 ~]# pv

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

2、卷组创建

[root@node6 ~]# vgcreate renzhiyuan_vg /dev/sd[bcd]

  A volume group called renzhiyuan_vg already exists.

[root@node6 ~]# vgdisplay 

  --- Volume group ---

  VG Name               renzhiyuan_vg

  System ID             

  Format                lvm2

  Metadata Areas        3

  Metadata Sequence No  1

  VG Access             read/write

  VG Status             resizable

  MAX LV                0

  Cur LV                0

  Open LV               0

  Max PV                0

  Cur PV                3

  Act PV                3

  VG Size               2.99 GiB

  PE Size               4.00 MiB

  Total PE              765

  Alloc PE / Size       0 / 0   

  Free  PE / Size       765 / 2.99 GiB

  VG UUID               yEw1o5-XuUF-zk1Z-Jiu4-1kpo-Tsy2-Ca3d2n

   

  --- Volume group ---

  VG Name               vg_node6

  System ID             

  Format                lvm2

  Metadata Areas        1

  Metadata Sequence No  3

  VG Access             read/write

  VG Status             resizable

  MAX LV                0

  Cur LV                2

  Open LV               2

  Max PV                0

  Cur PV                1

  Act PV                1

  VG Size               19.51 GiB

  PE Size               4.00 MiB

  Total PE              4994

  Alloc PE / Size       4994 / 19.51 GiB

  Free  PE / Size       0 / 0   

  VG UUID               Mbyeih-93jl-ejwH-TV44-Pq2O-vady-QXKfz7

   

[root@node6 ~]#

[root@node6 ~]# vg

vgcfgbackup    vgck           vgdisplay      vgimport       vgmknodes      vgrename       vgsplit        

vgcfgrestore   vgconvert      vgexport       vgimportclone  vgreduce       vgs            

vgchange       vgcreate       vgextend       vgmerge        vgremove       vgscan         

[root@node6 ~]# vg

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

3、逻辑卷创建

[root@node6 ~]# lvcreate -L 2G -n renzhiyuan_lv renzhiyuan_vg

  Logical volume "renzhiyuan_lv" created

[root@node6 ~]# lvdisplay 

  --- Logical volume ---

  LV Path                /dev/renzhiyuan_vg/renzhiyuan_lv

  LV Name                renzhiyuan_lv

  VG Name                renzhiyuan_vg

  LV UUID                nW3HXj-CwOI-8lVo-B3Zo-nVKd-fNa6-1tUy3m

  LV Write Access        read/write

  LV Creation host, time node6, 2016-08-26 09:33:50 +0800

  LV Status              available

  # open                 0

  LV Size                2.00 GiB

  Current LE             512

  Segments               3

  Allocation             inherit

  Read ahead sectors     auto

  - currently set to     256

  Block device           253:2

   

  --- Logical volume ---

  LV Path                /dev/vg_node6/lv_root

  LV Name                lv_root

  VG Name                vg_node6

  LV UUID                Jgu4Y4-ZT8T-ooW6-riiH-Xt4y-Jq30-d5qyvL

  LV Write Access        read/write

  LV Creation host, time node6, 2016-04-28 09:13:33 +0800

  LV Status              available

  # open                 1

  LV Size                17.57 GiB

  Current LE             4498

  Segments               1

  Allocation             inherit

  Read ahead sectors     auto

  - currently set to     256

  Block device           253:0

   

  --- Logical volume ---

  LV Path                /dev/vg_node6/lv_swap

  LV Name                lv_swap

  VG Name                vg_node6

  LV UUID                waK7aN-5CLw-Mkkw-l1o1-BXny-q71j-vPLV5I

  LV Write Access        read/write

  LV Creation host, time node6, 2016-04-28 09:13:36 +0800

  LV Status              available

  # open                 1

  LV Size                1.94 GiB

  Current LE             496

  Segments               1

  Allocation             inherit

  Read ahead sectors     auto

  - currently set to     256

  Block device           253:1

   

[root@node6 ~]#

[root@node6 ~]# lv

lvchange     lvdisplay    lvmchange    lvmdump      lvmsar       lvrename     lvscan       

lvconvert    lvextend     lvmconf      lvmetad      lvreduce     lvresize     

lvcreate     lvm          lvmdiskscan  lvmsadc      lvremove     lvs          

[root@node6 ~]# lv

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

4、格式化逻辑卷

[root@node6 ~]# mkfs.ext4 /dev/renzhiyuan_vg/renzhiyuan_lv 

mke2fs 1.41.12 (17-May-2010)

文件系统标签=

操作系统:Linux

块大小=4096 (log=2)

分块大小=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

131072 inodes, 524288 blocks

26214 blocks (5.00%) reserved for the super user

第一个数据块=0

Maximum filesystem blocks=536870912

16 block groups

32768 blocks per group, 32768 fragments per group

8192 inodes per group

Superblock backups stored on blocks: 

32768, 98304, 163840, 229376, 294912


正在写入inode表: 完成                            

Creating journal (16384 blocks): 完成

Writing superblocks and filesystem accounting information: 完成


This filesystem will be automatically checked every 36 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.

[root@node6 ~]#


5、挂载逻辑卷

[root@node6 ~]# mount /dev/renzhiyuan_vg/renzhiyuan_lv /opt/renzhiyuan/

[root@node6 ~]# df -TH

Filesystem           Type   Size  Used Avail Use% Mounted on

/dev/mapper/vg_node6-lv_root

                     ext4    19G  1.2G   17G   7% /

tmpfs                tmpfs  515M     0  515M   0% /dev/shm

/dev/sda1            ext4   500M   27M  448M   6% /boot

/dev/mapper/renzhiyuan_vg-renzhiyuan_lv

                     ext4   2.1G  3.2M  2.0G   1% /opt/renzhiyuan

[root@node6 ~]#

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

6、缩减逻辑卷


6.1)卸载

[root@node6 ~]# umount  /opt/renzhiyuan/

[root@node6 ~]# df -TH

Filesystem           Type   Size  Used Avail Use% Mounted on

/dev/mapper/vg_node6-lv_root

                     ext4    19G  1.2G   17G   7% /

tmpfs                tmpfs  515M     0  515M   0% /dev/shm

/dev/sda1            ext4   500M   27M  448M   6% /boot

[root@node6 ~]#

6.2)强制对文件系统进行检查

[root@node6 ~]# e2fsck -f /dev/renzhiyuan_vg/renzhiyuan_lv 

e2fsck 1.41.12 (17-May-2010)

第一步: 检查inode,块,和大小

第二步: 检查目录结构

第3步: 检查目录连接性

Pass 4: Checking reference counts

第5步: 检查簇概要信息

/dev/renzhiyuan_vg/renzhiyuan_lv: 11/131072 files (0.0% non-contiguous), 25388/524288 blocks

[root@node6 ~]#

6.3)对文件系统进行缩减

[root@node6 ~]# resize2fs /dev/renzhiyuan_vg/renzhiyuan_lv 1G

resize2fs 1.41.12 (17-May-2010)

Resizing the filesystem on /dev/renzhiyuan_vg/renzhiyuan_lv to 262144 (4k) blocks.

The filesystem on /dev/renzhiyuan_vg/renzhiyuan_lv is now 262144 blocks long.

[root@node6 ~]#


6.4)对逻辑卷进行缩减

[root@node6 ~]# lvreduce -L 1G /dev/renzhiyuan_vg/renzhiyuan_lv 

  WARNING: Reducing active logical volume to 1.00 GiB

  THIS MAY DESTROY YOUR DATA (filesystem etc.)

Do you really want to reduce renzhiyuan_lv? [y/n]: y

  Size of logical volume renzhiyuan_vg/renzhiyuan_lv changed from 2.00 GiB (512 extents) to 1.00 GiB (256 extents).

  Logical volume renzhiyuan_lv successfully resized

[root@node6 ~]#

[root@node6 ~]# lvdisplay 

  --- Logical volume ---

  LV Path                /dev/renzhiyuan_vg/renzhiyuan_lv

  LV Name                renzhiyuan_lv

  VG Name                renzhiyuan_vg

  LV UUID                nW3HXj-CwOI-8lVo-B3Zo-nVKd-fNa6-1tUy3m

  LV Write Access        read/write

  LV Creation host, time node6, 2016-08-26 09:33:50 +0800

  LV Status              available

  # open                 0

  LV Size                1.00 GiB

  Current LE             256

  Segments               2

  Allocation             inherit

  Read ahead sectors     auto

  - currently set to     256

  Block device           253:2


6.5)挂载验证

[root@node6 ~]# mount /dev/renzhiyuan_vg/renzhiyuan_lv  /opt/renzhiyuan/

[root@node6 ~]# df -TH

Filesystem           Type   Size  Used Avail Use% Mounted on

/dev/mapper/vg_node6-lv_root

                     ext4    19G  1.2G   17G   7% /

tmpfs                tmpfs  515M     0  515M   0% /dev/shm

/dev/sda1            ext4   500M   27M  448M   6% /boot

/dev/mapper/renzhiyuan_vg-renzhiyuan_lv

                     ext4   990M  2.7M  934M   1% /opt/renzhiyuan

[root@node6 ~]#


完成!