본문 바로가기
server/Cent_os

CentOS LVM (Logical Volume Manager) basic management

0.LVM

LVM 은 Logical Volume Manager 의 약자로서, 저장장치들을 좀더 효율적이고 유연하게 관리할 수 있는 커널의 부분과 프로그램을 말한다.
LVM 장점을 아래와 같다.

쉬운 관리
서로 다른 많은 디바이스 조합 지원
직관적인 저장 장치로의 접근
뛰어난 확장성
믿을만한 안전성과 효율
스냅샷 기능 지원

VG(Volume Group)은 LVM의 가장 기본적인 구성 요소 이며, 말 그대로 가상 디스크라고 할 수 있는데,
하나 이상의 실제 물리적으로 존재하는 블록 디바이스가 모여서 VG를 구성 한다.
PV(Physical Volume)는 그 물리적인 블록 디바이스로서 , 거의 대부분의 장치를 PV로 쓸 수 있다.
PV와 대비되는 것이 LV(Logical Volume)로서  가상 파티션이라고도 할 수 있는데, VG를 적당히 나누어 할당한 것이 LV이다.
사용자는 LV를 일반 디스크나 파티션처럼 쓰면 된다
정리하자면, 하나 이상의 PV가 모여 VG를 이루고, VG를 가상적으로 나누어 할당하면 LV이 된다.


1.테스트 서버 구성 

아래 그림과 같이 가상 인스턴스에  총 1개의 OS 영역의 디스크(sda) 와 2개의 추가 디스크(sdb,sdc) 로 구성 되어 있다.


2.LVM 패키지 확인  

LVM 구성을위한 LVM 패키지를 확인 하며, 없을 경우 lvm2를 설치 진행 한다.

[root@cy_vm2 ~]# yum install lvm2 -y
[root@cy_vm2 ~]# rpm -qa | grep lvm
lvm2-2.02.171-8.el7.x86_64
lvm2-libs-2.02.171-8.el7.x86_64


3.PV(Physical Volume) 초기화 작업

fdisk -l 를 통하여 테스트 환경에서 OS영영 sda 디스크를제외한  sdb,sdc 디스크가 5G씩  연결 된것을 확인한다.

[root@cy_vm2 ~]# fdisk -l
Disk /dev/sda: 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: 0x000db31d
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048     8390655     4194304   82  Linux swap / Solaris
/dev/sda2   *     8390656    41943039    16776192   83  Linux
Disk /dev/sdb: 5368 MB, 5368709120 bytes, 10485760 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 /dev/sdc: 5368 MB, 5368709120 bytes, 10485760 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


[root@cy_vm2 ~]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x9ba5ce6e.

Command (m for help): p  #p(rint) 하여 파티션 테이블을 확인 한다.
Disk /dev/sdb: 5368 MB, 5368709120 bytes, 10485760 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: 0x9ba5ce6e
   Device Boot      Start         End      Blocks   Id  System


Command (m for help): n #새로운 파티션을 생성한다.
Partition type: p # primary 파티션을 생성 한다.
   p   primary (0 primary, 0 extended, 4 free)
   e   extended

Partition number (1-4, default 1): 1 #파티션 번호를 선택한다.

First sector (2048-10485759, default 2048):  2048 # starting cylinder (dufalt 값 혹은 엔터)
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-10485759, default 10485759):10485759 # end cylinder(dufalt 값 혹은 엔터)
Using default value 10485759
Partition 1 of type Linux and of size 5 GiB is set

Command (m for help): p  #p(rint) 하여 파티션 테이블을 확인 하여 /dev/sdb1 정보 확인
Disk /dev/sdb: 5368 MB, 5368709120 bytes, 10485760 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: 0x9ba5ce6e
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    10485759     5241856   83  Linux

Command (m for help): t  #type 변경을 진행 한다
Selected partition 1
Hex code (type L to list all codes): 8e #8e 는 Linux LVM  타입으로 변경
Changed type of partition 'Linux' to 'Linux LVM'
Command (m for help): p #파티션 테이블을 확인 하면 Linux LVM 으로 변경 된것을 확인 한다.
Disk /dev/sdc: 5368 MB, 5368709120 bytes, 10485760 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: 0xcc454432
   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048    10485759     5241856   8e  Linux LVM
Command (m for help): w # write 하고 fdisk 를 종료 한다.
The partition table has been altered!

sfdisk 명령어로 sdb 의 파티션정보를 확인 한다.
[root@cy_vm2 ~]# sfdisk -l /dev/sdb
Disk /dev/sdb: 652 cylinders, 255 heads, 63 sectors/track
sfdisk: Warning: The partition table looks like it was made
  for C/H/S=*/181/40 (instead of 652/255/63).
For this listing I'll assume that geometry.
Units: cylinders of 3706880 bytes, blocks of 1024 bytes, counting from 0
   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sdb1          0+   1448-   1449-   5241856   8e  Linux LVM
sfdisk:                 start: (c,h,s) expected (0,51,9) found (0,32,33)
sfdisk:                 end: (c,h,s) expected (1023,180,40) found (652,180,40)
/dev/sdb2          0       -       0          0    0  Empty
/dev/sdb3          0       -       0          0    0  Empty
/dev/sdb4          0       -       0          0    0  Empty

동일한 방법으로 sdc 디스크도 적용 후 확인 한다.
[root@cy_vm2 ~]# sfdisk -l /dev/sdc
Disk /dev/sdc: 652 cylinders, 255 heads, 63 sectors/track
sfdisk: Warning: The partition table looks like it was made
  for C/H/S=*/181/40 (instead of 652/255/63).
For this listing I'll assume that geometry.
Units: cylinders of 3706880 bytes, blocks of 1024 bytes, counting from 0
   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sdc1          0+   1448-   1449-   5241856   8e  Linux LVM
sfdisk:                 start: (c,h,s) expected (0,51,9) found (0,32,33)
sfdisk:                 end: (c,h,s) expected (1023,180,40) found (652,180,40)
/dev/sdc2          0       -       0          0    0  Empty
/dev/sdc3          0       -       0          0    0  Empty
/dev/sdc4          0       -       0          0    0  Empty


4.Manage Phisical Volumes

Phisical Volumes을 생성 하기 위해서 pvcreate 를 이용하여 앞서 작업한 파티션을 Phisical Volumes으로 생성 한다.
[root@cy_vm2 ~]#  pvcreate /dev/sdb1 /dev/sdc1
  Physical volume "/dev/sdb1" successfully created.
  Physical volume "/dev/sdc1" successfully created.

pvremove 를 이용하여 Phisical Volumes을 삭제 할 수 있다.
[root@cy_vm2 ~]#  pvremove /dev/sdb1 /dev/sdc1              
  Labels on physical volume "/dev/sdb1" successfully wiped.
  Labels on physical volume "/dev/sdc1" successfully wiped.
다시  Phisical Volumes을 생성한뒤 pvdisplay을 통하여 Phisical Volumes 상태를 확인 한다.
각각 5G 사이즈가 할당 된것을 확인 할 수 있다.

[root@cy_vm2 ~]#  pvcreate /dev/sdb1 /dev/sdc1
  Physical volume "/dev/sdb1" successfully created.
  Physical volume "/dev/sdc1" successfully created.
[root@cy_vm2 ~]# pvdisplay
  "/dev/sdb1" is a new physical volume of "<5.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/sdb1
  VG Name               
  PV Size               <5.00 GiB
  Allocatable           NO
  PE Size               0   
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               EatAgM-efno-Uke7-TqNs-cE1m-1fCV-Qi4q0p
   
  "/dev/sdc1" is a new physical volume of "<5.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/sdc1
  VG Name               
  PV Size               <5.00 GiB
  Allocatable           NO
  PE Size               0   
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               D3HwrG-MpeH-HX35-lvtG-i9Uu-jnwY-11BUHf

pvresize를 통하여 생성된 Phisical Volumes의 크기를 조절 할 수 있다. 아래와같이 setphysicalvolumesize옵션을 통하여 
/dev/sdb1 의 Phisical Volumes 사이즈를 4G 로 조절 한다.
[root@cy_vm2 ~]# pvresize --setphysicalvolumesize 4G /dev/sdb1   
/dev/sdb1: Requested size 4.00 GiB is less than real size <5.00 GiB. Proceed?  [y/n]: y
  WARNING: /dev/sdb1: Pretending size is 8388608 not 10483712 sectors.
  Physical volume "/dev/sdb1" changed
  1 physical volume(s) resized / 0 physical volume(s) not resized

pvdisplay 통하여 조절된 사이즈를 확인 한다.

[root@cy_vm2 ~]# pvdisplay                     
  "/dev/sdb1" is a new physical volume of "4.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/sdb1
  VG Name               
  PV Size               4.00 GiB
  Allocatable           NO
  PE Size               0   
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               EatAgM-efno-Uke7-TqNs-cE1m-1fCV-Qi4q0p
   
  "/dev/sdc1" is a new physical volume of "<5.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/sdc1
  VG Name               
  PV Size               <5.00 GiB
  Allocatable           NO
  PE Size               0   
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               D3HwrG-MpeH-HX35-lvtG-i9Uu-jnwY-11BUHf
   

pvs 명령어를 통하여 레포트 형태로 확인 가능 하다.
[root@cy_vm2 ~]#  pvs /dev/sdb1 /dev/sdc1
  PV         VG Fmt  Attr PSize  PFree
  /dev/sdb1     lvm2 ---   4.00g  4.00g
  /dev/sdc1     lvm2 ---  <5.00g <5.00g

5.Manage Logical Volumes
vgcreate 명령어를 통하여 Volume Groups 에 sdb1.sdc1을 추가 하여 생성한다 . vg이름은 vg_target 으로 생성 한다.
[root@cy_vm2 ~]# vgcreate vg_target /dev/sdb1  /dev/sdc1
  Volume group "vg_target" successfully created
Volume Groups은 아래 그림과 같이 Group 이 되었다고 보면 된다


vgdisplay 를 통하여 생성한  Volume Groups 인 vg_target 의 정보를 확인 할 수 있다.

[root@cy_vm2 ~]# vgdisplay
  --- Volume group ---
  VG Name               vg_target
  System ID             
  Format                lvm2
  Metadata Areas        2
  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                2
  Act PV                2
  VG Size               8.99 GiB
  PE Size               4.00 MiB
  Total PE              2302
  Alloc PE / Size       0 / 0   
  Free  PE / Size       2302 / 8.99 GiB
  VG UUID               hGRNXb-Abn0-6kSd-UM59-TjZy-IDdx-ZYKBoN

vgs를 통하여 레포트 형태로 확인 가능하다.
[root@cy_vm2 ~]# vgs
  VG        #PV #LV #SN Attr   VSize VFree
  vg_target   2   0   0 wz--n- 8.99g 8.99g

vgscan을 통하여 Volume Groups을 scan 할 수 있다.
[root@cy_vm2 ~]# vgscan
  Reading volume groups from cache.
  Found volume group "vg_target" using metadata type lvm2

vgreduce을 통하여 특정 Volume Groups에 파티션을 아래와 같이 제거 할 수 있다.
[root@cy_vm2 ~]# vgreduce vg_target /dev/sdc1     
  Removed "/dev/sdc1" from volume group "vg_target"

vgdisplay 통하여 sdc1를 제거한 Volume Groups에 VG Size 가 변경 된것을 확인 할 수 있다.

[root@cy_vm2 ~]# vgdisplay
  --- Volume group ---
  VG Name               vg_target
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  2
  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               <4.00 GiB
  PE Size               4.00 MiB
  Total PE              1023
  Alloc PE / Size       0 / 0   
  Free  PE / Size       1023 / <4.00 GiB
  VG UUID               hGRNXb-Abn0-6kSd-UM59-TjZy-IDdx-ZYKBoN

vgextend을 통하여 다시 제거한 sdc1를 추가 혹은 새로운 파티션을 추가 할 수 있다.

[root@cy_vm2 ~]# vgextend vg_target /dev/sdc1
  Volume group "vg_target" successfully extended

vgdisplay을 통하여 추가된 VG Size 를 확인 한다

[root@cy_vm2 ~]# vgdisplay
  --- Volume group ---
  VG Name               vg_target
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               8.99 GiB
  PE Size               4.00 MiB
  Total PE              2302
  Alloc PE / Size       0 / 0   
  Free  PE / Size       2302 / 8.99 GiB
  VG UUID               hGRNXb-Abn0-6kSd-UM59-TjZy-IDdx-ZYKBoN

6.Manage Logical Volumes

lvcreate를 통하여 vg_target로 생성한  Volume Groups 을 추가한 Logical Volumes을 생성 한다.
-L 옵션을 통하여 vgdisplay 를 통하여 확인한 VG  Size 만큼 용량을 지정 할 수 있으며 
"-l 100%FREE " 와 같이 활용 할 수 있다.(EX. lvcreate  -l 100%FREE lv_target vg_target)

[root@cy_vm2 ~]# lvcreate -L 8.9G -n lv_target vg_target
  Rounding up size to full physical extent 8.90 GiB
  Logical volume "lv_target" created.

논리적으로 아래그림과 같이 volume group 에 logical volume 을 추가 했다고 볼 수 있다.

lvdisplay를 통하여 생성된 Logical Volumes을 확인 할 수 있다. 
아래는 LV Size8.9G로  /dev/vg_target/lv_target 경로에 Logical Volumes이 생성 된 것을 확인 할 수 있다.

[root@cy_vm2 ~]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/vg_target/lv_target
  LV Name                lv_target
  VG Name                vg_target
  LV UUID                dExy71-dzth-7n4I-mpxT-91cP-0h3T-FmKrHR
  LV Write Access        read/write
  LV Creation host, time cy_vm2, 2018-01-14 15:20:28 +0900
  LV Status              available
  # open                 0
  LV Size                8.90 GiB
  Current LE             2279
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0

생성된 /dev/vg_target/lv_target경로의 Logical Volumes 확인 하면 /dev/dm-0으로 링크 된것을 볼 수 있다.

[root@cy_vm2 ~]# ls -al /dev/vg_target/lv_target
lrwxrwxrwx 1 root root 7  1월 14 15:20 /dev/vg_target/lv_target -> ../dm-0

실제로  /dev/dm-0 에 block 형태로 생성 된것을 확인 할 수 있다.

[root@cy_vm2 ~]# ls -al /dev/dm-0
brw-rw---- 1 root disk 253, 0  1월 14 15:20 /dev/dm-0
lvs으로 레포트 형태로 확인 할 수 있다.
[root@cy_vm2 ~]# lvs
  LV        VG        Attr       LSize Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lv_target vg_target -wi-a----- 8.90g                                                    

lvscan으로 Logical Volumes을 scan 할 수 있다.
[root@cy_vm2 ~]# lvscan
  ACTIVE            '/dev/vg_target/lv_target' [8.90 GiB] inherit                            
lvextend 으로 Logical Volumes 의 size 를 확장 할 수 있다.

[root@cy_vm2 ~]# lvextend -L 8.99G /dev/vg_target/lv_target  
  Rounding size to boundary between physical extents: 8.99 GiB.
  Size of logical volume vg_target/lv_target changed from 8.90 GiB (2279 extents) to 8.99 GiB (2302 extents).
  Logical volume vg_target/lv_target successfully resized.              
lvdisplay으로 확장된 용량을 확인 한다.
[root@cy_vm2 ~]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/vg_target/lv_target
  LV Name                lv_target
  VG Name                vg_target
  LV UUID                dExy71-dzth-7n4I-mpxT-91cP-0h3T-FmKrHR
  LV Write Access        read/write
  LV Creation host, time cy_vm2, 2018-01-14 15:20:28 +0900
  LV Status              available
  # open                 0
  LV Size                8.99 GiB
  Current LE             2302
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0
   

mkfs.ext4혹은 원한는 파일 타입으로 Logical Volumes 후 마운트 진행 한다.

[root@cy_vm2 ~]# mkfs.ext4 /dev/vg_target/lv_target
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
589824 inodes, 2357248 blocks
117862 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2151677952
72 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

마운트후 실제 디바이스를 확인 할 수 있다.
[root@cy_vm2 ~]# mount /dev/vg_target/lv_target /mnt
[root@cy_vm2 ~]# df -h /mnt
Filesystem                       Size  Used Avail Use% Mounted on
/dev/mapper/vg_target-lv_target  8.8G   37M  8.3G   1% /mnt
                                                

mount 명령어로 추가된 디바이스를 umount 후 fstab 등록 하여 정상적으로 마운트 되는지 확인 한다.
[root@cy_vm2 ~]# umount /mnt
[root@cy_vm2 ~]# blkid  | grep lv_target
/dev/mapper/vg_target-lv_target: UUID="ccd686e9-5db7-4e09-b33c-2dfe7b990cba" TYPE="ext4"
[root@cy_vm2 ~]# echo "        
UUID=ccd686e9-5db7-4e09-b33c-2dfe7b990cba /mnt                       ext4     defaults        0 0" >> /etc/fstab
[root@cy_vm2 ~]# mount -a
[root@cy_vm2 ~]# df -h /mnt
Filesystem                       Size  Used Avail Use% Mounted on
/dev/mapper/vg_target-lv_target  8.8G   37M  8.3G   1% /mnt



7.LVM 볼륨 확장 

아래 그림과 같이 기존의 sdb,sdc 디스크를 이용하여 LVM 으로 묶은 LVM 파일시스템에 추가적으로 sdd 라는 새로운 디스크를 추가하여 
기존에 마운트 되어 있는 Logical Volumes사이즈를 확장 하려고 한다.

/dev/sdd 디스크가  있는 것을 확인 한다.
[root@cy_vm2 ~]# fdisk  -l /dev/sdd
Disk /dev/sdd: 5368 MB, 5368709120 bytes, 10485760 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

fdisk /dev/sdd 를 이용하여 LVM 파일시스템으로 파티션을 생성한다.

[root@cy_vm2 ~]# fdisk /dev/sdd
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xc69337b5.
Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-10485759, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-10485759, default 10485759):
Using default value 10485759
Partition 1 of type Linux and of size 5 GiB is set
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'
Command (m for help): p
Disk /dev/sdd: 5368 MB, 5368709120 bytes, 10485760 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: 0xc69337b5
   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1            2048    10485759     5241856   8e  Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.

 pvcreate 으로 Physical volume 에 /dev/sdd1 을 추가 한다.


[root@cy_vm2 ~]# pvcreate /dev/sdd1
  Physical volume "/dev/sdd1" successfully created.

vgextend 으로 기존에 생성된  Volume group 인 vg_target에 /dev/sdd1을 추가 한다

[root@cy_vm2 ~]# vgextend vg_target /dev/sdd1
  Volume group "vg_target" successfully extended
[root@cy_vm2 ~]# vgdisplay
  --- Volume group ---
  VG Name               vg_target
  System ID             
  Format                lvm2
  Metadata Areas        3
  Metadata Sequence No  6
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                3
  Act PV                3
  VG Size               <13.99 GiB
  PE Size               4.00 MiB
  Total PE              3581
  Alloc PE / Size       2302 / 8.99 GiB
  Free  PE / Size       1279 / <5.00 GiB
  VG UUID               hGRNXb-Abn0-6kSd-UM59-TjZy-IDdx-ZYKBoN
   

lvextend으로  Logical volume사이즈를 확장 한다.
[root@cy_vm2 ~]# lvextend -L 13G /dev/vg_target/lv_target     
  Size of logical volume vg_target/lv_target changed from 8.99 GiB (2302 extents) to 13.00 GiB (3328 extents).
  Logical volume vg_target/lv_target successfully resized.

df 를 확인 하면 용량의 변화가 없다
[root@cy_vm2 ~]# df -h /mnt/
Filesystem                       Size  Used Avail Use% Mounted on
/dev/mapper/vg_target-lv_target  8.8G   37M  8.3G   1% /mnt

ext4 로 된경우 resize2fs 통하여 사이즈를 확인 해줘야 df 에서 확장된 용량을 확인 할 수 있다.
[root@cy_vm2 ~]# resize2fs /dev/vg_target/lv_target 13G
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/vg_target/lv_target is mounted on /mnt; on-line resizing required
old_desc_blocks = 2, new_desc_blocks = 2
The filesystem on /dev/vg_target/lv_target is now 3407872 blocks long.
df를 통하여 정상적으로 확장 된것을 확인 한다.

[root@cy_vm2 ~]# df -h /mnt/
Filesystem                       Size  Used Avail Use% Mounted on
/dev/mapper/vg_target-lv_target   13G   41M   13G   1% /mnt


최종적으로 아래와 같이 3개의 물리 디스크를 묶어서 Logical group 을 만들어 1개의 논리적인 디스크를 마운트 하여 
유연하게 디스크를 관리 할 수 있다.


반응형