002. LVM Creation

Source: Internet
Author: User
1. LVM creation procedure
  1. Create a partition
  2. Create PV
  3. Create VG
  4. Create LV
  5. Format and Mount
Ii. Create a partition

Use a partitioning tool (such as fdisk) to create LVM partitions, but identify the partitions as 8E of the LVM partition type.

  1 [[email protected] ~]# fdisk -l  2 ……  3    Device Boot      Start         End      Blocks   Id  System  4 /dev/sdb1            2048    20971519    10484736    5  Extended  5 /dev/sdb5            4096     2101247     1048576   8e  Linux LVM  6 /dev/sdb6         2103296     4200447     1048576   8e  Linux LVM

3. Create pv3.1 create PV
1 [[email protected] ~] # Pvcreate/dev/sdb5 # convert each partition to PV 2 physical volume "/dev/sdb5" successfully created 3 [email protected] ~] # Pvcreate/dev/sdb6 4 physical volume "/dev/sdb6" successfully created

3.2 view Verification
  1 [[email protected] ~]# pvdisplay  2   ……

4. Create vg4.1 and create VG
1 [[email protected] ~] # Vgcreate-s 16 m vg01/dev/sdb5/dev/sdb6/dev/sdb7 2 # create a VG group named vg01, modify PE to 16 m 3 volume group "vg01" successfully created

4.2 view Verification

Omitted

Note: LVM uses a 4 mb pe block by default. The default lvm vg has 4 M * 65534/(1024 m/g) = 256g.

5. Create lv5.1 create LV
  1 [[email protected] ~]# lvcreate -L 1g -n lv01 vg01  2   Logical volume "lv01" created.

5.2 view Verification
  1 [[email protected] ~]# lvdisplay

6. Format and mount the 6.1 format
1 [[email protected] ~] # Mkfs. XFS/dev/vg01/lv01 # format to the corresponding format 2 meta-data =/dev/vg01/lv01 isize = 256 agcount = 4, agsize = 65536 blks 3 = sectsz = 512 ATTR = 2, projid32bit = 1 4 = CRC = 0 finobt = 0 5 Data = bsize = 4096 blocks = 262144, imaxpct = 25 6 = Sunit = 0 swidth = 0 blks 7 naming = version 2 bsize = 4096 ascii-CI = 0 FTYPE = 0 8 log = internal log bsize = 4096 blocks = 2560, version = 2 9 = sectsz = 512 Sunit = 0 blks, lazy-Count = 1 10 realtime = none extsz = 4096 blocks = 0, rtextents = 0

6.2 Mount
1 [[email protected] ~] # Mkdir/root/mylv01 # create a directory for mounting 2 [email protected] ~] # Mount/dev/vg01/lv01/root/mylv01/# mount to the corresponding directory 3 [email protected] ~] # DF-h # view and verify 4 filesystem size used avail use % mounted on 5 ...... 6/dev/mapper/vg01-lv01 1014 m 33 m 982 M 4%/root/mylv01

6.3 boot mounting

1 [[email protected] ~] # Vi/etc/fstab 2/dev/vg01/lv01/root/mylv01xfsdefaults0 0 # change to boot mounting

002. LVM Creation

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.