Get the App
SLTechnology News&Howtos  ›  Servers  › 

The disk is mounted on LVM.

Shulou Source: shulou.com Published: 2022-06-02 10:45:10 09月29日 Update

1. Check disk status: fdisk -l

2. Partitioning disk sdb:

Command: fdisk /dev/sdb

If you don't know what to do with fdisk, type m to help. The most common 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 existing partitions (no partitions yet)

Enter n New partition

Enter p to create the main partition (p is after n, not print)

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 system identifier:

Enter t to change the properties of partition 1

Type L to see if there is 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 PV:

Scanning system PV: pvscan

Create PV: pvcreate /dev/sdb1

View PV: pvdisplay

4. Create VG:

Scan system VG: vgscan

Create VG: vgcreate vg_test /dev/sdb1

View VG: vgdisplay

5. Create LV:

Scan system LV: lvscan

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

View LV: lvdisplay

6. Format the LV you just created

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

7. Create directory and mount

Create directory: mkdir /test

Mount: mount /dev/vg_test/lv_test /test

View: df -h

8. There is also a final step, setting the boot mount.

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

So far, it's done.

Tags: Input system situation format commands disks attributes identifiers identifiers directories completed number great work commonly used is in so far Lixin help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi MariaDB Shulou Technology macOS Linux