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~~~
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 8130 | 9년 전 | 576 | ||
| 8129 |
|
9년 전 | 691 | |
| 8128 | 9년 전 | 546 | ||
| 8127 |
|
9년 전 | 592 | |
| 8126 | 9년 전 | 528 | ||
| 8125 | 9년 전 | 781 | ||
| 8124 |
|
9년 전 | 542 | |
| 8123 | 9년 전 | 526 | ||
| 8122 | 9년 전 | 456 | ||
| 8121 | 9년 전 | 565 | ||
| 8120 | 9년 전 | 482 | ||
| 8119 | 9년 전 | 572 | ||
| 8118 |
|
9년 전 | 649 | |
| 8117 |
|
9년 전 | 416 | |
| 8116 |
PASKRAN
|
9년 전 | 474 | |
| 8115 | 9년 전 | 471 | ||
| 8114 |
kiplayer
|
9년 전 | 609 | |
| 8113 | 9년 전 | 468 | ||
| 8112 |
|
9년 전 | 579 | |
| 8111 | 9년 전 | 417 | ||
| 8110 | 9년 전 | 457 | ||
| 8109 | 9년 전 | 388 | ||
| 8108 |
|
9년 전 | 568 | |
| 8107 |
|
9년 전 | 454 | |
| 8106 |
|
9년 전 | 457 | |
| 8105 | 9년 전 | 487 | ||
| 8104 |
|
9년 전 | 451 | |
| 8103 |
|
9년 전 | 452 | |
| 8102 |
|
9년 전 | 424 | |
| 8101 |
snshero
|
9년 전 | 812 | |
| 8100 | 9년 전 | 857 | ||
| 8099 | 9년 전 | 836 | ||
| 8098 | 9년 전 | 739 | ||
| 8097 | 9년 전 | 544 | ||
| 8096 | 9년 전 | 743 | ||
| 8095 | 9년 전 | 879 | ||
| 8094 | 9년 전 | 550 | ||
| 8093 | 9년 전 | 827 | ||
| 8092 | 9년 전 | 776 | ||
| 8091 | 9년 전 | 1163 | ||
| 8090 | 9년 전 | 787 | ||
| 8089 | 9년 전 | 1000 | ||
| 8088 | 9년 전 | 661 | ||
| 8087 | 9년 전 | 789 | ||
| 8086 | 9년 전 | 536 | ||
| 8085 | 9년 전 | 502 | ||
| 8084 | 9년 전 | 620 | ||
| 8083 | 9년 전 | 594 | ||
| 8082 | 9년 전 | 784 | ||
| 8081 | 9년 전 | 495 | ||
| 8080 | 9년 전 | 589 | ||
| 8079 | 9년 전 | 548 | ||
| 8078 | 9년 전 | 466 | ||
| 8077 | 9년 전 | 557 | ||
| 8076 | 9년 전 | 426 | ||
| 8075 | 9년 전 | 459 | ||
| 8074 | 9년 전 | 424 | ||
| 8073 | 9년 전 | 479 | ||
| 8072 | 9년 전 | 472 | ||
| 8071 |
o1o111
|
9년 전 | 921 | |
| 8070 | 9년 전 | 429 | ||
| 8069 | 9년 전 | 366 | ||
| 8068 | 9년 전 | 617 | ||
| 8067 | 9년 전 | 417 | ||
| 8066 | 9년 전 | 444 | ||
| 8065 | 9년 전 | 406 | ||
| 8064 | 9년 전 | 398 | ||
| 8063 | 9년 전 | 366 | ||
| 8062 | 9년 전 | 336 | ||
| 8061 | 9년 전 | 370 | ||
| 8060 | 9년 전 | 414 | ||
| 8059 | 9년 전 | 349 | ||
| 8058 | 9년 전 | 288 | ||
| 8057 | 9년 전 | 413 | ||
| 8056 | 9년 전 | 333 | ||
| 8055 | 9년 전 | 381 | ||
| 8054 | 9년 전 | 384 | ||
| 8053 | 9년 전 | 436 | ||
| 8052 | 9년 전 | 307 | ||
| 8051 | 9년 전 | 357 | ||
| 8050 | 9년 전 | 413 | ||
| 8049 | 9년 전 | 348 | ||
| 8048 | 9년 전 | 452 | ||
| 8047 | 9년 전 | 391 | ||
| 8046 | 9년 전 | 335 | ||
| 8045 | 9년 전 | 282 | ||
| 8044 | 9년 전 | 369 | ||
| 8043 | 9년 전 | 326 | ||
| 8042 | 9년 전 | 316 | ||
| 8041 | 9년 전 | 377 | ||
| 8040 | 9년 전 | 300 | ||
| 8039 | 9년 전 | 341 | ||
| 8038 | 9년 전 | 283 | ||
| 8037 | 9년 전 | 428 | ||
| 8036 | 9년 전 | 517 | ||
| 8035 | 9년 전 | 449 | ||
| 8034 | 9년 전 | 410 | ||
| 8033 | 9년 전 | 370 | ||
| 8032 | 9년 전 | 475 | ||
| 8031 | 9년 전 | 365 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기