PnetLab storage is insufficient? Teach you how to expand it step by step

PnetLab storage is insufficient? Teach you how to expand it step by step

When using PnetLab to build a network experiment environment, as the number of virtual devices increases and the scale of the experiment expands, the storage space may gradually become insufficient. This article will introduce how to expand the storage capacity of PnetLab through LVM (Logical Volume Manager) to meet the growing needs.

Expansion ideas

Adding a new physical volume

Since I deployed PnetLab on Proxmox Virtual Environment (PVE) before, we can directly operate the virtual machine in PVE to expand the disk capacity for PnetLab. As shown in the figure below, through the management interface of PVE, you can easily add a new virtual disk and perform subsequent expansion operations.

Then a prompt box will pop up as shown below. Fill in the capacity you want to expand according to your needs:

After adding successfully, log in to the pnetlab virtual machine and check that the hard disk capacity has increased, as shown below:

Add a new physical volume (PV)

Since PnetLab uses the LVM mode, as shown in the figure below, we can easily expand the disk capacity through LVM.

Next, we create a new partition for the expanded capacity and execute the following command:

 fdisk /dev/sda

After executing the above command, follow the prompts, as shown below:

Finally, create a PV from the new partition by executing the following command:

 pvcreate /dev/sda4

After the creation is complete, view it through pvdisplay, as shown below:

Expanding Volume Group (VG)

Add the new physical volume to the existing volume group. Before expanding, use vgdisply to view the existing vg groups in the current system, as shown below:

Then, expand it with the following command:

 vgextend ubuntu-vg /dev/sda4

After successful execution, the following prompt will appear:

 root@pnetlab:~# vgextend ubuntu-vg /dev/sda4 Volume group "ubuntu-vg" successfully extended

Check the PV status again as shown in the following figure:

Extending the Logical Volume (LV)

First, confirm the name of the logical volume to be expanded. You can use the lvdisplay command to view the LVs that exist in the current system, as shown in the following figure:

Next, execute the following command to expand the LV:

 lvextend -L +49G /dev/ubuntu-vg/ubuntu-lv

After successful execution, the following prompt will appear:

 root@pnetlab:~# lvextend -L +49G /dev/ubuntu-vg/ubuntu-lv Size of logical volume ubuntu-vg/ubuntu-lv changed from <38.00 GiB (9727 extents) to <87.00 GiB (22271 extents). Logical volume ubuntu-vg/ubuntu-lv successfully resized.

Use the vgdisply command to view the specific information of the current vg, as shown in the following figure:

Expanding the file system

Use different commands to expand the file system according to the file system type. Common file systems include ext4 and xfs.

ext4 file system:

 resize2fs /dev/vg0/lv_data

xfs file system:

 xfs_growfs /dev/vg0/lv_data

Since pnetlab uses the ext4 file system, execute the following command to expand the file system:

 resize2fs /dev/ubuntu-vg/ubuntu-lv

Verify the results

Use lvdisplay to check whether the expansion is successful. As shown below:

Summarize

Through the above steps, you have successfully used LVM to expand the storage capacity of PnetLab. In the actual operation process, you may encounter some specific problems. Please make corresponding adjustments according to the error prompts. LVM provides flexible and powerful storage management capabilities and is an ideal choice for handling storage expansion needs.

<<:  Multicast Protocol: The "Group Chat Master" of the Internet World

>>:  Pnetlab practical exercise: teach you step by step how to log in to the firewall securely through SSH!

Recommend

Cool Knowledge: Learn about RF Antennas in One Article

RF Antenna picture An antenna is a device used to...

Four leading geese: the starting point for large-scale commercial use of 5G to B

Suddenly, 5G has truly come into our lives. With ...

Omdia: Global Gigabit Broadband Users to Reach 50 Million by 2022

According to the latest report released by market...

Is the WiFi6 network upgrade in your new or old home so great?

At the beginning of the new year, many friends be...

5 Common SD-WAN Challenges and How to Address Them

Software-defined WAN is a feature-rich technology...

Explore VLAN aggregation: How to optimize your network performance

VLAN technology is widely used in campus networks...

Goodbye 2G, hello 5G

[[403376]] This article is reprinted from the WeC...