리눅스 LVM
리눅스 LVM ? VG?
복잡하다 복잡해 일단 해보자!
일단 작업의 큰 흐름부터 알아 두자
1. 물리디스크를 장착한다. 2개 붙인다고 가정하겠음!
2. 물리디스크를확인하고 2개의 장치 모두 fdisk로 LVM TYPE 디스크로 만듬.
3. fdisk를 거쳐 LVM 상태가 된 디스크를 pv로 만들자 pvcreate
4. pv로 만들어진 디스크들을 vg이라는 가상의 그룹으로 불륨을 만들자
5. vg로 만들어진 가상 볼륨에 lv 논리적 볼륨을 만들자
6. 만들어진 lv에 파일시스템을 정해 포맷하고 붙일 폴더를 만들고 마운트해 쓰면 끝!
1. disk 상태 확인
fdisk -l
/dev/sdi
/dev/sdj
2. fdisk로 LVM tpye 만들기
fdisk /dev/sdi
n(new) > p(primary) > 1(partition number) > Enter(시작 넘버 default 1) > Enter(마지막넘버 default
는 마지막 주소) > t (type 설정) > 8e (Linux LVM) > p (print(설정내용확인)) > w (write)
나머지 디스크 /dev/sdj 도 반복작업
fdisk -l 로 최종확인 디스크가 LVM 상태인지 확인
3. pv상태로 만들기
pvcreate /디스크
pvcreate /dev/sdi1
pvcreate /dev/sdj1
pvscan 으로 확인
pvdisplay 으로 확인
4. 볼륨그룹에 만든 pv 넣기
vgcreate 볼륨그룸명 /디스크
vgcreate VG0 /dev/sdi1 /dev/sdj1
vgscan 으로 확인
vgdisplay 으로 확인
5. LV만들기
lvcreate -L 사이즈 -n LV이름 사용할VG이름
lvcreate -L 100M -n LV0 VG0
lvscan 으로 확인
lvdisplay 으로 확인
6. 포맷 후 마운트
ext3 포맷
mkfs.ext3 /dev/VG0/LV0
사용할 폴더 만듬
mkdir /backup
마운트
mount -t ext3 /dev/VG0/LV0 /backup
df -hT 마지막으로 잘붙었는지 확인
잘붙어있으면 다음 부팅 후 에도 사용할 수 있도록
/etc/fstab을 수정
vi /etc/fstab
a 눌러 커서뒤로 삽입
마운트할장치 마운트포인트 fs형식 옵션 덤프 무결성검사
/dev/VG0/LV0 /backup ext3 default 1 2
esc > : > wq!
재부팅 후 마운트 확인. 끝!
진짜 간단하게 대충 적어 놓은거라 나머지 명령어들은 추후에 보충하도록...;; ㅋ
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Disk /dev/sdi: 106 MB, 106954752 bytes
64 heads, 32 sectors/track, 102 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Disk identifier: 0xc9664147
Device Boot Start End Blocks Id System
/dev/sdi1 1 102 104432 8e Linux LVM
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# fdisk /dev/sdi1
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x1dc72e36.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): p
Disk /dev/sdi1: 106 MB, 106938368 bytes
64 heads, 32 sectors/track, 101 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Disk identifier: 0x1dc72e36
Device Boot Start End Blocks Id System
Command (m for help): d
No partition is defined yet!
Command (m for help): q
------------------------------------------------------------------------------
[root@localhost ~]#
[root@localhost ~]# fdisk /dev/sdi
Command (m for help):
Command (m for help): p
Disk /dev/sdi: 106 MB, 106954752 bytes
64 heads, 32 sectors/track, 102 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Disk identifier: 0xc9664147
Device Boot Start End Blocks Id System
/dev/sdi1 1 102 104432 8e Linux LVM
Command (m for help):
Command (m for help): d
Selected partition 1
Command (m for help):
Command (m for help): p
Disk /dev/sdi: 106 MB, 106954752 bytes
64 heads, 32 sectors/track, 102 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Disk identifier: 0xc9664147
Device Boot Start End Blocks Id System
Command (m for help):
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]#
[root@localhost ~]# fdisk -l
Disk /dev/sda: 17.1 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000dd907
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 195 1048576 83 Linux
Partition 2 does not end on cylinder boundary.
/dev/sda3 195 2088 15211252+ 83 Linux
Disk /dev/sdi: 106 MB, 106954752 bytes
64 heads, 32 sectors/track, 102 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Disk identifier: 0xc9664147
Device Boot Start End Blocks Id System
[root@localhost ~]#