国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Table of Contents
1. The basic components of LVM
1. Physical volume (PV, Physical Volume)
2. Volume Group (VG, Volume Group)
3. Logical Volume (LV, Logical Volume)
4. Physical Blocks (PE, Physical Extends)
2. Physical volume (PV) related operations
①. Use the lvmdiskscan command to list the devices that can be used as PV
② for /dev/sdb1 and /dev/sdb2, and use the pvcreate command to create pv
③ , View all current PV information
3. Volume group (VG) related operations
①. Create a volume group
②. View volume group information
4. Logical volume (LV) related operations
①.Create LV
②、View lv
Home Operation and Maintenance Linux Operation and Maintenance How to use LVM disk operation commands in Linux disk management

How to use LVM disk operation commands in Linux disk management

May 23, 2023 pm 01:58 PM
linux lvm

LVM, Logical Volume Manger, is a logical volume management function provided by the Linux kernel. It is composed of kernel drivers and application layer tools. It creates a logical layer based on the hard disk partition, which can be very flexible and very Conveniently manage storage devices.

LVM uses the device-mapper function of the Linux kernel to implement virtualization of the storage system (the system partition is independent of the underlying hardware). Through LVM, storage space can be abstracted and virtual partitions can be created on it. Partitions can be expanded and reduced more easily. When adding or deleting partitions, there is no need to worry about not having enough contiguous space on a certain hard disk to avoid being in use. It eliminates the trouble of disk repartitioning and the inconvenience of having to move other partitions to adjust partitions. It can manage disks more flexibly than traditional partitioning systems.

1. The basic components of LVM

1. Physical volume (PV, Physical Volume)

A block device that can store LVM. Such as hard disk partition (MBR or GPT Partition), SAN hard disk, RAID or LUN, a loopback file, a kernel-mapped device (such as dm-crypt), which contains a special LVM header, which is the actual hardware or storage system built by LVM.

2. Volume Group (VG, Volume Group)

A volume group is a collection of one or more physical volumes and is displayed as /dev/VG_NAME in the device file system.

3. Logical Volume (LV, Logical Volume)

Logical volumes are the final meta-devices available for use by the system. They are created and managed in volume groups and are composed of physical blocks. In fact It is a virtual partition and appears as /dev/VG_NAME/LV_NAME, on which file systems can usually be created.

4. Physical Blocks (PE, Physical Extends)

If a logical volume needs to allocate multiple physical blocks, they will become the smallest contiguous area in a volume group (default is 4 MiB ). You can think of it as part of a physical volume that can be assigned to a logical volume.

Below I drew a picture of the location of lvm in Linux disk management:

How to use LVM disk operation commands in Linux disk management

## The order is: disk -> partition -> PV - > VG -> LV -> fs, that is, disk->partition->physical volume->volume group->logical volume->file system.

The creation is also in this order, which will be introduced in detail below.

2. Advantages and Disadvantages of LVM

1. Advantages

Compared with the traditional hard disk partition management method, LVM is more flexible:

  • Treat multiple hard disks as one large hard disk

  • Using logical volumes (LV), you can create partitions that span many hard disk spaces.

  • You can create a small logical volume (LV) and dynamically adjust its size when there is insufficient space.

  • When adjusting the size of a logical volume (LV), you don’t need to consider the location of the logical volume on the hard disk, and you don’t have to worry about no available contiguous space.

  • It is feasible to create, delete, resize and other operations online for logical volumes and volume groups. For file systems on LVM, resizing is required, but some file systems (such as ext4) support online operations.

  • Without restarting the service, the logical volume (LV) used in the service can be migrated online/live to another hard disk.

  • Allows the creation of snapshots, which can save backups of the file system while minimizing the downtime of the service.

  • Supports various device-mapper targets, including transparent file system encryption and caching of frequently used data. This will allow you to create a system with one or more disks, encrypted with LUKS, and use LVM on top to easily manage and adjust these independent encrypted volumes (e.g. /, /home, /backup, etc.) without booting the trouble of entering the key multiple times.

2. Disadvantages

  • Requires more complicated extra steps during system setup.

  • Windows system does not support LVM. If you use dual systems, you will not be able to access the LVM partition on Windows.

3. Use of LVM

1. Create a partition

Before configuring lvm, the storage device must be partitioned. You can use Use fdisk or parted tools. When creating a partition, pay attention to the partition type setting (type is linux lvm):

  • If you are using MBR, set the partition type to 8e.

  • If you are using GPT, set the partition type to E6D6D379-F507-44C2-A23C-238F2A3DF928.

I added a new disk /dev/sdb to my virtual machine. Let’s create an 8G partition:

How to use LVM disk operation commands in Linux disk management

How to use LVM disk operation commands in Linux disk management

In the same way, create another 10G linux lvm type partition:

How to use LVM disk operation commands in Linux disk management

①. Use the lvmdiskscan command to list the devices that can be used as PV

How to use LVM disk operation commands in Linux disk management

Note: If the system boot program does not support LVM, /boot cannot be placed in LVM. At this moment, an independent /boot partition must be created and directly formatted and mounted to /boot. The only known bootloader that supports LVM is GRUB.

As you can see from the above figure, //dev/sda2 is already a PV, so only dev/sda1, /dev/sdb1, and /dev/sdb2 can be used to create PV, and because /dev/sda1 is boot boot area, so below we can create PV

② for /dev/sdb1 and /dev/sdb2, and use the pvcreate command to create pv
root# pvcreate device1 device2 ...

How to use LVM disk operation commands in Linux disk management

③ , View all current PV information

You can view PV information through the three commands pvs, pvscan, and pvdisplay

How to use LVM disk operation commands in Linux disk management

Note: If you are using an SSD that has not been formatted and the erase block size is less than 1M, please use the following command pvcreate --dataalignment 1m /dev/sda to set the alignment. .

①. Create a volume group

Use the command vgcreate to create a volume group

root# vgcreate vg_name pv1 pv2 ...

How to use LVM disk operation commands in Linux disk management

Create the volume group vg_fedora_yg and add pv /dev/sdb1 to the volume group.

②. View volume group information

How to use LVM disk operation commands in Linux disk management

At this time, you can also view the volume group where each physical volume is located through pvs:

How to use LVM disk operation commands in Linux disk management

①.Create LV

Use the lvcreate command

root# lvcreate -L <lv_size>  <vg_name> -n <lv_name>
 
# 將卷組vg_name下所有剩余空間給創(chuàng)建的lv_name邏輯卷
root# lvcreate -l +100%FREE  <vg_name> -n <lv_name>
root# lvcreate -L <lv_size> <vg_name> -n <lv_name>

How to use LVM disk operation commands in Linux disk management

After the logical volume is created, you can access it through /dev/mapper/vg_fedora_yg-lv_yg01 or /dev/vg_fedora_yg/lv_yg01:

How to use LVM disk operation commands in Linux disk management

②、View lv

Command lvs, lvscan, lvdisplay to view

How to use LVM disk operation commands in Linux disk management

##③、Expand logical volume
By command lvextend:

root# lvextend -L <extend_size> <lv_path>

How to use LVM disk operation commands in Linux disk management

Note: If the expanded logical volume has been mounted to a specific file system, you need to execute resize2fs or xfs_growfs (for xfs files System) command to make the modification effective, You can use df -Th or blkid to check the file system type mounted by lv.

5. Format and mount LV (logical volume)

After the above logical volume LV is created, it can usually be found under /dev/mapper/ or /dev/vg_name/ If the logical volume cannot be found, you can execute the following command:

# modprobe dm-mod
# vgscan
# vgchange -ay

Finally, you can see the following:

How to use LVM disk operation commands in Linux disk management

①. Format the logical volume
Now you can create a file system on this logical volume:

# mkfs.<filesystem_type> /dev/mapper/<vg_name>-<lv_name>
 
# 
# mkfs.xfs /dev/mapper/vg_fedora_yg-lv_yg01

How to use LVM disk operation commands in Linux disk management

②, mount
# mount /dev/mapper/<vg_name>-<lv_name> <mount_point>

How to use LVM disk operation commands in Linux disk management

Note: Please select the new logical volume you created for the mount point (for example:

/dev/mapper/vg_fedora_yg-lv_yg01), Do not use the actual partition device where the logical volume is located (That is, do not use: /dev/sdb1)

Finally, I drew a picture to show linux lvm:

How to use LVM disk operation commands in Linux disk management

You can refer to the above content to understand the disk management mechanism of Linux lvm.

illustrate:

① In the picture, /dev/sda1 is the boot boot area and cannot be managed by lvm, so it is directly formatted and mounted to the directory /boot. In addition, /dev/sdb2 is also mounted to the directory without being directly formatted by lvm. directory.

②. The capacity of volume group vg_fedora1 is 139G, from which 40 5 45 = 90G is allocated, and there is still 49G free. These free capacities can be lvextended to the following lv; you can also create another lv and allocate go out.

③. Disk settings /dev/sdc still has 50G free space that is not partitioned and can be used after partitioning.

The above is the detailed content of How to use LVM disk operation commands in Linux disk management. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Postman Integrated Application on CentOS Postman Integrated Application on CentOS May 19, 2025 pm 08:00 PM

Integrating Postman applications on CentOS can be achieved through a variety of methods. The following are the detailed steps and suggestions: Install Postman by downloading the installation package to download Postman's Linux version installation package: Visit Postman's official website and select the version suitable for Linux to download. Unzip the installation package: Use the following command to unzip the installation package to the specified directory, for example /opt: sudotar-xzfpostman-linux-x64-xx.xx.xx.tar.gz-C/opt Please note that "postman-linux-x64-xx.xx.xx.tar.gz" is replaced by the file name you actually downloaded. Create symbols

The difference between programming in Java and other languages ??Analysis of the advantages of cross-platform features of Java The difference between programming in Java and other languages ??Analysis of the advantages of cross-platform features of Java May 20, 2025 pm 08:21 PM

The main difference between Java and other programming languages ??is its cross-platform feature of "writing at once, running everywhere". 1. The syntax of Java is close to C, but it removes pointer operations that are prone to errors, making it suitable for large enterprise applications. 2. Compared with Python, Java has more advantages in performance and large-scale data processing. The cross-platform advantage of Java stems from the Java virtual machine (JVM), which can run the same bytecode on different platforms, simplifying development and deployment, but be careful to avoid using platform-specific APIs to maintain cross-platformity.

Where is the pycharm interpreter? Where is the pycharm interpreter? May 23, 2025 pm 10:09 PM

Setting the location of the interpreter in PyCharm can be achieved through the following steps: 1. Open PyCharm, click the "File" menu, and select "Settings" or "Preferences". 2. Find and click "Project:[Your Project Name]" and select "PythonInterpreter". 3. Click "AddInterpreter", select "SystemInterpreter", browse to the Python installation directory, select the Python executable file, and click "OK". When setting up the interpreter, you need to pay attention to path correctness, version compatibility and the use of the virtual environment to ensure the smooth operation of the project.

How to manually install plugin packages in VSCode How to manually install plugin packages in VSCode May 15, 2025 pm 09:33 PM

The steps to manually install the plug-in package in VSCode are: 1. Download the .vsix file of the plug-in; 2. Open VSCode and press Ctrl Shift P (Windows/Linux) or Cmd Shift P (Mac) to call up the command panel; 3. Enter and select Extensions:InstallfromVSIX..., then select .vsix file and install. Manually installing plug-ins provides a flexible way to install, especially when the network is restricted or the plug-in market is unavailable, but attention needs to be paid to file security and possible dependencies.

Detailed introduction to each directory of Linux and each directory (reprinted) Detailed introduction to each directory of Linux and each directory (reprinted) May 22, 2025 pm 07:54 PM

[Common Directory Description] Directory/bin stores binary executable files (ls, cat, mkdir, etc.), and common commands are generally here. /etc stores system management and configuration files/home stores all user files. The root directory of the user's home directory is the basis of the user's home directory. For example, the home directory of the user user is /home/user. You can use ~user to represent /usr to store system applications. The more important directory /usr/local Local system administrator software installation directory (install system-level applications). This is the largest directory, and almost all the applications and files to be used are in this directory. /usr/x11r6?Directory for storing x?window/usr/bin?Many

After installing Nginx, the configuration file path and initial settings After installing Nginx, the configuration file path and initial settings May 16, 2025 pm 10:54 PM

Understanding Nginx's configuration file path and initial settings is very important because it is the first step in optimizing and managing a web server. 1) The configuration file path is usually /etc/nginx/nginx.conf. The syntax can be found and tested using the nginx-t command. 2) The initial settings include global settings (such as user, worker_processes) and HTTP settings (such as include, log_format). These settings allow customization and extension according to requirements. Incorrect configuration may lead to performance issues and security vulnerabilities.

MySQL installation tutorial teach you step by step the detailed steps for installing and configuration of mySQL step by step MySQL installation tutorial teach you step by step the detailed steps for installing and configuration of mySQL step by step May 23, 2025 am 06:09 AM

The installation and configuration of MySQL can be completed through the following steps: 1. Download the installation package suitable for the operating system from the official website. 2. Run the installer, select the "Developer Default" option and set the root user password. 3. After installation, configure environment variables to ensure that the bin directory of MySQL is in PATH. 4. When creating a user, follow the principle of minimum permissions and set a strong password. 5. Adjust the innodb_buffer_pool_size and max_connections parameters when optimizing performance. 6. Back up the database regularly and optimize query statements to improve performance.

Comparison between Informix and MySQL on Linux Comparison between Informix and MySQL on Linux May 29, 2025 pm 11:21 PM

Informix and MySQL are both popular relational database management systems. They perform well in Linux environments and are widely used. The following is a comparison and analysis of the two on the Linux platform: Installing and configuring Informix: Deploying Informix on Linux requires downloading the corresponding installation files, and then completing the installation and configuration process according to the official documentation. MySQL: The installation process of MySQL is relatively simple, and can be easily installed through system package management tools (such as apt or yum), and there are a large number of tutorials and community support on the network for reference. Performance Informix: Informix has excellent performance and

See all articles