목차

Logical Volume Manager

LVM 아기텍쳐

출처 : redhat 공식 문서

LVM 구성 순서

Phsycal Volume 생성 방법

* 단일 디스크 Size 10G 물리 볼륨 생성

[root@localhost ~]# fdisk -l
Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x522ca171

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    20973567    10485760   8e  Linux LVM

[root@localhost ~]# pvcreate -h
  pvcreate: Initialize physical volume(s) for use by LVM

pvcreate 
	[--norestorefile]
	[--restorefile file]
	[-d|--debug]
	[-f[f]|--force [--force]] 
	[-h|-?|--help] 
	[--labelsector sector] 
	[-M|--metadatatype 1|2]
	[--pvmetadatacopies #copies]
	[--bootloaderareasize BootLoaderAreaSize[bBsSkKmMgGtTpPeE]]
	[--metadatasize MetadataSize[bBsSkKmMgGtTpPeE]]
	[--dataalignment Alignment[bBsSkKmMgGtTpPeE]]
	[--dataalignmentoffset AlignmentOffset[bBsSkKmMgGtTpPeE]]
	[--setphysicalvolumesize PhysicalVolumeSize[bBsSkKmMgGtTpPeE]
	[-t|--test] 
	[-u|--uuid uuid] 
	[-v|--verbose] 
	[-y|--yes]
	[-Z|--zero {y|n}]
	[--version] 
	PhysicalVolume [PhysicalVolume...]


[root@localhost ~]# pvcreate /dev/sdb1
  Physical volume "/dev/sdb1" successfully created
[root@localhost ~]# pvs
  PV         VG   Fmt  Attr PSize  PFree 
  /dev/sda2  rhel lvm2 a--  29.51g     0 
  /dev/sdb1       lvm2 a--  10.00g 10.00g
[root@localhost ~]# pvdisplay 
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               rhel
  PV Size               29.51 GiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              7554
  Free PE               0
  Allocated PE          7554
  PV UUID               Ub2hjb-BUuv-ffkk-ytkD-Op9D-3coH-GfcyLu
   
  "/dev/sdb1" is a new physical volume of "10.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/sdb1
  VG Name               
  PV Size               10.00 GiB
  Allocatable           NO
  PE Size               0   
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               7WPUaF-OtO0-KCfn-oHkB-vL7d-qMTE-2itl4i

Volume Group 생성 방법

[root@localhost ~]# vgcreate -h
  vgcreate: Create a volume group

vgcreate
	[-A|--autobackup {y|n}] 
	[--addtag Tag] 
	[--alloc AllocationPolicy] 
	[-c|--clustered {y|n}] 
	[-d|--debug]
	[-h|--help]
	[-l|--maxlogicalvolumes MaxLogicalVolumes]
	[-M|--metadatatype 1|2] 
	[--[vg]metadatacopies #copies] 
	[-p|--maxphysicalvolumes MaxPhysicalVolumes] 
	[-s|--physicalextentsize PhysicalExtentSize[bBsSkKmMgGtTpPeE]] 
	[-t|--test] 
	[-v|--verbose]
	[--version] 
	[-y|--yes]
	[ PHYSICAL DEVICE OPTIONS ] 
	VolumeGroupName PhysicalDevicePath [PhysicalDevicePath...]

* Volume Group 확인

[root@localhost ~]# vgs
  VG   #PV #LV #SN Attr   VSize  VFree 
  vg01   1   0   0 wz--n- 10.00g 10.00g

[root@localhost ~]# vgdisplay 
  --- Volume group ---
  VG Name               vg01
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               10.00 GiB
  PE Size               4.00 MiB
  Total PE              2559
  Alloc PE / Size       0 / 0   
  Free  PE / Size       2559 / 10.00 GiB
  VG UUID               o5TZxH-7BYe-dzpM-cZaZ-obwu-X2W5-lkgt7r