728x90
반응형
문 서 명 : Redhat Linux LVM 관리 문 서 버 전 : Ver_1.0 문 서 구 분 : ■ Manual □ Summary 작 성 일 : 2016년 04월 19일 작 성 자 : 우리들의 삶 테 스 트 환 경 : Redhat Entprise Linux 6.7 출 처 : 본인 |
본 문서는 Redhat계열 Linux6 버전에서 LVM관리에 대한 내용을 기술한다.
- 개요
.png)
물리디스크(PP)를 PV(Phisycal Volume)로 변환하고, PV 단수, 혹은 복수를 VG(Volume Group)로 만들게 되면
일정한 크기의 PE가 만들어진다.(디스크 섹터와 비슷한 개념)
그리고 VG의 일부 공간 혹은 전체를 LV(Logical Volume)으로 할당하게 되면, 할당 받은 공간만큼 LE(디스크 섹터와 비슷한 개념)가 만들어 진다.
- 디스크 확인
[root@hsy-test ~]# fdisk -l Disk /dev/sda: 17.2 GB, 17179869184 bytes 64 heads, 32 sectors/track, 16384 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000e305e Device Boot Start End Blocks Id System /dev/sda1 * 2 501 512000 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 502 16384 16264192 8e Linux LVM Partition 2 does not end on cylinder boundary. Disk /dev/mapper/vg_hsytest-lv_root: 14.9 GB, 14935916544 bytes 255 heads, 63 sectors/track, 1815 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/mapper/vg_hsytest-lv_swap: 1715 MB, 1715470336 bytes 255 heads, 63 sectors/track, 208 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/sdb: 1073 MB, 1073741824 bytes 34 heads, 61 sectors/track, 1011 cylinders Units = cylinders of 2074 * 512 = 1061888 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 |
- PV 만들기
[root@hsy-test ~]# pvcreate /dev/sdb <-- PV(Phisycal Volume) 생성 명령어 [root@hsy-test ~]# pvs <-- PV 리스트 확인, # pvdisplay 명령을 통해서도 확인 가능 PV VG Fmt Attr PSize PFree /dev/sda2 vg_hsytest lvm2 a-- 15.51g 0 /dev/sdb lvm2 --- 1.00g 1.00g <-- 물리디스크 /dev/sdb 가 LVM2버전으로 PV 전환되었음을 알 수 있다. |
- VG 만들기
[root@hsy-test ~]# vgcreate vg_raw /dev/sdb <-- VG(Volume Group) 생성 명령어, 만약 여러개의 PV를 묶어 Pool 처럼 만들고자 할 때에는 띄어쓰기하여 디스크 장치를 명시해준다. Volume group "vg_raw" successfully created [root@hsy-test ~]# vgs <-- VG 리스트 확인 # vgdisplay 명령을 통해서도 확인 가능 VG #PV #LV #SN Attr VSize VFree vg_hsytest 1 2 0 wz--n- 15.51g 0 vg_raw 1 0 0 wz--n- 1020.00m 1020.00m |
- LV 만들기
[root@hsy-test ~]# lvcreate -n dev1G1 -L 100M vg_raw Logical volume "dev1G1" created. TIP : -n : LV Name을 지정 -L : LV Size를 지정 vg_raw : LV가 속할 VG를 명시 [root@hsy-test ~]# lvs <- LV 리스트 확인, # lvscan 혹은 # lvdisplay 명령으로도 확인 가능 LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert lv_root vg_hsytest -wi-ao---- 13.91g lv_swap vg_hsytest -wi-ao---- 1.60g dev1G1 vg_raw -wi-a----- 100.00m [root@hsy-test ~]# ls -al /dev/vg_raw/dev1G1 <-- 해당 위치를 mkfs 명령을 통해 포맷하여 mount 하면 된다. lrwxrwxrwx. 1 root root 7 2016-04-18 11:03 /dev/vg_raw/dev1G1 -> ../dm-2 tip : /dev/VG_name/LV_name |
- LV 여러개를 만들어야 될 때
#!/bin/sh index=1 while [ ${index} -le 42 ];do lvcreate -n dev10G${index} -L 10G vg_raw index=$((index + 1)) done |
tip :
index변수 : 총 몇개의 LV를 생성할 것인지를 정의하는 변수로 초기 값은 1을 가진다.
while 조건문 : -le 의 뜻은 '크거나 같다' 의 의미이며, 위 명령은 '$index 가 42가 될 때까지 조건이 참' 이란 뜻이다.
lvcreat : 'dev10G${index}' 는 LV 이름을 의미한다 즉 이 경우 LV는 'dev10G1 ~ dev10G42' 까지 생성된다.
'-L 10G' 는 LV의 크기를 의미
'vg_raw' 는 LV가 속한 VG(volume group)를 명시
728x90
반응형
'시스템 > Operating System' 카테고리의 다른 글
[VMware, Redhat 6] VM환경의 Linux OS 디스크 사이즈 늘리기 (0) | 2016.11.02 |
---|---|
[Solaris] 솔라리스 패스워드 복잡성 설정 (0) | 2016.09.30 |
[Redhat 6] RAW Device 생성 및 관리 방법 (0) | 2016.09.06 |
[Linux, AIX] LV 여러개 만들 때 유용한 스크립트!! (0) | 2016.09.06 |
[Redhat 6] CPU Core Disable 하는 방법!! (0) | 2016.09.06 |