Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux lvm expands disk size

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Shut down the virtual machines that need to be expanded, and add disk space through the interface of managing virtual machines. Adjust 50g this time.

Note that the purpose of this write is to increase the size of the capacity, not the size of the hard disk

After the hard disk is added, you can use fdisk-l to check the disk capacity. You can see that the hard disk has increased by 50g, but since there is no partition, it is not shown below.

1. Create a partition:

> enter n, create a new partition Command (m for help): n > enter P, primary partition

At present, sda already has 2 partitions, so enter 3 this time, according to the order of some disks.

Prompt whether to use all the unallocated space, hit enter, the default is fine.

Enter t here to enter the corresponding partition number. The format of the partition specified for 3 this time is 8e 8e, which represents the lvm partition format input w. Save and exit.

2. Check the finished lvm partition:

Fdisk-l

You can see that the / dev/sda3 partition size is 50G and the disk format is lvm

3. Restart the server to make the partition effective

4. Create pv, and use the pvcreate command to create 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 View lvm Group name

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

Vgextend vg_zgate192 / dev/sda3

7. Use the command vgs to check the space of the vg_zgate192 volume group, and you can see that Vfree has a new 50G.

Use lvdisplay to check the absolute path of logical volume to expand the capacity of vg_zgate192-LogVol01 by 50g. It is found that 50g will indicate insufficient space, so add 49Glvextend-L + 50G-n / dev/mapper/vg_zgate192-LogVol01lvextend-L + 49G-n / dev/mapper/vg_zgate192-LogVol01.

8. The logical volume will not take effect immediately after it is expanded. 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 the disk partition:

Fdisk-ldf-lh

10. We can see that the expansion has been successful.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report