볼륨 관련등의 테스트를 위한 볼륨 구성(onLinux)
아래 자료는 저희 팀에서 제품을 개발하면서 볼륨그룹설정이 필요해서 따로 정리한 자료입니다.
1. 가정
새로 추가한 하드 디스크를 /dev/sdb로 가정
각 볼륨에 32기가 씩 할당
ProJobs 내의 볼륨 그룹을 다음과 같이 3개 그룹 5개 볼륨으로 생성
VolumeGroup
|
Volume
|
Path
|
SystemVolumes
|
System
|
/Volumes/System
|
DataVolumes
|
DV01
|
/Voumues/Data/DV01
|
DV02
|
/Voumues/Data/DV01
|
CompressedDataVolumes
|
CV01
|
/Voumues/CData/CV01
|
CV02
|
/Voumues/CData/CV01
|
2. fdisk로 파티션 생성
[root@fw4testsvr2
~]# fdisk /dev/sdb
The
number of cylinders for this disk is set to 24321.
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)
Command
(m for help): p
Disk
/dev/sdb: 200.0 GB, 200049647616 bytes
255
heads, 63 sectors/track, 24321 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): 2
First
cylinder (1-24321, default 1):
Using
default value 1
Last
cylinder or +size or +sizeM or +sizeK (1-24321, default 24321):
Using
default value 24321
Command (m
for help): p
Disk
/dev/sdb: 200.0 GB, 200049647616 bytes
255
heads, 63 sectors/track, 24321 cylinders
Units =
cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks
Id System
/dev/sdb2 1 24321 195358401
83 Linux
Command
(m for help): t
Selected
partition 2
Hex code
(type L to list codes): 8e
Changed
system type of partition 2 to 8e (Linux LVM)
Command
(m for help): p
Disk
/dev/sdb: 200.0 GB, 200049647616 bytes
255
heads, 63 sectors/track, 24321 cylinders
Units =
cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks
Id System
/dev/sdb2 1 24321
195358401 8e Linux LVM
Command
(m for help): w
The
partition table has been altered!
Calling
ioctl() to re-read partition table.
Syncing
disks.
3. 하드디스크에 Physical Volume 생성
[root@fw4testsvr2
~]# pvcreate /dev/sdb2
Physical volume "/dev/sdb2"
successfully created
4. 생성한 Physical Volume을 가지는 Volume Group을 생성
[root@fw4testsvr2
~]# vgcreate -s 8m Volumes /dev/sdb2
Volume group "Voluems" successfully
created
5. 생성한 Volume Group에 Logical Volume을 생성
[root@fw4testsvr2
~]# lvcreate -L 32g
-n System Volumes
Logical volume "System" created
[root@fw4testsvr2
~]# lvcreate -L 32g
-n DV01 Volumes
Logical volume "DV01" created
[root@fw4testsvr2
~]# lvcreate -L 32g
-n DV02 Volumes
Logical volume "DV02" created
[root@fw4testsvr2
~]# lvcreate -L 32g
-n CV01 Volumes
Logical volume "CV01" created
[root@fw4testsvr2
~]# lvcreate -L 32g
-n CV02 Volumes
Logical volume "CV02" created
[root@fw4testsvr2
~]#
6. 생성한 LV에 파일 시스템 생성
[root@fw4testsvr2
~]# mkfs -t ext3 /dev/Volumes/System
[root@fw4testsvr2
~]# mkfs -t ext3 /dev/Volumes/DV01
[root@fw4testsvr2
~]# mkfs -t ext3 /dev/Volumes/DV02
[root@fw4testsvr2
~]# mkfs -t ext3 /dev/Volumes/CV01
[root@fw4testsvr2
~]# mkfs -t ext3 /dev/Volumes/CV02
mke2fs
1.40.2 (12-Jul-2007)
Filesystem
label=
OS type:
Linux
Block
size=4096 (log=2)
Fragment
size=4096 (log=2)
4194304
inodes, 8388608 blocks
419430
blocks (5.00%) reserved for the super user
First
data block=0
Maximum
filesystem blocks=0
256 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, 7962624
Writing
inode tables: done
Creating
journal (32768 blocks): done
Writing
superblocks and filesystem accounting information: done
This filesystem
will be automatically checked every 25 mounts or
180 days,
whichever comes first. Use tune2fs -c or
-i to override.
[root@fw4testsvr2
~]#
7. mount point를 생성
[root@fw4testsvr2
~]# mkdir /Volumes
[root@fw4testsvr2
~]# mkdir /Volumes/System
[root@fw4testsvr2
~]# mkdir /Volumes/Data
[root@fw4testsvr2
~]# mkdir /Volumes/Data/DV01
[root@fw4testsvr2
~]# mkdir /Volumes/Data/DV02
[root@fw4testsvr2
~]# mkdir /Volumes/CData
[root@fw4testsvr2
~]# mkdir /Volumes/CData/CV01
[root@fw4testsvr2
~]# mkdir /Volumes/CData/CV02
[root@fw4testsvr2
~]#
8. Volume을 mount
[root@fw4testsvr2
~]#mount /dev/Volumes/System
/Volumes/System
[root@fw4testsvr2
~]#mount /dev/Volumes/DV01 /Volumes/Data/DV01
[root@fw4testsvr2
~]#mount /dev/Volumes/DV02 /Volumes/Data/DV02
[root@fw4testsvr2
~]#mount /dev/Volumes/CV01 /Volumes/CData/CV01
[root@fw4testsvr2
~]#mount /dev/Volumes/CV02 /Volumes/CData/CV02
9. fstab을 수정하여 자동으로 mount 되도록 한다.
마지막에 다음 내용을 추가
/dev/Volumes/System /Volumes/System ext3
rw 0 2
/dev/Volumes/DV01 /Volumes/Data/DV01 ext3 rw 0 2
/dev/Volumes/DV02 /Volumes/Data/DV02 ext3 rw 0 2
/dev/Volumes/CV01 /Volumes/CData/CV01 ext3 rw 0 2
/dev/Volumes/CV02 /Volumes/CData/CV02 ext3 rw 0 2
10. 3 ~ 8번까지 총정리한 명령어들
pvcreate
/dev/sdb2
vgcreate
-s 8m Volumes /dev/sdb2
lvcreate
-L 32g -n System Volumes
lvcreate
-L 32g -n DV01 Volumes
lvcreate
-L 32g -n DV02 Volumes
lvcreate
-L 32g -n CV01 Volumes
lvcreate
-L 32g -n CV02 Volumes
mkfs -t
ext3 /dev/Volumes/System
mkfs -t
ext3 /dev/Volumes/DV01
mkfs -t ext3
/dev/Volumes/DV02
mkfs -t
ext3 /dev/Volumes/CV01
mkfs -t
ext3 /dev/Volumes/CV02
mkdir
/Volumes
mkdir
/Volumes/System
mkdir
/Volumes/Data
mkdir
/Volumes/Data/DV01
mkdir
/Volumes/Data/DV02
mkdir
/Volumes/CData
mkdir
/Volumes/CData/CV01
mkdir
/Volumes/CData/CV02
mount
/dev/Volumes/System /Volumes/System
mount
/dev/Volumes/DV01 /Volumes/Data/DV01
mount
/dev/Volumes/DV02 /Volumes/Data/DV02
mount
/dev/Volumes/CV01 /Volumes/CData/CV01
mount
/dev/Volumes/CV02 /Volumes/CData/CV02
Posted by 지영아빠