LVM Creation for Linux

Source: Internet
Author: User

Basic terminology for LVM

As mentioned earlier, LVM is a logical layer that is added between the disk partition and the file system to mask the underlying disk partition layout for the file system, providing an abstract disk volume, and creating a file system on the disk volume. First we discuss the following LVM terminology:

  1. Physical storage media (the physical media): This refers to the system's storage device: The hard disk, such as:/DEV/HDA1,/DEV/SDA, etc., is the lowest layer of storage system storage unit.

  2. Physical volume (physical volume): a physical volume refers to a hard disk partition or a device (such as RAID) that logically has the same function as a disk partition, which is the basic storage logic block of LVM, but is compared to basic physical storage media (such as partitions, disks, etc.) and contains management parameters related to LVM.

  3. Volume group (Volume Group): LVM volume groups are similar to physical hard disks in non-LVM systems, which consist of physical volumes. You can create one or more LVM partitions (logical volumes) on a volume group, and an LVM volume group consists of one or more physical volumes.

  4. Logical volumes (logical volume): LVM logical volumes are similar to hard disk partitions in non-LVM systems, and file systems (such as/home or/usr) can be created on top of logical volumes.

  5. PE (physical extent): each physical volume is divided into a basic unit called PE (physical extents), with a uniquely numbered PE being the smallest unit that can be addressed by LVM. The size of the PE is configurable and defaults to 4MB.

  6. Le (logical extent): Logical volumes are also divided into addressable basic units called LE (logical extents). In the same volume group, the size of Le is the same as the PE, and one by one corresponds.

    In simple terms:

    PV: is a physical partition of the disk

    The physical disk partition in VG:LVM, which is PV, must be added to the VG, which can be understood as a warehouse or a few large hard disks.

    LV: The logical partition from the VG

  7. Check if the Linux system has LVM tools installed

  8. Rpm-qa | grep LVM

  9. Querying the system for partition information

    Fdisk-l

  10. Creating partitions

    fdisk/dev/Absolute Path

  11. command  (M FOR HELP): m                                ####  Help command action   a   toggle a bootable  flag   b   edit bsd disklabel   c    toggle the dos compatibility flag   d   delete a  Partition   l   list known partition types   m    print this menu   n   add a new  partition   o   create a new empty dos partition  table   p   print the partition table   q    quit without saving changes   s   create a new empty sun  Disklabel   t   change a partition ' s system id    u   change display/entry units   v   verify  The partition table   w   write table to disk and  exit   x   extra functionality  (experts only) command  ( M FOR HELP): n                                ## ##  creating a new partition command action   e   extended   p    primary partition  (1-4) p                                                        ####  Create Primary partition partition number  (1-4):1                                ####  partition idfirst cylinder  (1-65270, default 1):  using  default value 1Last cylinder, +cylinders or +size{K,M,G}  (1-65270,  default 65270): using default value 65270command  (m for help): t                                   ####  Modify the partition type command  (m for help):8e                                 #### linux  lvmCommand  (M FOR HELP):w                                   ####  Save Changes pvcreate /dev/xvdb1/                              ####  Create a new PV volume pvs                                               ####  View PV Volume Vgcreate volgroup01 /dev/xvdb1/                  ####  Creating a new VG volume  vgs                                               ####  View VG Volume lvcreate -l  50g -n lvmserver    volgroup01      ####   Create Logical Volume  -L  Specify partition size  -n  specify LVM name mkfs.ext4 /dev/volgroup01/lvmserver              ####  Use the MKFS.EXT4 command to create a EXT4 file system on a logical volume Lvmserver mount /dev/volgroup01/lvmserver /server/         ####  hangs in partition to local directory/servervi /etc/fstab                                     ####  Modify fstab  Boot automatically mount Note: * fstab must fill in the correct path, once error, may not start normally .*  can be mounted using the Mount command in Rc.local

LVM creation for Linux

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.