LVM删除、合并LV,resize2fs调整文件系统大小

由于需要分区大小超过2T,但是安装系统时实现不了(至少我没成功),所以只好安装完系统再合并LV了。

[root@qing mapper]# vgdisplay
  --- Volume group ---
  VG Name               VolGroup00
  System ID            
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                4
  Open LV               4
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               2.73 TB   //整个VG的大小
  PE Size               32.00 MB
  Total PE              89372
  Alloc PE / Size       89372 / 2.73 TB
  Free  PE / Size       0 / 0  
  VG UUID               5vk5sU-JVdc-Zem7-Y3WK-rbXm-JDmM-mC4ubD
  
[root@qing mapper]# df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      50786940   3110496  45055004   7% /
/dev/mapper/VolGroup00-LogVol02
                     2080233392    202912 1972656300   1% /xen_disks
/dev/mapper/VolGroup00-LogVol03       //要删除03,然后将空间加到02中
                     673308208    201936 638352532   1% /local
/dev/sda1                93307     14090     74400  16% /boot
tmpfs                  8012888         0   8012888   0% /dev/shm
none                   8012888       104   8012784   1% /var/lib/xenstored


[root@qing mapper]# umount /local
[root@qing mapper]# lvremove /dev/mapper/VolGroup00-LogVol03
Do you really want to remove active logical volume LogVol03? [y/n]: y
  Logical volume "LogVol03" successfully removed
[root@qing mapper]# vgdisplay

  --- Volume group ---
  VG Name               VolGroup00
  System ID            
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  6
  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               2.73 TB
  PE Size               32.00 MB
  Total PE              89372
  Alloc PE / Size       68160 / 2.08 TB
  Free  PE / Size       21212 / 662.88 GB     //删除03后剩余的PE和空间
  VG UUID               5vk5sU-JVdc-Zem7-Y3WK-rbXm-JDmM-mC4ubD
  

[root@qing mapper]# lvextend -l +21212 /dev/mapper/VolGroup00-LogVol02    //把剩余空间分配给VG02
  Extending logical volume LogVol02 to 2.65 TB
  Logical volume LogVol02 successfully resized

[root@qing mapper]# umount /xen_disks

[root@qing mapper]# e2fsck -f /dev/mapper/VolGroup00-LogVol02    //调整大小前要做的步骤
e2fsck 1.39 (29-May-2006)
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/VolGroup00-LogVol02: 11/536870912 files (9.1% non-contiguous), 16863292/536870912 blocks

[root@qing mapper]# resize2fs /dev/mapper/VolGroup00-LogVol02
resize2fs 1.39 (29-May-2006)
Resizing the filesystem on /dev/mapper/VolGroup00-LogVol02 to 710639616 (4k) blocks.
The filesystem on /dev/mapper/VolGroup00-LogVol02 is now 710639616 blocks long.

重新mount,修改/etc/fstab中关于VG03的部分。

到此结束。

本人对于LVM了解不多,如有错误请指正。

你可能感兴趣的:(lvm,合并lv,resize文件系统)