강좌
클라우드/리눅스에 관한 강좌입니다.
클라우드 분류

네이버클라우드 실무사용법011 : LVM 구성하기

작성자 정보

  • 관리자 작성
  • 작성일

컨텐츠 정보

본문

실습. LVM 구성하기

 

 2420209719cffc021205a4286a6166be_1694739283_438.png

disk2번과 disk3번을 하나의 볼륨그룹으로 묶어서 로지컬볼륨 생성하기

 

  1. 현재 확인 : lsblk, df


[root@ss-test-linux01 ~]# lsblk

NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

xvda    202:0    0  50G  0 disk

├─xvda1 202:1    0   1G  0 part /boot

└─xvda2 202:2    0  49G  0 part /

xvdb    202:16   0  10G  0 disk

└─xvdb1 202:17   0  10G  0 part /disk1

xvdc    202:32   0  10G  0 disk

xvdd    202:48   0  10G  0 disk

[root@ss-test-linux01 ~]#

[root@ss-test-linux01 ~]# df

Filesystem     1K-blocks    Used Available Use% Mounted on

devtmpfs         1881300       0   1881300   0% /dev

tmpfs            1899800       0   1899800   0% /dev/shm

tmpfs            1899800    8684   1891116   1% /run

tmpfs            1899800       0   1899800   0% /sys/fs/cgroup

/dev/xvda2      51354116 3649088  47705028   8% /

/dev/xvda1       1038336  257140    781196  25% /boot

tmpfs             379960       0    379960   0% /run/user/0

/dev/xvdb1      10254612   63652   9650340   1% /disk1

[root@ss-test-linux01 ~]#

 


2. 마운트포인트 생성 : mkdir /lvm


[root@ss-test-linux01 ~]# mkdir /lvm

 


3. 파티션작업


fdisk /dev/xvdc  (
이때 파티션타입을 8e로 할것(Linux LVM 타입)


[root@ss-test-linux01 ~]# fdisk /dev/xvdc

 

Welcome to fdisk (util-linux 2.32.1).

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

 

 

Command (m for help): n

Partition type

   p   primary (0 primary, 0 extended, 4 free)

   e   extended (container for logical partitions)

Select (default p): p

Partition number (1-4, default 1):1

First sector (2048-20971519, default 2048):

Last sector, +sectors or +size{K,M,G,T,P} (2048-20971519, default 20971519):

 

Created a new partition 1 of type 'Linux' and of size 10 GiB.

 

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): w

The partition table has been altered.

Calling ioctl() to re-read partition table.

Syncing disks.

 

[root@ss-test-linux01 ~]#

 


fdisk /dev/xvdd  (이때 파티션타입을 8e로 할것(Linux LVM 타입)


[root@ss-test-linux01 ~]# fdisk /dev/xvdd

 

Welcome to fdisk (util-linux 2.32.1).

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

 

 

Command (m for help): n

Partition type

   p   primary (0 primary, 0 extended, 4 free)

   e   extended (container for logical partitions)

Select (default p): p

Partition number (1-4, default 1):1

First sector (2048-20971519, default 2048):

Last sector, +sectors or +size{K,M,G,T,P} (2048-20971519, default 20971519):

 

Created a new partition 1 of type 'Linux' and of size 10 GiB.

 

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): w

The partition table has been altered.

Calling ioctl() to re-read partition table.

Syncing disks.

 

[root@ss-test-linux01 ~]#

 


두개의 스토리지를 파티셔닝 한 후에는 다음과 같이 lsblk로 파티셔닝 된 것을 확인한다.

 

[root@ss-test-linux01 ~]# lsblk

NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

xvda    202:0    0  50G  0 disk

├─xvda1 202:1    0   1G  0 part /boot

└─xvda2 202:2    0  49G  0 part /

xvdb    202:16   0  10G  0 disk

└─xvdb1 202:17   0  10G  0 part /disk1

xvdc    202:32   0  10G  0 disk

└─xvdc1 202:33   0  10G  0 part

xvdd    202:48   0  10G  0 disk

└─xvdd1 202:49   0  10G  0 part

[root@ss-test-linux01 ~]#

 


4. 피지컬볼륨 생성 :


 pvcreate /dev/xvdc1                          

 pvcreate /dev/xvdd1


[root@ss-test-linux01 ~]# pvcreate /dev/xvdc1

  Physical volume "/dev/xvdc1" successfully created.

[root@ss-test-linux01 ~]#

[root@ss-test-linux01 ~]# pvcreate /dev/xvdd1

  Physical volume "/dev/xvdd1" successfully created.

[root@ss-test-linux01 ~]#

 


5.볼륨그룹 생성 : 


 vgcreate lvmVG /dev/xvdc1 /dev/xvdd1


[root@ss-test-linux01 ~]# vgcreate lvmVG /dev/xvdc1 /dev/xvdd1

  Volume group "lvmVG" successfully created

[root@ss-test-linux01 ~]#

 


6. 생성한 볼륨그룹 확인 :


  vgdisplay


[root@ss-test-linux01 ~]# vgdisplay

  --- Volume group ---

  VG Name               lvmVG

  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               19.99 GiB

  PE Size               4.00 MiB

  Total PE              5118

  Alloc PE / Size       0 / 0

  Free  PE / Size       5118 / 19.99 GiB

  VG UUID               RBa2fd-qn0s-Bx0N-6s10-lSfo-3C14-UjqdWM

 

[root@ss-test-linux01 ~]#

 


7. 로지컬볼륨생성 :


 lvcreate --extents 100%FREE -n lvmLV lvmVG


[root@ss-test-linux01 ~]# lvcreate --extents 100%FREE -n lvmLV lvmVG

  Logical volume "lvmLV" created.

[root@ss-test-linux01 ~]#

 


8. 로지컬 볼륨생성 확인 : lsblk


[root@ss-test-linux01 ~]# lsblk

NAME            MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

xvda            202:0    0  50G  0 disk

├─xvda1         202:1    0   1G  0 part /boot

└─xvda2         202:2    0  49G  0 part /

xvdb            202:16   0  10G  0 disk

└─xvdb1         202:17   0  10G  0 part /disk1

xvdc            202:32   0  10G  0 disk

└─xvdc1         202:33   0  10G  0 part

  └─lvmVG-lvmLV 253:0    0  20G  0 lvm

xvdd            202:48   0  10G  0 disk

└─xvdd1         202:49   0  10G  0 part

  └─lvmVG-lvmLV 253:0    0  20G  0 lvm

[root@ss-test-linux01 ~]#

 


9 . 로지컬볼륨 파일시스템 생성(포맷)작업 :


 mkfs.ext4 /dev/lvmVG/lvmLV


[root@ss-test-linux01 ~]# mkfs.ext4 /dev/lvmVG/lvmLV

mke2fs 1.45.6 (20-Mar-2020)

Creating filesystem with 5240832 4k blocks and 1310720 inodes

Filesystem UUID: 20626e48-ada7-4ead-b6e7-38d290d093ee

Superblock backups stored on blocks:

        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,

        4096000

 

Allocating group tables: done

Writing inode tables: done

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done

 

[root@ss-test-linux01 ~]#

 


10. 로지컬볼륨 마운트작업 :


 mount /dev/lvmVG/lvmLV /lvm


[root@ss-test-linux01 ~]# mkdir /lvm

mkdir: cannot create directory ‘/lvm’: File exists

[root@ss-test-linux01 ~]#

[root@ss-test-linux01 ~]# mount /dev/lvmVG/lvmLV /lvm

[root@ss-test-linux01 ~]#

 


11. 최종 확인 : 


 lsblk 또는 df


[root@ss-test-linux01 ~]# lsblk

NAME            MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

xvda            202:0    0  50G  0 disk

├─xvda1         202:1    0   1G  0 part /boot

└─xvda2         202:2    0  49G  0 part /

xvdb            202:16   0  10G  0 disk

└─xvdb1         202:17   0  10G  0 part /disk1

xvdc            202:32   0  10G  0 disk

└─xvdc1         202:33   0  10G  0 part

  └─lvmVG-lvmLV 253:0    0  20G  0 lvm  /lvm

xvdd            202:48   0  10G  0 disk

└─xvdd1         202:49   0  10G  0 part

  └─lvmVG-lvmLV 253:0    0  20G  0 lvm  /lvm

[root@ss-test-linux01 ~]#

[root@ss-test-linux01 ~]# df

Filesystem              1K-blocks    Used Available Use% Mounted on

devtmpfs                  1881300       0   1881300   0% /dev

tmpfs                     1899800       0   1899800   0% /dev/shm

tmpfs                     1899800    8696   1891104   1% /run

tmpfs                     1899800       0   1899800   0% /sys/fs/cgroup

/dev/xvda2               51354116 3649588  47704528   8% /

/dev/xvda1                1038336  257140    781196  25% /boot

tmpfs                      379960       0    379960   0% /run/user/0

/dev/xvdb1               10254612   63652   9650340   1% /disk1

/dev/mapper/lvmVG-lvmLV  20503120   45080  19393492   1% /lvm

[root@ss-test-linux01 ~]#

 

 

관련자료

댓글 0
등록된 댓글이 없습니다.

공지사항


뉴스광장


  • 현재 회원수 :  60,035 명
  • 현재 강좌수 :  35,794 개
  • 현재 접속자 :  138 명