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 mount the disk as LVM

2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

LVM

LVM is the abbreviation of Logical Volume Manager (logical Volume Management). It is a mechanism for managing disk partitions in the Linux environment. It is implemented by Heinz Mauelshagen on the Linux 2.4 kernel. The latest versions are stable version 1.0.5, development version 1.1.0-rc2, and LVM2 development version. A common and difficult problem encountered by Linux users when installing Linux operating system is how to correctly evaluate the size of each partition in order to allocate appropriate hard disk space. The common disk partition management method cannot change the size of a logical partition after it has been partitioned. When a logical partition cannot hold a file, the file cannot be stored across multiple partitions because of the limitations of the upper file system. So it can't be put on other disks at the same time.

The process of creating a LVM:

1. Mount a physical disk

two。 Add a physical disk to a physical volume

3. Add a physical volume to a volume group

4. Divide the disk resources in a volume group into different logical volumes

Mounting method:

1. Check the disk condition: fdisk-l

two。 Partition disk sdb:

Command: fdisk / dev/sdb

If you don't know the specific operation in fdisk, you can enter m to help. The most commonly used is n (new) d (delete) p (print) Q (exit) t (modify system identifier) w (write and exit)

Create a new partition:

Enter p to print the existing partition (there is no partition yet)

Enter n to create a new partition

Enter p to establish the primary partition (at this time p is after n, not printing)

Enter 1 to create the first primary partition

Enter p to print the partition and find that a partition / dev/sdb1 has been created, but this partition is in Linux format

Change the system identifier:

Enter t to change the properties of partition 1

Enter L to see a command corresponding to an attribute

Enter 8e to change partition 1 to Linux LVM format

Enter p to print the partition and find that the partition / dev/sdb1 is in Linux LVM format

3. Create a PV:

Sweep system PV:pvscan

Create PV:pvcreate / dev/sdb1

View PV:pvdisplay

4. Create a VG:

Sweep system VG:vgscan

Create VG:vgcreate vg_test / dev/sdb1

View VG:vgdisplay

5. Create a LV:

Sweep system LV:lvscan

Create LV:lvcreate-l 1274-n lv_test vg_test (1274 is the number of PE in VG)

View LV:lvdisplay

6. Format the LV you just created

Command: mkfs-t ext4 / dev/vg_test/lv_test

7. Create a directory and mount it

Create a directory: mkdir / test

Mount: mount / dev/vg_test/lv_test / test

View: df-h

8. The last step is to set the boot mount.

Write / dev/mapper/vg_test-lv_test / test ext4 defaults 1 2 to / etc/fstab

At this point, the job is done.

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