os: devian4.0 , centos5
lvm2 패키지를 설치한다.
fdisk 작업후 재부팅없이 커널에 적용시키기 위해 parted 패키지를 설치한다.
debian: apt-get install lvm2
centos: yum -y install lvm2
debian: apt-get install parted
centos: yum -y install parted
lvm 묶을 하드 파티션 나누기
Hex code (type L to list codes): 8e 로 파티션 나눈다.
/dev/sdb1 1 243201 1953512001 8e Linux LVM
/dev/sdc1 1 243201 1953512001 8e Linux LVM
/dev/sdd1 1 243201 1953512001 8e Linux LVM
/dev/sde1 1 243201 1953512001 8e Linux LVM
physical volume (물리적 볼륨, PV) :
하드디스크를 의미한다. /dev/sda9, /dev/sda10 같은.
volume group (볼륨그룹,VG) :
LVM에 사용되는 최상위 추상화 계층이다.
하나의 VG는 여러 PV로 이뤄진다. 즉, PV의 그룹이다.
logical volume (논리적 볼륨, LV) :
LVM이 아닌곳에서의 디스크 파티션과 동일한 개념이다.
LV는 VG에서 새로운 파티션을 생성한다. 이는 하나의 block device처럼 동작한다.
physical extent (물리 확장, PE) :
PV를 구성하는 할당단위.
PE의 갯수는 PV용량에서 PE블록의 크기를 나눈 값이다.
예를들어, PV의 크기가 1G이고 PE 블록의 크기가 4M 이면 PE는 모두 250개이다.
logical extent (논리 확장, LE) :
LV를 구성하는 각각의 조각이고 확장의 크기는 해당 VG의 모든 LV와 같다 ???
PV를 생성한다.
[root@www]# pvcreate /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1
Physical volume "/dev/sdb1" successfully created
Physical volume "/dev/sdc1" successfully created
Physical volume "/dev/sdd1" successfully created
Physical volume "/dev/sde1" successfully created
pvdisplay 정상 생성 확인
[root@www ILAYA]# pvdisplay | grep dev
"/dev/sdb1" is a new physical volume of "1.82 TB"
PV Name /dev/sdb1
"/dev/sdc1" is a new physical volume of "1.82 TB"
PV Name /dev/sdc1
"/dev/sdd1" is a new physical volume of "1.82 TB"
PV Name /dev/sdd1
"/dev/sde1" is a new physical volume of "1.82 TB"
PV Name /dev/sde1
VG를 생성한다.
[root@www]# vgcreate vg01 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1
Volume group "vg01" successfully created
vgdisplay 정상 확인
VG Name vg01
VG Access read/write
VG Status resizable
VG Size 7.28 TB
VG UUID iTrIl4-GLtm-3f4o-PfZU-YKeY-7Pdu-Au6HoS
생성한 VG를 활성화 한다.
[root@www ~]# vgchange -a y vg01
0 logical volume(s) in volume group "vg01" now active
LV를 생성한다.
[root@www ~]# lvcreate -L 7.28TB -n backup vg01
Rounding up size to full physical extent 7.28 TB
Insufficient free extents (1907724) in volume group vg01: 1908409 required
[root@www ~]# lvcreate -L 7.1TB -n backup vg01
Rounding up size to full physical extent 7.10 TB
Logical volume "backup" created
[root@www ~]# lvdisplay | grep LV
LV Name /dev/vg01/backup
LV UUID edfBI0-mIO2-jwJX-kZ7P-yrII-ys6O-wkR30C
LV Write Access read/write
LV Status available
LV Size 7.10 TB
여기까지 진행되면 /dev에 장치파일이 자동적으로 생성된다.
만약, 생성되지 않았다면 partprobe를 실행시킨다.
[root@www ~]# ls -al /dev/vg01/backup
lrwxrwxrwx 1 root root 23 Jun 14 16:32 /dev/vg01/backup -> /dev/mapper/vg01-backup
lvm 디스크 파티션 설정이 모두 끝났다.
LV에 파일시스템을 생성한다.
ext4 포맷하기
mkfs.ext4 /dev/mapper/vg01-backup
mkdir /BACKUP
mount /dev/mapper/vg01-backup /BACKUP
/dev/mapper/vg01-backup 7.0T 177M 6.7T 1% /BACKUP
용량을 더 늘려보자.
아래 내용은 예전에 테스트 했던 부분임.
PV를 생성해서 VG에 추가해주고 LV를 원하는 용량을 + 해주면 된다.
ddong ~ # fdisk /dev/sda (새로운 PV에 할당할 파티션을 생성, /dev/sda7)
ddong ~ # partprobe
debian:~# pvcreate /dev/sda7
Physical volume "/dev/sda7" successfully created
debian:~# vgextend vg01 /dev/sda7
Volume group "vg01" successfully extended
debian:~# lvextend -L +500M /dev/vg01/guk
Extending logical volume guk to 2.25 GB
Logical volume guk successfully resized
lv용량을 줄이려고 할때는 lvreduce 명령어를 사용한다.
옵션이나 사용방식은 lvextend와 동일하다.
debian:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 3.7G 391M 3.1G 11% /
tmpfs 126M 0 126M 0% /lib/init/rw
udev 10M 64K 10M 1% /dev
tmpfs 126M 0 126M 0% /dev/shm
/dev/sda1 92M 12M 75M 14% /boot
/dev/mapper/vg01-guk 1.8G 35M 1.7G 3% /guk
LV의 용량을 늘였지만 파티션 사이즈는 그대로이다.
resize2fs로 파티션 크기를 늘여준다.
man resize2fs를 참조한다.
debian:~# resize2fs /dev/vg01/guk
resize2fs 1.40-WIP (14-Nov-2006)
Filesystem at /dev/vg01/guk is mounted on /guk; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/vg01/guk to 588800 (4k) blocks.
The filesystem on /dev/vg01/guk is now 588800 blocks long.
debian:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 3.7G 391M 3.1G 11% /
tmpfs 126M 0 126M 0% /lib/init/rw
udev 10M 64K 10M 1% /dev
tmpfs 126M 0 126M 0% /dev/shm
/dev/sda1 92M 12M 75M 14% /boot
/dev/mapper/vg01-guk 2.3G 35M 2.1G 2% /guk
완성된 LVM 형태.
debian:~# vgdisplay -v
Finding all volume groups
Finding volume group "vg01"
--- Volume group ---
VG Name vg01
System ID
Format lvm2
Metadata Areas 3
Metadata Sequence No 4
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 3.71 GB
PE Size 4.00 MB
Total PE 950
Alloc PE / Size 575 / 2.25 GB
Free PE / Size 375 / 1.46 GB
VG UUID 0dAKNz-fiOz-H80j-sT3T-pEtq-Tv2E-SNDsLp
--- Logical volume ---
LV Name /dev/vg01/guk
VG Name vg01
LV UUID Oxw2iG-w8WL-ncBB-7adD-mrph-FzEB-zByapR
LV Write Access read/write
LV Status available
# open 1
LV Size 2.25 GB
Current LE 575
Segments 3
Allocation inherit
Read ahead sectors 0
Block device 254:0
--- Physical volumes ---
PV Name /dev/sda5
PV UUID C6BqAu-smJb-CSnL-Eiok-iNpr-23Mx-uA7whr
PV Status allocatable
Total PE / Free PE 241 / 0
PV Name /dev/sda6
PV UUID a3Km9T-1F23-7Hzt-T1WL-liuZ-vqzm-vFCNO2
PV Status allocatable
Total PE / Free PE 241 / 0
PV Name /dev/sda7
PV UUID fVYkBu-USZZ-gVaT-24jM-Q04J-uHeJ-Lymqzt
PV Status allocatable
Total PE / Free PE 468 / 375
debian:~# lvscan
ACTIVE '/dev/vg01/guk' [2.25 GB] inherit
debian:~# pvscan
PV /dev/sda5 VG vg01 lvm2 [964.00 MB / 0 free]
PV /dev/sda6 VG vg01 lvm2 [964.00 MB / 0 free]
PV /dev/sda7 VG vg01 lvm2 [1.83 GB / 1.46 GB free]
Total: 3 [3.71 GB] / in use: 3 [3.71 GB] / in no VG: 0 [0 ]
debian:~# vgscan
Reading all physical volumes. This may take a while...
Found volume group "vg01" using metadata type lvm2
good luck~~~
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 8230 | 9년 전 | 68 | ||
| 8229 | 9년 전 | 68 | ||
| 8228 |
커네드커네드
|
9년 전 | 112 | |
| 8227 | 9년 전 | 123 | ||
| 8226 | 9년 전 | 159 | ||
| 8225 | 9년 전 | 149 | ||
| 8224 | 9년 전 | 144 | ||
| 8223 | 9년 전 | 113 | ||
| 8222 |
|
9년 전 | 183 | |
| 8221 | 9년 전 | 88 | ||
| 8220 | 9년 전 | 101 | ||
| 8219 | 9년 전 | 97 | ||
| 8218 | 9년 전 | 138 | ||
| 8217 |
star3840
|
9년 전 | 112 | |
| 8216 | 9년 전 | 160 | ||
| 8215 | 9년 전 | 110 | ||
| 8214 | 9년 전 | 221 | ||
| 8213 | 9년 전 | 156 | ||
| 8212 | 9년 전 | 82 | ||
| 8211 | 9년 전 | 241 | ||
| 8210 | 9년 전 | 242 | ||
| 8209 | 9년 전 | 334 | ||
| 8208 | 9년 전 | 215 | ||
| 8207 | 9년 전 | 224 | ||
| 8206 |
|
9년 전 | 185 | |
| 8205 | 9년 전 | 168 | ||
| 8204 | 9년 전 | 130 | ||
| 8203 | 9년 전 | 231 | ||
| 8202 | 9년 전 | 138 | ||
| 8201 | 9년 전 | 180 | ||
| 8200 | 9년 전 | 160 | ||
| 8199 | 9년 전 | 212 | ||
| 8198 | 9년 전 | 173 | ||
| 8197 | 9년 전 | 164 | ||
| 8196 | 9년 전 | 551 | ||
| 8195 | 9년 전 | 154 | ||
| 8194 | 9년 전 | 280 | ||
| 8193 | 9년 전 | 153 | ||
| 8192 | 9년 전 | 183 | ||
| 8191 | 9년 전 | 138 | ||
| 8190 | 9년 전 | 126 | ||
| 8189 | 9년 전 | 188 | ||
| 8188 | 9년 전 | 127 | ||
| 8187 | 9년 전 | 140 | ||
| 8186 | 9년 전 | 139 | ||
| 8185 | 9년 전 | 309 | ||
| 8184 | 9년 전 | 106 | ||
| 8183 | 9년 전 | 323 | ||
| 8182 | 9년 전 | 165 | ||
| 8181 | 9년 전 | 128 | ||
| 8180 | 9년 전 | 692 | ||
| 8179 | 9년 전 | 483 | ||
| 8178 | 9년 전 | 309 | ||
| 8177 |
kiplayer
|
9년 전 | 314 | |
| 8176 | 9년 전 | 347 | ||
| 8175 | 9년 전 | 219 | ||
| 8174 | 9년 전 | 242 | ||
| 8173 | 9년 전 | 341 | ||
| 8172 | 9년 전 | 194 | ||
| 8171 | 9년 전 | 182 | ||
| 8170 | 9년 전 | 295 | ||
| 8169 |
커네드커네드
|
9년 전 | 257 | |
| 8168 | 9년 전 | 316 | ||
| 8167 | 9년 전 | 319 | ||
| 8166 | 9년 전 | 234 | ||
| 8165 | 9년 전 | 163 | ||
| 8164 | 9년 전 | 300 | ||
| 8163 | 9년 전 | 281 | ||
| 8162 | 9년 전 | 296 | ||
| 8161 | 9년 전 | 294 | ||
| 8160 |
|
9년 전 | 487 | |
| 8159 | 9년 전 | 426 | ||
| 8158 | 9년 전 | 248 | ||
| 8157 | 9년 전 | 372 | ||
| 8156 | 9년 전 | 276 | ||
| 8155 | 9년 전 | 249 | ||
| 8154 |
00년생용띠
|
9년 전 | 598 | |
| 8153 | 9년 전 | 227 | ||
| 8152 |
|
9년 전 | 403 | |
| 8151 | 9년 전 | 405 | ||
| 8150 | 9년 전 | 498 | ||
| 8149 |
Jangfolk
|
9년 전 | 348 | |
| 8148 | 9년 전 | 165 | ||
| 8147 | 9년 전 | 372 | ||
| 8146 | 9년 전 | 433 | ||
| 8145 | 9년 전 | 378 | ||
| 8144 | 9년 전 | 345 | ||
| 8143 | 9년 전 | 191 | ||
| 8142 | 9년 전 | 425 | ||
| 8141 | 9년 전 | 380 | ||
| 8140 | 9년 전 | 927 | ||
| 8139 | 9년 전 | 257 | ||
| 8138 |
전갈자리남자
|
9년 전 | 385 | |
| 8137 | 9년 전 | 394 | ||
| 8136 | 9년 전 | 743 | ||
| 8135 |
|
9년 전 | 793 | |
| 8134 |
PlayPixel
|
9년 전 | 510 | |
| 8133 |
|
9년 전 | 432 | |
| 8132 | 9년 전 | 445 | ||
| 8131 | 9년 전 | 809 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기