Technical Blog | 技術博客

易,窮則變,變則通,通則久。是以自天佑之,吉無不利。

[Original] How to expand Linux hard disk (LVM Disk)

Introduction

When we reinstall the Linux system, we need to partition. You may be from [Original] Network one-click Reinstall CentOS 7 (Official, Pure, Safe, Efficient).
LVM (Logical Volume Manager), which provides a higher level of disk storage management capabilities for hosts. LVM helps system administrators easily allocate storage space for applications and users.

let’s start

1. Enter disk management
(Please note that your disk is vda or sda, I will use vda to demonstrate how to partition)
fdisk /dev/vda

2. Press the keyboard [n] in sequence to divide the remaining space.
Next enter the keyboard [p], indicating that we want to create a primary partition.
Next enter the keyboard [3], indicating that we want to create vda3.
The default value is taken twice in succession, so that all remaining space can be divided.

3. Next press the keyboard [t] to indicate that we want to modify the partition format.
Next enter the serial number 3, indicating that we want to modify the vda3 space.
Next enter the serial number 8e, indicating that we want to modify to the LVM partition format.
Next press the keyboard [w] to save the changes to the partition table.
(ignoring the notification that the device is busy)

4. Assign the remaining free disk space to the /root partition
partprobe
pvcreate /dev/vda3
vgextend centos /dev/vda3

5. View the LVM size that can be divided into /root partitions.
vgdisplay
[Assignable LVM Space] is the value obtained by multiplying the value of [Free PE / Size] by 4MB, and the size is MB.

6. Assign to / root partition by size.
lvextend -L +[Assignable LVM Space]MB /dev/mapper/centos-root
resize2fs -p /dev/mapper/centos-root
df -h

You have completed the disk expansion

[Technical Blog | Technology Blog] Telegram exchange channel: https://t.me/me_share (TG discussion group please pay attention to TG channel top message)

This article was posted on the [CXT] Technical Blog | 技術博客, if you need to forward the share, please indicate the source.

[Original] How to expand Linux hard disk (LVM Disk)

点赞