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

How to flexibly scale the size of a file system by lvm software under linux

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

Share

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

The purpose of this article is to share with you about how the lvm software under linux can flexibly scale the size of the file system. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.

We often encounter such a situation, with the operation of the system, it is found that the remaining space of a partition is insufficient, so it is necessary to expand the capacity of the partition. How can the capacity be expanded? A common strategy is

Add a new hard drive, then partition, format, and there will be a new available partition.

Copy the previous file system contents to another partition, and then unmount the original partition (if the original file system is mounted in the / www directory)

Mount the new partition to the original directory / www, and then copy the previous contents to the / www directory.

The whole process is not very troublesome, if the original file system space is very large, dozens of gigabytes or even hundreds of gigabytes, then it will be a large amount of work. In addition, the previous partition is now useless for the time being, and it is also a waste!

Lvm introduction

Lvm logical volume is used to solve the above problem, it can easily scale the size of the file system. For lvm, there are several special nouns to know:

Physical Volume, or PV for short: physical Volume

Volume Group, or VG for short: logical volume group

Logical Volume, or LV for short: logical Volume

Physical Extent, or PE for short: the size of the smallest storage unit that can be allocated in a physical volume, called PE,PE, can be specified.

The relationship among PV, VG and LV can be understood by the following figure

Lvm usage process

Let's take a look at the lvm usage process, which is mainly divided into the following stages:

Disk partition

Making pv with Partition

Establishing vg with pv

Split lv from vg

Format lv and mount it to a directory for use

This step of disk partitioning is the same as before, using fdisk or gdisk tools to partition. The next step is the process of establishing pv, which is also simple and has a special tool pvcreate to create. Like the pv process, the vg phase and lv phase also have special vgcreate and lvcreate tools. Elastic scaling of the size of the file system is achieved by resizing the lv.

In fact, the use of lvm is very simple, mainly in the understanding of the above several proper nouns, after understanding can be flexibly applied. Next, we will prepare several articles to introduce some of the commands of lvm, as well as practical demonstrations.

Thank you for reading! On the linux lvm software how to flexibly scale the size of the file system to share here, I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.

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