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

VMware+centos7.3 expands lvm capacity

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

Share

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

Configuration environment: VMware+centos7.3.

The initial allocation of disk size is not enough and additional space is needed. Lvm is a very practical solution. The above picture (from A Ming) is a diagram of lvm composition. Physical volume > volume group > logical volume. When there is not enough space for this logical volume, it can be expanded by other surplus logical volume. If there is no extra logical volume, you can repartition from a new disk. Of course, virtual machines can rudely increase disk space directly, which is not discussed. Here are the steps:

Create a new lvm disk environment

2.fdisk partition, all changed ID to 8e, this disk is divided into 1 primary partition, 1 logical partition. (you can partition yourself according to the actual situation.)

Fdisk / dev/sdb start Partition

N New Partition

P format primary partition

+ 5G sector default, size 5G

T change ID to 8e

The rest of the partition operation is similar.

P check the partition situation

W Save exit

3.pvcreate / dev/sdb1 and pvcreate / dev/sdb5 create physical volume

4. Pvs displays physical volume details

5.vgcreate vg1 / dev/sdb1 / dev/sdb5 synthesizes sdb1+sdb5 into volume group

6.vgs displays volume group details

7.lvcreate-L 1000m-n lv1 vg1 creates a 1000m logical volume

8.mkfs.ext4 / dev/vg1/lv1 formats lv1 to ext4 format, or to xfs (the default format for centos7.3), but xfs does not support capacity reduction. It is recommended to use ext4.

9.mount / dev/vg1/lv1 / mnt mount lv1 to / mnt (you can also mount it to the partition you want)

Df-h display disk mount

10. If you add auto-mount to / etc/fstab, there may be a restart error. You need to enter the root password (the box in the screenshot is a Chinese character that cannot be displayed), vi / etc/fstab, comment out the auto-mount parameters and restart.

11. After a long period of normal use, there is not enough lv1 space, so you need to expand the capacity. Uninstall unomnt / mnt first.

12.lvresize-L 4000m / dev/vg1/lv1 rewrite the lv1 space to 4000m, because the previous vg1 has a total of 10G, so it is no problem to expand to 4G.

E2fsck-f / dev/vg1/lv1 check for disk errors

Resize2fs / dev/vg1/lv1 updates logical volume information

Re-mount use

After mounting, lv1 has become 4G.

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