DBA가 되고 싶은 병아리
LVM 구성 가이드 본문
Logical Volume Manager (LVM)
시스템에 디스크를 장착
IDE(ATA) : 4장(PRIMARY, SECONDERY controller
-Master -Master
-Slave -Slave )
SATA : connector 갯수 : 4장 + 4장
SCSI : 14~16장
실제 100G 디스크가 시스템에 10장 장착(따라서 SCSI 방식 사용)
- 디폴트 개별 디스크로 파티셔닝 해서 포맷팅한 후 마운트 시켜서 사용.
100G 디스크 5장 100GB 디스크 5장 각각
-->500G 디스크 한장 --> 500G 디스크 한장
Software 를 사용해서 이 구성을 완료 : Logical Volume Manager
용어
Physcial Volume(PV) : 각 디스크 하나 하나를 PV로 설정 (pvd01~pvd10)
Volume Group(VG) : 예를들면 500G 용량으로 묶음 (vg01 ,vg02)
Logical Volume(LV)
Extent
------------------------------------------------------------------
실습
# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 2355 18916506 83 Linux
/dev/sda2 2356 2610 2048287+ 82 Linux swap
Disk /dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdc: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdc doesn't contain a valid partition table
Disk /dev/sdd: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdd doesn't contain a valid partition table
Disk /dev/sde: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sde doesn't contain a valid partition table
Disk /dev/sdf: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdf doesn't contain a valid partition table
Disk /dev/sdg: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdg doesn't contain a valid partition table
Disk /dev/sdh: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdh doesn't contain a valid partition table
Disk /dev/sdi: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdi doesn't contain a valid partition table
#
--------------------------------------------------------
2. fdisk 작업
# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 2610.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): p
Disk /dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610):
Using default value 2610
Command (m for help): p
Disk /dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 2610 20964793+ 83 Linux
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): L
0 Empty 1e Hidden W95 FAT1 80 Old Minix c1 DRDOS/sec (FAT-
1 FAT12 24 NEC DOS 81 Minix / old Lin c4 DRDOS/sec (FAT-
2 XENIX root 39 Plan 9 82 Linux swap c6 DRDOS/sec (FAT-
3 XENIX usr 3c PartitionMagic 83 Linux c7 Syrinx
4 FAT16 <32M 40 Venix 80286 84 OS/2 hidden C: da Non-FS data
5 Extended 41 PPC PReP Boot 85 Linux extended db CP/M / CTOS / .
6 FAT16 42 SFS 86 NTFS volume set de Dell Utility
7 HPFS/NTFS 4d QNX4.x 87 NTFS volume set df BootIt
8 AIX 4e QNX4.x 2nd part 8e Linux LVM e1 DOS access
9 AIX bootable 4f QNX4.x 3rd part 93 Amoeba e3 DOS R/O
a OS/2 Boot Manag 50 OnTrack DM 94 Amoeba BBT e4 SpeedStor
b W95 FAT32 51 OnTrack DM6 Aux 9f BSD/OS eb BeOS fs
c W95 FAT32 (LBA) 52 CP/M a0 IBM Thinkpad hi ee EFI GPT
e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD ef EFI (FAT-12/16/
f W95 Ext'd (LBA) 54 OnTrackDM6 a6 OpenBSD f0 Linux/PA-RISC b
10 OPUS 55 EZ-Drive a7 NeXTSTEP f1 SpeedStor
11 Hidden FAT12 56 Golden Bow a8 Darwin UFS f4 SpeedStor
12 Compaq diagnost 5c Priam Edisk a9 NetBSD f2 DOS secondary
14 Hidden FAT16 <3 61 SpeedStor ab Darwin boot fb VMware VMFS
16 Hidden FAT16 63 GNU HURD or Sys b7 BSDI fs fc VMware VMKCORE
17 Hidden HPFS/NTF 64 Novell Netware b8 BSDI swap fd Linux raid auto
18 AST SmartSleep 65 Novell Netware bb Boot Wizard hid fe LANstep
1b Hidden W95 FAT3 70 DiskSecure Mult be Solaris boot ff BBT
1c Hidden W95 FAT3 75 PC/IX bf Solaris
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): p
Disk /dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 2610 20964793+ 8e Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@orat ~]#
[root@orat ~]# fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 2610.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): p
Disk /dev/sdc: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610):
Using default value 2610
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): p
Disk /dev/sdc: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 1 2610 20964793+ 8e Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@orat ~]# fdisk /dev/sdd
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 2610.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610):
Using default value 2610
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): p
Disk /dev/sdd: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdd1 1 2610 20964793+ 8e Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@orat ~]# fdisk /dev/sde
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 2610.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): p
Disk /dev/sde: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610):
Using default value 2610
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): p
Disk /dev/sde: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sde1 1 2610 20964793+ 8e Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@orat ~]# fdisk /dev/sdf
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 2610.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610):
Using default value 2610
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): p
Disk /dev/sdf: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdf1 1 2610 20964793+ 8e Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@orat ~]# fdisk /dev/sdg
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 2610.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610):
Using default value 2610
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): p
Disk /dev/sdg: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdg1 1 2610 20964793+ 8e Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@orat ~]#
[root@orat ~]#
[root@orat ~]#
[root@orat ~]#
[root@orat ~]# fdisk /dev/sdh
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 2610.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610):
Using default value 2610
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): p
Disk /dev/sdh: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdh1 1 2610 20964793+ 8e Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@orat ~]# fdisk /dev/sdi
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 2610.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610):
Using default value 2610
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): p
Disk /dev/sdi: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdi1 1 2610 20964793+ 8e Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
#
--확인
# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 2355 18916506 83 Linux
/dev/sda2 2356 2610 2048287+ 82 Linux swap
Disk /dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 2610 20964793+ 8e Linux LVM
Disk /dev/sdc: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 1 2610 20964793+ 8e Linux LVM
Disk /dev/sdd: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdd1 1 2610 20964793+ 8e Linux LVM
Disk /dev/sde: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sde1 1 2610 20964793+ 8e Linux LVM
Disk /dev/sdf: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdf1 1 2610 20964793+ 8e Linux LVM
Disk /dev/sdg: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdg1 1 2610 20964793+ 8e Linux LVM
Disk /dev/sdh: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdh1 1 2610 20964793+ 8e Linux LVM
Disk /dev/sdi: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdi1 1 2610 20964793+ 8e Linux LVM
#
---------------------------------------------------------------
3. Physical Volumn 생성
# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created
# pvcreate /dev/sdc1
Physical volume "/dev/sdc1" successfully created
# pvcreate /dev/sdd1
Physical volume "/dev/sdd1" successfully created
# pvcreate /dev/sde1
Physical volume "/dev/sde1" successfully created
# pvcreate /dev/sdf1
Physical volume "/dev/sdf1" successfully created
# pvcreate /dev/sdg1
Physical volume "/dev/sdg1" successfully created
# pvcreate /dev/sdh1
Physical volume "/dev/sdh1" successfully created
# pvcreate /dev/sdi1
Physical volume "/dev/sdi1" successfully created
#
----------------------------------------------------
4. VOLUMN GROUP 생성
# vgcreate VOL01 /dev/sdb1 /dev/sdc1 /dev/sdd1
Volume group "VOL01" successfully created
# vgcreate VOL02 /dev/sdf1 /dev/sdg1 /dev/sdh1
Volume group "VOL02" successfully created
#
(참고)
# vgcreate VOL02 -s 1M /dev/sdf1 /dev/sdg1 /dev/sdh1
(주의 각각 3개씩 구성 (4번째 제외))
-- 확인
# vgdisplay
--- Volume group ---
VG Name VOL02
System ID
Format lvm2
Metadata Areas 3
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 3
Act PV 3
VG Size 59.98 GB
PE Size 4.00 MB
Total PE 15354
Alloc PE / Size 0 / 0
Free PE / Size 15354 / 59.98 GB
VG UUID nkjJZ9-ij82-WFVR-bQ0b-n7Gn-fDjM-lFQldw
--- Volume group ---
VG Name VOL01
System ID
Format lvm2
Metadata Areas 3
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 3
Act PV 3
VG Size 59.98 GB
PE Size 4.00 MB
Total PE 15354
Alloc PE / Size 0 / 0
Free PE / Size 15354 / 59.98 GB
VG UUID I92Dug-oXJD-aYjB-Jl4f-kzOO-He1w-zg8qm3
[root@orat ~]#
------------------------------------------------------------------
5. Logical volume 생성
# lvcreate -L 30GB -n lv01 VOL01
Logical volume "lv01" created
# lvcreate -L 30GB -n lv02 VOL02
Logical volume "lv02" created
#
--확인
# lvscan
ACTIVE '/dev/VOL02/lv02' [30.00 GB] inherit
ACTIVE '/dev/VOL01/lv01' [30.00 GB] inherit
-----------------------------------------------------------------
6. 포맷
# mkfs.ext3 /dev/VOL02/lv02
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
3932160 inodes, 7864320 blocks
393216 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=8388608
240 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 22 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
#
# mkfs.ext3 /dev/VOL01/lv01
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
3932160 inodes, 7864320 blocks
393216 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=8388608
240 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 22 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
#
7. 마운트
# lvscan
ACTIVE '/dev/VOL02/lv02' [30.00 GB] inherit
ACTIVE '/dev/VOL01/lv01' [30.00 GB] inherit
# mount /dev/VOL01/lv01 /v1l1
# mount /dev/VOL02/lv02 /v2l2
-- 확인
# mount | grep VOL
/dev/mapper/VOL01-lv01 on /v1l1 type ext3 (rw)
/dev/mapper/VOL02-lv02 on /v2l2 type ext3 (rw)
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 18G 3.7G 14G 22% /
none 506M 0 506M 0% /dev/shm
/dev/mapper/VOL01-lv01
30G 77M 28G 1% /v1l1
/dev/mapper/VOL02-lv02
30G 77M 28G 1% /v2l2
-- 지금까지 한작업을 system-config-lvm GUI로도 가능합니다.
---------------------------------------------------------------
용량 증설
절차
1) 시스템 poweroff 후 디스크 추가
2) 시스템 poweron
3) fdisk 작업을 통해 파티션 생성 후, Linux Volumn(8e)으로 파티션 형식 변경
4) pvcreate 명령어로 Physical Volumn 생성
- Physical volume "/dev/sde1"
- Physical volume "/dev/sdi1"
5) 기존 VOLUMN GROUP 확인 후, VG에 추가
# pvscan
PV /dev/sdf1 VG VOL02 lvm2 [19.99 GB / 0 free]
PV /dev/sdg1 VG VOL02 lvm2 [19.99 GB / 9.98 GB free]
PV /dev/sdh1 VG VOL02 lvm2 [19.99 GB / 19.99 GB free]
PV /dev/sdb1 VG VOL01 lvm2 [19.99 GB / 0 free]
PV /dev/sdc1 VG VOL01 lvm2 [19.99 GB / 9.98 GB free]
PV /dev/sdd1 VG VOL01 lvm2 [19.99 GB / 19.99 GB free]
PV /dev/sde1 lvm2 [19.99 GB]
PV /dev/sdi1 lvm2 [19.99 GB]
Total: 8 [159.94 GB] / in use: 6 [119.95 GB] / in no VG: 2 [39.99 GB]
# vgscan
Reading all physical volumes. This may take a while...
Found volume group "VOL02" using metadata type lvm2
Found volume group "VOL01" using metadata type lvm2
# lvscan
ACTIVE '/dev/VOL02/lv02' [30.00 GB] inherit
ACTIVE '/dev/VOL01/lv01' [30.00 GB] inherit
[root@orat /]#
-- VG 에 PV 1개씩을 각각 추가.
# vgextend VOL01 /dev/sde1
Volume group "VOL01" successfully extended
# vgextend VOL02 /dev/sdi1
Volume group "VOL02" successfully extended
# pvscan
PV /dev/sdf1 VG VOL02 lvm2 [19.99 GB / 0 free]
PV /dev/sdg1 VG VOL02 lvm2 [19.99 GB / 9.98 GB free]
PV /dev/sdh1 VG VOL02 lvm2 [19.99 GB / 19.99 GB free]
PV /dev/sdi1 VG VOL02 lvm2 [19.99 GB / 19.99 GB free]
PV /dev/sdb1 VG VOL01 lvm2 [19.99 GB / 0 free]
PV /dev/sdc1 VG VOL01 lvm2 [19.99 GB / 9.98 GB free]
PV /dev/sdd1 VG VOL01 lvm2 [19.99 GB / 19.99 GB free]
PV /dev/sde1 VG VOL01 lvm2 [19.99 GB / 19.99 GB free]
Total: 8 [159.94 GB] / in use: 8 [159.94 GB] / in no VG: 0 [0 ]
#
-- LV 용량을 증설
1) 기존 용량확인
# lvscan
ACTIVE '/dev/VOL02/lv02' [30.00 GB] inherit
ACTIVE '/dev/VOL01/lv01' [30.00 GB] inherit
2) 마운트 포인트 확인
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 18G 3.7G 14G 22% /
none 506M 0 506M 0% /dev/shm
/dev/mapper/VOL01-lv01
30G 77M 28G 1% /v1l1 <-- 용량 증설을 원함
/dev/mapper/VOL02-lv02
3) 용량 증설을 원하는 LV을 언마운트
30G 77M 28G 1% /v2l2
# umount /v1l1
4) 용량 증설
# lvextend -L +10G /dev/VOL01/lv01
Extending logical volume lv01 to 40.00 GB
Logical volume lv01 successfully resized
#
5) 확인
# lvscan
ACTIVE '/dev/VOL02/lv02' [30.00 GB] inherit
ACTIVE '/dev/VOL01/lv01' [40.00 GB] inherit
#
# mount /dev/VOL01/lv01 /v1l1 -- 마운트 후
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 18G 3.8G 14G 22% /
none 506M 0 506M 0% /dev/shm
/dev/mapper/VOL02-lv02
30G 77M 28G 1% /v2l2
/dev/mapper/VOL01-lv01
30G 77M 28G 1% /v1l1 -- 용량이 안변해있슴
# resize2fs -f /dev/VOL01/lv01
resize2fs 1.35 (28-Feb-2004)
/dev/VOL01/lv01 is mounted; can't resize a mounted filesystem!
# umount /v1l1
# resize2fs -f /dev/VOL01/lv01
resize2fs 1.35 (28-Feb-2004)
Resizing the filesystem on /dev/VOL01/lv01 to 10485760 (4k) blocks.
The filesystem on /dev/VOL01/lv01 is now 10485760 blocks long.
# mount /dev/VOL01/lv01 /v1l1
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 18G 3.8G 14G 22% /
none 506M 0 506M 0% /dev/shm
/dev/mapper/VOL02-lv02
30G 77M 28G 1% /v2l2
/dev/mapper/VOL01-lv01
40G 81M 38G 1% /v1l1
[root@orat /]#
(용량 증설)
단순 디스크 시스템 Volumn 구성
100GB 디스크 (DISK 달고 FDISK 파티션 타입변경), PV , VG 생성
파티셔닝 LV
포맷 포맷
마운트 시킴
--------------------------------------------------
(참고)
ex) 논리 볼륨 용량 줄임
# lvreduce -L -5G /dev/VOL01/lv01
Do you really want to reduce LSVG? [y/n]: y
#
LVM 지우기
-절차
-- 확인
# df -h -- 마운트 포인트 확인
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 18G 3.8G 14G 22% /
none 506M 0 506M 0% /dev/shm
/dev/mapper/VOL02-lv02
30G 77M 28G 1% /v2l2
/dev/mapper/VOL01-lv01
40G 81M 38G 1% /v1l1
-- 언마운트 시킴
# umount /v1l1
# umount /v2l2
-- LV 삭제
# lvscan
ACTIVE '/dev/VOL02/lv02' [30.00 GB] inherit
ACTIVE '/dev/VOL01/lv01' [40.00 GB] inherit
# lvremove /dev/VOL02/lv02
Do you really want to remove active logical volume "lv02"? [y/n]: y
Logical volume "lv02" successfully removed
# lvremove /dev/VOL01/lv01
Do you really want to remove active logical volume "lv01"? [y/n]: y
Logical volume "lv01" successfully removed
# lvscan
#
-- VG 삭제
# vgscan
Reading all physical volumes. This may take a while...
Found volume group "VOL02" using metadata type lvm2
Found volume group "VOL01" using metadata type lvm2
# vgdisplay
# vgremove VOL01
Volume group "VOL01" successfully removed
# vgremove VOL02
Volume group "VOL02" successfully removed
# vgscan
Reading all physical volumes. This may take a while...
# vgdisplay
# -- 아무런 결과
--------
삭제 후 다음처럼 재구성
-- VG 생성
# vgcreate VOL01 /dev/sdb1 /dev/sdc1
Volume group "VOL01" successfully created
# vgcreate VOL02 /dev/sdd1 /dev/sde1
Volume group "VOL02" successfully created
# vgcreate VOL03 /dev/sdf1 /dev/sdg1
Volume group "VOL03" successfully created
# vgcreate VOL04 /dev/sdh1 /dev/sdi1
Volume group "VOL04" successfully created
#
-- LV 생성
# lvcreate -L 20GB -n lv01 VOL01
Logical volume "lv01" created
# lvcreate -L 20GB -n lv02 VOL02
Logical volume "lv02" created
# lvcreate -L 20GB -n lv03 VOL03
Logical volume "lv03" created
# lvcreate -L 20GB -n lv04 VOL04
Logical volume "lv04" created
#
-- 확인
# lvscan
ACTIVE '/dev/VOL04/lv04' [20.00 GB] inherit
ACTIVE '/dev/VOL03/lv03' [20.00 GB] inherit
ACTIVE '/dev/VOL02/lv02' [20.00 GB] inherit
ACTIVE '/dev/VOL01/lv01' [20.00 GB] inherit
# vgscan
Reading all physical volumes. This may take a while...
Found volume group "VOL04" using metadata type lvm2
Found volume group "VOL03" using metadata type lvm2
Found volume group "VOL02" using metadata type lvm2
Found volume group "VOL01" using metadata type lvm2
# vgdisplay
--- Volume group ---
VG Name VOL04
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 0
Max PV 0
Cur PV 2
Act PV 2
VG Size 39.98 GB
PE Size 4.00 MB
Total PE 10236
Alloc PE / Size 5120 / 20.00 GB
Free PE / Size 5116 / 19.98 GB
VG UUID O1MPgc-LWcl-e9tF-9Zzh-OqVB-p0zV-Lq4zse
--- Volume group ---
VG Name VOL03
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 0
Max PV 0
Cur PV 2
Act PV 2
VG Size 39.98 GB
PE Size 4.00 MB
Total PE 10236
Alloc PE / Size 5120 / 20.00 GB
Free PE / Size 5116 / 19.98 GB
VG UUID TEPnRE-3ghB-N5y7-m1SI-EBWK-sSt0-pR3GW8
--- Volume group ---
VG Name VOL02
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 0
Max PV 0
Cur PV 2
Act PV 2
VG Size 39.98 GB
PE Size 4.00 MB
Total PE 10236
Alloc PE / Size 5120 / 20.00 GB
Free PE / Size 5116 / 19.98 GB
VG UUID sDcAlj-r6Hb-dnkH-bkKw-vrly-kUsR-tz2Xm2
--- Volume group ---
VG Name VOL01
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 0
Max PV 0
Cur PV 2
Act PV 2
VG Size 39.98 GB
PE Size 4.00 MB
Total PE 10236
Alloc PE / Size 5120 / 20.00 GB
Free PE / Size 5116 / 19.98 GB
VG UUID O6DMPY-TVC6-vbCg-99PH-2w55-BydZ-tUbFGa
# lvdisplay
--- Logical volume ---
LV Name /dev/VOL04/lv04
VG Name VOL04
LV UUID gHciMp-90Vq-KQmE-20i5-nvSb-d7lV-k7zaNv
LV Write Access read/write
LV Status available
# open 0
LV Size 20.00 GB
Current LE 5120
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:3
--- Logical volume ---
LV Name /dev/VOL03/lv03
VG Name VOL03
LV UUID S3otRp-7Bw1-pI08-ZpUk-CqvS-AGQf-HjsXgq
LV Write Access read/write
LV Status available
# open 0
LV Size 20.00 GB
Current LE 5120
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2
--- Logical volume ---
LV Name /dev/VOL02/lv02
VG Name VOL02
LV UUID BWKQQt-W0pM-TshD-wYwL-cZO2-t0FA-8lO3tR
LV Write Access read/write
LV Status available
# open 0
LV Size 20.00 GB
Current LE 5120
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
--- Logical volume ---
LV Name /dev/VOL01/lv01
VG Name VOL01
LV UUID G30acv-d0xt-XJB6-dWNb-BFzq-fW92-txkPfJ
LV Write Access read/write
LV Status available
# open 0
LV Size 20.00 GB
Current LE 5120
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
#
-- LV 포맷
# mkfs.ext3 /dev/VOL01/lv01
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2621440 inodes, 5242880 blocks
262144 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=8388608
160 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 21 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
# mkfs.ext3 /dev/VOL02/lv02
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2621440 inodes, 5242880 blocks
262144 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=8388608
160 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 33 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
# mkfs.ext3 /dev/VOL03/lv03
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2621440 inodes, 5242880 blocks
262144 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=8388608
160 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
# mkfs.ext3 /dev/VOL04/lv04
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2621440 inodes, 5242880 blocks
262144 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=8388608
160 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
#
-- 마운트
# mkdir /lv01
# mkdir /lv02
# mkdir /lv03
# mkdir /lv04
# mount /dev/VOL01/lv01 /lv01
# mount /dev/VOL02/lv02 /lv02
# mount /dev/VOL03/lv03 /lv03
# mount /dev/VOL04/lv04 /lv04
-- 확인
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 18G 3.8G 14G 22% /
none 506M 0 506M 0% /dev/shm
/dev/mapper/VOL01-lv01
20G 77M 19G 1% /lv01
/dev/mapper/VOL02-lv02
20G 77M 19G 1% /lv02
/dev/mapper/VOL03-lv03
20G 77M 19G 1% /lv03
/dev/mapper/VOL04-lv04
20G 77M 19G 1% /lv04
# pvscan
PV /dev/sdh1 VG VOL04 lvm2 [19.99 GB / 0 free]
PV /dev/sdi1 VG VOL04 lvm2 [19.99 GB / 19.98 GB free]
PV /dev/sdf1 VG VOL03 lvm2 [19.99 GB / 0 free]
PV /dev/sdg1 VG VOL03 lvm2 [19.99 GB / 19.98 GB free]
PV /dev/sdd1 VG VOL02 lvm2 [19.99 GB / 0 free]
PV /dev/sde1 VG VOL02 lvm2 [19.99 GB / 19.98 GB free]
PV /dev/sdb1 VG VOL01 lvm2 [19.99 GB / 0 free]
PV /dev/sdc1 VG VOL01 lvm2 [19.99 GB / 19.98 GB free]
Total: 8 [159.94 GB] / in use: 8 [159.94 GB] / in no VG: 0 [0 ]
-- 완료
(참고)
리부팅 시 자동으로 마운트 설정하기
# vi /etc/fstab
/dev/VOL01/lv01 /lv01 ext3 defaults 0 0 라인 추가
--완료
'OS관련 > Linux Study' 카테고리의 다른 글
리눅스 호스트네임 수정 파일 (0) | 2015.12.31 |
---|---|
B110i HP 컨트롤러 레이드 구성이 안될때... (0) | 2015.08.04 |
RAID 구성 가이드 (0) | 2012.03.03 |
Send E-mail 죽이는 방법 (0) | 2012.03.03 |
계속 마운트 하고 싶은 경우 (0) | 2012.03.03 |
'OS관련/Linux Study' Related Articles
- 리눅스 호스트네임 수정 파일 2015.12.31
- B110i HP 컨트롤러 레이드 구성이 안될때... 2015.08.04
- RAID 구성 가이드 2012.03.03
- Send E-mail 죽이는 방법 2012.03.03