Linux LVM: Physical Volume Logical volume

Source: Internet
Author: User
Tags uuid

Logical Volume Manager, when the partition is not enough, you can create a larger partition and then copy it in, but waste time. LVM can adjust the partition size flexibly and can dynamically combine partitions. The partition size is fixed and cannot be adjusted, apt-get update & apt-get install pv*pt-cache Search < package name > query Installed package:dpkg /c2>-s libgstreamer0.10-Dev Physical Volume:

/dev/Sda2 This partition belongs to the VOLGROUP00 volume group, size 19G. The entire operating system has a physical volume, and this physical volume is targeted at the SDA2 partition. The physical volume corresponds to the actual hard disk partition, a volume group can contain one or more physical volumes, when a volume group capacity is not enough, you can add a partition, so that volume group capacity becomes larger, LVM itself his value is also reflected here. A grouping can be divided into several logical volumes, comparing 3 logical volumes A,b,c,a storing database files, b storing file-related data, and C storing temporary files. At the bottom is the physical volume, which corresponds directly to the hard disk partition. Multiple physical volumes make up a volume group. Different volume groups can be used to divide various logical volumes. (This is the description of LVM itself) [email protected]:/# fdisk-Ldisk/dev/sda:20 GiB, 21474836480 bytes, 41943040sectorsdevice Boot Start End sectors Size Id Type/DEV/SDA1 * 2048 39845887 39843840 19G 83Linux/dev/sda2 39847934 41940991 2093058 1022M 5Extended/dev/sda5 39847936 41940991 2093056 1022M. Linux Swap/Solarisdisk/dev/sdb:2 GiB, 2147483648 bytes, 4194304sectorsdevice Boot Start End sectors Size Id Type/DEV/SDB1 2048 4194303 4192256 2G 83Linux[email protected]:/# pvcreate/dev/SDB1: Make the partition into a physical volume WARNING:EXT3 signature detected on/DEV/SDB1 at offset 1080. Wipe it? [y/N]: y Wiping ext3 signature on/dev/SDB1. Physical volume"/DEV/SDB1"successfully created (physical volume creation successful) [email protected]:/# Pvdisplay: viewing physical volumes"/DEV/SDB1" is aNewPhysical volume of "500.00 MiB"---NEW physical volume---PV Name/DEV/SDB1: The name of the physical volume is called/dev/sdb1 VG Name: Not yet part of any volume group PV Size500.00MiB allocatable NO PE Size0Total PE0Free PE0Allocated PE0PV UUID c1bsmd-8dcv-vo9s-wooe-qf5m-qiep-H1YGQZ Create a volume group to specify a physical volume, otherwise it cannot be created. [Email protected]:/# vgcreate sdb_volm_group/dev/sdb1 Volume Group"Sdb_volm_group"successfully created (volume group Sdb_volm_group created successfully) [email protected]:/# Vgdisplay: Viewing volume groups---Volume Group---VG Name sdb_volm_group System ID Format lvm2 Metadata areas 1Metadata Sequence No1VG Access Read/write VG Status resizable MAX LV0Cur LV0Open LV0Max PV0Cur PV1Act PV1VG Size496.00MiB PE Size4.00MiB Total PE124Alloc PE/Size 0/0Free PE/Size 124/496.00MiB VG UUID pzyjkt-nc6b-hzek-fxeu-layv-xwpi-LI1JCD now converts a partition sdb1 into a physical volume SDB1, adds the volume to the Sdb_volm_group volume group, and creates a different partition logical volume within the volume group. (Create a logical volume,-L Specify Size 100m,-N Specify name Nuoji1, followed by volume group name) [email protected]:/# lvcreate-l 100M-n nuoji1 Sdb_volm_group Logical volume"Nuoji1"created. (Logical volume creation succeeded) [email protected]:/# lvcreate-l 100M-n nuoji2 Sdb_volm_group Logical volume"Nuoji2" created.
[Email protected]:/# Lvdisplay: viewing logical volumes---Logical volume---LV Path/dev/sdb_volm_group/nuoji1 LV name nuoji1 VG name Sdb_volm_group LV UUID OYSIHW-fpik-19l4-cjaj-9hob-tgca-1ilUkU LV Write Access Read/Write LV Creation host, time Ubuntu,2018-02-14 04:58:50-0800LV Status Available # open0LV Size100.00MiB Current LE25Segments1Allocation inherit Read ahead sectors Auto-Currently set to 256Block Device253:0---Logical volume---LV Path/dev/sdb_volm_group/nuoji2 LV name nuoji2 VG name Sdb_volm_group LV UUID UVxno2-wtuw-mp78-tvop-76ps-wewm-H3LBJG LV Write Access Read/Write LV Creation host, time Ubuntu,2018-02-14 05:24:45-0800LV Status Available # open0LV Size100.00MiB Current LE25Segments1Allocation inherit Read ahead sectors Auto-Currently set to 256Block Device253:1
[Email protected]:/dev/sdb_volm_group# lsnuoji1  nuoji2
once the logical volume is created, it is ready to be used, and the logical volume can be mounted directly in the directory: [email protected]:/dev/sdb_volm_group# DF-h Filesystem Size used Avail use%mounted on/DEV/SDA1 19G 7.1G 11G 41%//dev/sr0 1.5G 1.5G 0 100%/media/yw1989/ubuntu 16.04.3LTS AMD64/DEV/SDC1 3.2G 21M 3.2G 1%/media/Upan (Mount logical partition) [email protected]:/# mount-t ext3/dev/sdb_volm_group/nuoji1/yw/Nuiji_fenqumount:wrong FS type, bad option, bad Superblock on/dev/mapper/sdb_volm_group-nuoji1, missing codepage or helper program, or other error in some cases useful info was found in syslog 
    -TryDMESG| Tail or so. (/dev/sdb_volm_group/Nuoji1 is just a partition of a logical volume, no specified file type is not formatted, (specify file type ext3 for logical volume partitioning, that is, format) [email protected]:/# mke2fs-j/dev/sdb_volm_group/NUOJI1MKE2FS1.42.13 (17-may-2015) Creating filesystem with102400 1k blocks and 25688Inodesfilesystem UUID:CB5DA3FC-3a96-4c85-b392-ce6777fb05fasuperblock backups stored on blocks:8193, 24577, 40961, 57345, 73729Allocating group Tables:done Writing inode Tables:done creatin G Journal (4096blocks): donewriting superblocks and filesystem accounting Information:done (Mount logical Volume partition, no error) [email protected]:/# mount-t ext3/dev/sdb_volm_group/nuoji1/yw/Nuiji_fenqu[email protected]:/# Mount-A[email protected]:/# Mount/dev/mapper/sdb_volm_group-nuoji1 on/yw/nuiji_fenqu type ext3 (rw,relatime,data=ordered) [Email protected]:/# DF-h/dev/mapper/sdb_volm_group-nuoji1 93M 1.6M 87M 2%/yw/nuiji_fenqu (nuiji_fenqu directory point to Logical volume partition sdb_volm_group-NUOJI1, this logical volume partition is part of the group, which is the SDB1 partition under the SDB hard disk, size 93M is the size specified when the logical volume was created (the logical volume is to reallocate the hard disk size of the volume group)

---------------------------------------- removal is to reverse the process just now:-----------------------------------------

[Email protected]:/# umount/yw/nuiji_fenqu (uninstall first) [email protected]:/# DF-H (no mount information) Filesystem Size used Avail use%mounted Onudev 456M0 456M 0%/Dev/DEV/SDA1 19G 7.1G 11G 41%//dev/sr0 1.5G 1.5G 0 100%/media/yw1989/ubuntu 16.04.3LTS AMD64/DEV/SDC1 3.2G 21M 3.2G 1%/media/Upan[email protected]:/# lvremove/dev/mapper/sdb_volm_group-nuoji1 (remove logical volume partition) Do you really want to remove and DISCARD active Logical Volume nuoji1? [y/N]: Y Logical volume"Nuoji1"successfully removed[email protected]:/# lvremove/dev/mapper/sdb_volm_group-nuoji2do really want to remove and DISCARD active logical volume NUOJI2? [y/N]: Y Logical volume"Nuoji2"successfully removed[email protected]:/# Lvdisplay (no logical volume) [email protected]:/# vgremove/dev/Sdb_volm_group (remove volume Group) Volume Group"Sdb_volm_group"successfully removed[email protected]:/# vgdisplay (Volume group gone) [email protected]:/# Pvdisplay (View physical volume)"/DEV/SDB1" is aNewPhysical volume of "500.00 MiB"---NEW physical volume---PV Name/dev/sdb1 VG Name PV Size500.00MiB allocatable NO PE Size0Total PE0Free PE0Allocated PE0PV UUID rbdqsp-cw2q-u5bq-zfiu-kcbn-312j-Tkasy1[email protected]:/# pvremove/dev/sdb1 (Removal of physical volume) Labels on physical volume"/DEV/SDB1"successfully wiped[email protected]:/# Pvdisplay (no physical volume) [email protected]:/# Apt-get Install pv*[email protected]:/# PVPV PVMD pvpgn-support-installerpvchange pvmgetarch pvremovepvck pvmgroups p Vresizepvcreate Pvmgs PVRG-jpegpvdisplay pvm_gstat pvspvm pvmove pvscan

Linux LVM: Physical Volume Logical volume

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.