Linux system LVM Basic use

Source: Internet
Author: User

I. Some concepts about LVM

1. LVM: Logical Volume Manager, an abstraction layer built on a physical storage device that allows you to generate logical storage volumes,

Hardware-related storage settings are hidden and you don't have to stop applying or uninstalling the file system to resize the volume

Or migrate data, you can manage your partitions flexibly.

2. Physical Volume: Directly corresponds to the actual hard disk partition, can also be the entire hard disk or the created soft RAID, is the base of the LVM

This storage device.

3. Volume group: A storage pool consisting of one or more physical volumes that can create one or more logical volumes on a volume group.

4. Logical Volume: Similar to a hard disk partition in a non-LVM system, it is built on top of the volume group and is a standard block device .

A file system can be established on a logical volume.

Second, create

1. Create a physical Volume:

Pvcreate (hard disk partitions, such as:/dev/sdb1) (Convert hard disk partitions to physical volumes)

The command Pvdisplay allows you to view all the physical volume information in the system.

The physical volume you just created is not part of any volume group and cannot be used directly.

2. Create a volume group:

Vgcreate (volume group name, such as:wjt_vg) (physical volume, such as:/dev/sdb1)

(A physical volume can be either created or not created, and when physical is not created, the command can create a

Physical volumes and added to the volume group)

The command vgdisplay allows you to view all the physical volume information in the system.

3. create a logical volume in the volume Group:

Lvcreate-l (logical volume size, such as:3G) - n (logical volume name, such as:wjt_lv1) (volume group name, such as:

WJT_VG)

The command lvdisplay allows you to view all the logical volume information in the system.

4. Create the file system on the logical Volume:

Mke2fs-j (logical volumes, such as:/dev/wjt_vg/wjt_lv1)

5. mount the logical Volume:

MOUNT-T ext3 (logical volumes, such as:/dev/wjt_vg/wjt_lv1) (Mount directory, such as:/opt)

Third, removal

1. unload the logical volume umount (mount directory, such as:/opt)

2. Delete Logical volumes lvremove (logical volumes, such as:/dev/wjt_vg/wjt_lv1)

3. Deleting a volume group: vgremove (volume group, such as:/dev/wjt_gv)

4. Delete Physical volumes:pvremove (physical volumes, such as:/dev/sdb1)

Note: The sequence of steps to remove and create is reversed.

Linux system LVM Basic use

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.