LVM (expansion and reduction of EXT4+XFS)

Source: Internet
Author: User

4.10/4.11/4.12 LVM Explanation
Introduction to LVM
LVM is a shorthand for Logical Volume Manager (Logical Volume management), which is implemented by Heinz Mauelshagen on the Linux 2.4 kernel. LVM sets the partitions of one or more hard disks logically together. The equivalent of a large hard disk to use, when the hard disk space is not used, you can continue to add other hard disk partition, which can achieve dynamic management of disk space, compared to ordinary disk partitions have great flexibility.
LVM provides a higher level of disk storage for computers than traditional disks and partitions. It makes it easier for system administrators to allocate storage space for applications and users. Storage volumes under LVM management can be resized and removed at any time as needed (the file system tools may need to be upgraded). LVM also allows storage volumes to be managed by user groups, allowing administrators to identify storage volumes with more intuitive names (such as ' Sales ', ' development ') instead of physical disk names (such as ' SDA ', ' SDB ')

Create partitions and modify ID type 83 to 8e,system type Linxu LVM

To install a physical volume group

Yum provides "/*/pvcreate"  #如果不知道安装包名, you can use this command, according to pvcreate find installation package yum install-y lvm2
#安装
pvcreate/dev/sdb1 # will prompt XFS to sign

Pvdisplay #安装完以后查看物理卷组

PVs #也可以查看物理卷

PVREMOVE/DEV/SDB3 #删除物理卷

Create Volume group after physical volume is created

Vgcreate vg1/dev/sdb1 dev/sdb2 dev/sdb3
vgdisplay  #列出物理卷组

VGS #列出物理卷组
vgremove vg1 #删除物理卷组

Create a volume group and then create a logical volume

Lvcreate-l 200m-n lv1 vg1 #指定200M大小. Name Lv1. Create Lvremove/dev/vg1/lv1 from VG1 volume group       #删除逻辑卷

Mkfs.ext4/dev/vg1/lv1      #格式化
mount/dev/vg1/lv1/mnt/   #格式化完成以后挂载到/mnt/

DF is viewed as the/DEV/MAPPER/VG1-LV1 directory, while the/DEV/VG1/LV1 directory is mounted. is actually pointing to the same location.

Expansion of the logical volume, the expansion before the need to unmount, expansion does not affect the contents of the disk before expansion

Lvresize-l 300m/dev/vg1/lv1 #重新设定大小
e2fsck-f/dev/vg1/lv1 #检查磁盘错误 (for ext4 execution)
RESIZE2FS/DEV/VG1/LV1 # Update Logical Volume information (for EXT4 execution)

Reduced logical volume, XFS not supported, reduced before unmount

E2fsck-f/dev/vg1/lv1 #检查磁盘错误 (for ext4 execution)
resize2fs/dev/vg1/lv1 100M #更新逻辑卷信息 (for ext4 execution)
lvresize-l 100m/dev/ Vg1/lv1 #重新设定大小

XFS expansion, XFS can not uninstall Unmount

Mkfs.xfs-f/dev/vg1/lv1 #重新格式化成xfs
Mount  /dev/vg1/lv1/mnt
lvs #查看大小
lvresize-l 400m/dev/vg1/lv1 # Reset size
xfs_growfs  /dev/vg1/lv1 #xfs文件系统需要执行, you need to mount the
df-h first #扩容成功

Expand Volume Group

Fdisk/dev/sdb #新增/DEV/SDB5 (logical partition 8e) 2G
pvcerate/dev/sdb5 #创建物理卷sdb5
vgextend vg1/dev/sdb5  # Add the physical volume SDB5 to the VG1 volume group
lvresize-l 100M/DEV/VG1/LV1 #扩容逻辑卷大小

4.13 Disk Failure Small case

The power-on display garbled, here is the prompt to enter the root password
The reason is that there is a problem with the disk mount
Vi/etc/fstab configuration added a row to delete it directly

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.