Linux LVM expansion Disk size

Source: Internet
Author: User

Turn off virtual machines that need to be scaled up and add disk space by managing the virtual machine interface, this time adjusting 50G

Note that this write increases the size of the capacity and does not increase the size of the hard disk

After the hard drive is added, you can see the size of the disk with Fdisk-l, and the hard drive is increased by 50G, but it is not shown below because there is no partition.

1. Create a partition:

> 输入n,新建分区Command (m for help): n> 输入P,主分区

Currently SDA already has 2 partitions, so this time input 3, according to the order of the disk to
Tip whether to use all unallocated space, hit enter, the default is OK

输入t此处需要输入和之前对应的分区号,本次为3指定分区的格式为8e  8e代表了lvm分区格式输入w,保存退出

2. View the LVM partitions that are well done:

fdisk -l

You can see that the added/dev/sda3 partition size is 50G disk format for LVM

3. Restart the server for the partition to take effect

4, create PV, through the pvcreate command to create a disk/dev/sdb as a system PV

pvcreate /dev/sda3

5. Create a physical volume and add the created physical volume to the existing LVM group

pvdisplay查看lvm组名称

6. Add the created physical volume to the existing LVM group

vgextend vg_zgate192 /dev/sda3

7, the use of command VGS View vg_zgate192 Volume group space, you can see Vfree has a new 50G

用lvdisplay查看逻辑卷绝对路径给vg_zgate192-LogVol01扩容50G,发现50G会提示空间不足,故添加49Glvextend -L +50G -n /dev/mapper/vg_zgate192-LogVol01lvextend -L +49G -n /dev/mapper/vg_zgate192-LogVol01

8, the logical volume expansion will not take effect immediately, you need to use the RESIZE2FS command to reload the size of the logical volume

eg

centos6:resize2fs /dev/mapper/vg_zgate192-LogVol01   centos7:xfs_growfs  /dev/mapper/vg_zgate192-LogVol01

9. View Disk Partitions:

fdisk -ldf -lh

10, you can see the success of the expansion.

Linux LVM disk size expansion

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.