Linux - LVM (Logical Volume Manage) HDD 추가 그룹 설정
Posted 01 4, 2009 23:17, Filed under: System/UNIX
이 자료의 출처는 Redhat Linux 9 의 저자인 박승규님의 강의내용을 참고 했습니다.
더 많은 분들과 공유하고 싶어서 허락없이 강의 이미지를 참고하였습니다. 죄송합니다.
이 글의 게시를 원하지 않으실경우 메일을 보내주시면 확인후 바로 조치 하겠습니다.
메일 : sunshinykr@gmail.com
LVM (Logical Volume Manage)
- 여러 개의 하드디스크를 1개의 파일시스템으로 사용
아래의 작업은 여러개의 HDD 를 추가한후 하나의 공간으로 사용하기 위해
LVM 방식으로 파일 시스템을 설정해주는 작업입니다.


[root@redhat_9 root]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 7.3G 1.4G 5.6G 20% /
/dev/sda1 99M 9.3M 85M 10% /boot
none 125M 0 125M 0% /dev/shm
/dev/hdd1 1008M 17M 941M 2% /download
// 연결된 장치에 파티션을 줍니다.
[root@redhat_9 root]# fdisk /dev/hda
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 1040.
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 // print
Disk /dev/hda: 536 MB, 536870912 bytes // 장치 연결 확인
16 heads, 63 sectors/track, 1040 cylinders
Units = cylinders of 1008 * 512 = 516096 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 // 파티션 번호 하나 만듬 1번
First cylinder (1-1040, default 1): 1 // 실린더 기본값 1부터
Last cylinder or +size or +sizeM or +sizeK (1-1040, default 1040): // 기본값 1040 을 선택 엔터
Using default value 1040
Command (m for help): p // print
Disk /dev/hda: 536 MB, 536870912 bytes
16 heads, 63 sectors/track, 1040 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Device Boot Start End Blocks Id System
/dev/hda1 1 1040 524128+ 83 Linux // 기본으로 Linux ext3 타입의 파일시스템이 생성됨
Command (m for help): m // help 메뉴 도움말을 봅니다.
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id // t 옵션 파티션 타입을 변경
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): t // 파티션 타입 변경
Selected partition 1
Hex code (type L to list codes): l // ㅣ 코드 리스트를 봅니다.
0 Empty 1c Hidden Win95 FA 70 DiskSecure Mult bb Boot Wizard hid
1 FAT12 1e Hidden Win95 FA 75 PC/IX be Solaris boot
2 XENIX root 24 NEC DOS 80 Old Minix c1 DRDOS/sec (FAT-
3 XENIX usr 39 Plan 9 81 Minix / old Lin c4 DRDOS/sec (FAT-
4 FAT16 <32M 3c PartitionMagic 82 Linux swap c6 DRDOS/sec (FAT-
5 Extended 40 Venix 80286 83 Linux c7 Syrinx
6 FAT16 41 PPC PReP Boot 84 OS/2 hidden C: da Non-FS data
7 HPFS/NTFS 42 SFS 85 Linux extended db CP/M / CTOS / .
8 AIX 4d QNX4.x 86 NTFS volume set de Dell Utility
9 AIX bootable 4e QNX4.x 2nd part 87 NTFS volume set df BootIt
a OS/2 Boot Manag 4f QNX4.x 3rd part 8e Linux LVM e1 DOS access
b Win95 FAT32 50 OnTrack DM 93 Amoeba e3 DOS R/O
c Win95 FAT32 (LB 51 OnTrack DM6 Aux 94 Amoeba BBT e4 SpeedStor
e Win95 FAT16 (LB 52 CP/M 9f BSD/OS eb BeOS fs
f Win95 Ext'd (LB 53 OnTrack DM6 Aux a0 IBM Thinkpad hi ee EFI GPT
10 OPUS 54 OnTrackDM6 a5 FreeBSD ef EFI (FAT-12/16/
11 Hidden FAT12 55 EZ-Drive a6 OpenBSD f0 Linux/PA-RISC b
12 Compaq diagnost 56 Golden Bow a7 NeXTSTEP f1 SpeedStor
14 Hidden FAT16 <3 5c Priam Edisk a8 Darwin UFS f4 SpeedStor
16 Hidden FAT16 61 SpeedStor a9 NetBSD f2 DOS secondary
17 Hidden HPFS/NTF 63 GNU HURD or Sys ab Darwin boot fd Linux raid auto
18 AST SmartSleep 64 Novell Netware b7 BSDI fs fe LANstep
1b Hidden Win95 FA 65 Novell Netware b8 BSDI swap ff BBT
Hex code (type L to list codes): 8e // 8e Linux LVM 코드를 선택합니다.
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): p // print
Disk /dev/hda: 536 MB, 536870912 bytes
16 heads, 63 sectors/track, 1040 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Device Boot Start End Blocks Id System
/dev/hda1 1 1040 524128+ 8e Linux LVM // 타입이 Linux LVM으로 변경된것을 확인 합니다.
Command (m for help): w // 저장후 빠져나옴
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
// 두번째 연결된 장치에 파티션을 줍니다.
[root@redhat_9 root]# fdisk /dev/hdb
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 1040.
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 // print
Disk /dev/hdb: 536 MB, 536870912 bytes // 연결된 장치가 확인됨
16 heads, 63 sectors/track, 1040 cylinders
Units = cylinders of 1008 * 512 = 516096 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 // 기본값 1번을 지정
First cylinder (1-1040, default 1): 1 // 실린더 기본 시작 1을 지정
Last cylinder or +size or +sizeM or +sizeK (1-1040, default 1040): // 실린더 기본값인 1040 을 선택
Using default value 1040
Command (m for help): p // print
Disk /dev/hdb: 536 MB, 536870912 bytes
16 heads, 63 sectors/track, 1040 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 1 1040 524128+ 83 Linux // 기본으로 Linux ext3 타입의 파일시스템이 생성됨
Command (m for help): t // 파티션 타입 변경
Selected partition 1
Hex code (type L to list codes): 8e // 8e Linux LVM 코드를 선택합니다.
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): p // print
Disk /dev/hdb: 536 MB, 536870912 bytes
16 heads, 63 sectors/track, 1040 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 1 1040 524128+ 8e Linux LVM // 타입이 Linux LVM으로 변경된것을 확인 합니다.
Command (m for help): w // 저장후 빠져나옴
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@redhat_9 root]# reboot // 시스템 재시작
Broadcast message from root (pts/0) (Sun Jan 4 22:07:34 2009):
The system is going down for reboot NOW!
[root@redhat_9 root]# pvcreate /dev/hda1
pvcreate -- ERROR: "/etc/lvmtab" doesn't exist; please run vgscan
pvcreate 명령 실행시 위와 같은 에러 발생시에
/sbin/vgscan 를 실행 해줍니다.
[root@redhat_9 root]# /sbin/vgscan
vgscan -- reading all physical volumes (this may take a while...)
vgscan -- "/etc/lvmtab" and "/etc/lvmtab.d" successfully created
vgscan -- WARNING: This program does not do a VGDA backup of your volume group
pvcreate -- ERROR: "/etc/lvmtab" doesn't exist; please run vgscan
// 첫번째 Physical Volume 만듬
[root@redhat_9 root]# pvcreate /dev/hda1
pvcreate -- physical volume "/dev/hda1" successfully created
// 두번째 Physical Volume 만듬
[root@redhat_9 root]# pvcreate /dev/hdb1
pvcreate -- physical volume "/dev/hdb1" successfully created
// Volume Group 을 만듬
// vgcreate 볼륨그룹명 /dev/볼륨1 /dev/볼륨2 /dev/볼륨3 ..... 복수 추가
[root@redhat_9 root]# vgcreate mySun /dev/hda1 /dev/hdb1
vgcreate -- INFO: using default physical extent size 4 MB
vgcreate -- INFO: maximum logical volume size is 255.99 Gigabyte
vgcreate -- doing automatic backup of volume group "mySun"
vgcreate -- volume group "mySun" successfully created and activated
// Logical Volum 만듬
// lvcreate -l 사이즈 -n 볼륨이름 볼륨그룹명
[root@redhat_9 root]# lvcreate -l 33333 -n mySun1 mySun
lvcreate -- only 252 free physical extents in volume group "mySun"
사용 가능한 용량(252)으로 변경후 다시 시도
[root@redhat_9 root]# lvcreate -l 252 -n mySun1 mySun
lvcreate -- doing automatic backup of "mySun"
lvcreate -- logical volume "/dev/mySun/mySun1" successfully created
[root@redhat_9 root]# ls -l /dev/mySun
합계 0
crw-r----- 1 root disk 109, 0 1월 4 22:14 group
brw-rw---- 1 root disk 58, 0 1월 4 22:17 mySun1
[root@redhat_9 root]# ls -l /dev/mySun/mySun1
brw-rw---- 1 root disk 58, 0 1월 4 22:17 /dev/mySun/mySun1
// 파일 시스템 생성
[root@redhat_9 root]# mkfs.ext3 /dev/mySun/mySun1
mke2fs 1.32 (09-Nov-2002)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
129024 inodes, 258048 blocks
12902 blocks (5.00%) reserved for the super user
First data block=0
8 block groups
32768 blocks per group, 32768 fragments per group
16128 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 39 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@redhat_9 root]# cd /data
-bash: cd: /data: 그런 파일이나 디렉토리가 없음
// mount 할 디렉토리를 생성
[root@redhat_9 /]# mkdir data
// mount 명령어와 옵션을 사용하여 mount 실행
[root@redhat_9 /]# mount -t ext3 /dev/mySun/mySun1 /data
[root@redhat_9 /]# cd /data
[root@redhat_9 data]# ll
합계 16
drwx------ 2 root root 16384 1월 4 22:18 lost+found
[root@redhat_9 data]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 7.3G 1.4G 5.6G 20% /
/dev/sda1 99M 9.3M 85M 10% /boot
none 125M 0 125M 0% /dev/shm
/dev/hdd1 1008M 17M 941M 2% /download
/dev/mySun/mySun1 993M 17M 926M 2% /data
// 부팅시마다 mount된 HDD를 인식시키기위해 fstab에 등록
[root@redhat_9 data]# vi /etc/fstab
LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
/dev/sda3 swap swap defaults 0 0
/dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,kudzu,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0
/dev/hdd1 /download ext3 defaults 1 2
// vi 에디터를 이용하여 아래 내용을 삽입
/dev/mySun/mySun1 /data ext3 defaults 1 2
잘못된 정보나 보완이 필요한 부분을, 댓글 또는 메일로 보내주시면 많은 도움이 되겠습니다.
"System / UNIX" 분류의 다른 글
Linux - ulimit 설정(Too many open files 오류) (0) | 2015/12/21 |
Linux - NTFS file System 인식및 사용 (0) | 2015/12/14 |
[Linux] CentOS minimal 설치 후 수동 Network 설정 및 필수 패키지 설치 (0) | 2015/08/26 |
Linux - nano 에디터 (0) | 2014/11/08 |
Linux - Java 데몬 실행(Apache commons daemon, Jsvc) (0) | 2014/07/03 |
Linux - htop 시스템 모니터 설치 (0) | 2014/05/20 |
Linux - rpmforge rpm 패키지 설치 지원 (2) | 2014/02/22 |
Linux - multitail(다중 tail) 설치및 사용 (0) | 2014/02/18 |
Unix - 원격지에서 SSH 접속 지연 (0) | 2014/01/15 |
Aix - 패스워드 만료, 변경시 minlen 설정 (0) | 2013/12/19 |
Trackback URL : http://develop.sunshiny.co.kr/trackback/72