리눅스

Total 331
Today 0
profile_image
슈퍼아이피
11-09-15 22:55 0개 17회
일반문서
CentOS5.6 LVM(Logical Volume Manager) 설정하기
VirtualBOX 에서 테스트 해봤습니다. 잘되네요^^

0.환경
 - CentOS 5.6(VirtualBOX)
 - 8GB SATA Disk 2EA 추가


1. 추가 Disk 확인(/dev/sdb, /dev/sdc)
[root@Localhost ~]# fdisk -l
Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14          78      522112+  82  Linux swap / Solaris
/dev/sda3              79        1044     7759395   83  Linux

Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table

Disk /dev/sdc: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdc doesn't contain a valid partition table

2. pv 확인
[root@Localhost ~]# pvscan
  No matching physical volumes found

3. pv 만들기 및 확인
[root@Localhost ~]# pvcreate /dev/sdb /dev/sdc
  Physical volume "/dev/sdb" successfully created
  Physical volume "/dev/sdc" successfully created
 
[root@Localhost ~]# pvscan
  PV /dev/sdb                      lvm2 [8.00 GB]
  PV /dev/sdc                      lvm2 [8.00 GB]
  Total: 2 [16.00 GB] / in use: 0 [0   ] / in no VG: 2 [16.00 GB]

4. vg 만들기(예,myVG)
[root@Localhost ~]# vgcreate myVG /dev/sdb /dev/sdc
  Volume group "myVG" successfully created

5. lv 만들기(1G)
[root@Localhost ~]# lvcreate -L 1000M myVG
  Logical volume "lvol0" created

6. lv 정보 확인
[root@Localhost ~]# lvdisplay
  --- Logical volume ---
  LV Name                /dev/myVG/lvol0
  VG Name                myVG
  LV UUID                PTi8MR-Ie8f-UP8Z-HbXL-9EZ0-Xa3r-UwApyi
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                1000.00 MB
  Current LE             250
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

--> 장치 이름 : /dev/myVG/lvol0

7. ext3로 포맷
[root@Localhost ~]# mkfs.ext3 /dev/myVG/lvol0
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
128000 inodes, 256000 blocks
12800 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=264241152
8 block groups
32768 blocks per group, 32768 fragments per group
16000 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 37 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

8. tune2fs 점검 없음 설정(점검간격 0(zero), 점검없음(-1)
[root@Localhost ~]# tune2fs -i 0 -c -1 /dev/myVG/lvol0
tune2fs 1.39 (29-May-2006)
Setting maximal mount count to -1
Setting interval between checks to 0 seconds

9. mount 디렉토리 만들기
[root@Localhost ~]# mkdir /mnt/ftp

10. mount 및 확인
[root@Localhost ~]# mount /dev/myVG/lvol0 /mnt/ftp

[root@Localhost ~]# mount | grep ftp
/dev/mapper/myVG-lvol0 on /mnt/ftp type ext3 (rw)

[root@Localhost ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3             7.2G  4.8G  2.1G  71% /
/dev/sda1              99M   35M   59M  38% /boot
tmpfs                 125M     0  125M   0% /dev/shm
/dev/mapper/myVG-lvol0
                      985M   18M  918M   2% /mnt/ftp


<Volume 관리>
1. 볼륨 크기 키우기(예, +500M)
[root@Localhost ~]# lvextend -L+500M /dev/myVG/lvol0 /dev/sdb /dev/sdc
  Extending logical volume lvol0 to 1.46 GB
  Logical volume lvol0 successfully resized

2. 확인(볼륨만 커진 상태임, 변화없음)
[root@Localhost ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3             7.2G  4.8G  2.1G  71% /
/dev/sda1              99M   35M   59M  38% /boot
tmpfs                 125M     0  125M   0% /dev/shm
/dev/mapper/myVG-lvol0
                      985M   18M  918M   2% /mnt/ftp

3. 파일시스템 크기 조절
[root@Localhost ~]# resize2fs /dev/myVG/lvol0
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/myVG/lvol0 is mounted on /mnt/ftp; on-line resizing required
Performing an on-line resize of /dev/myVG/lvol0 to 384000 (4k) blocks.
The filesystem on /dev/myVG/lvol0 is now 384000 blocks long.

4. 확인(크기가 늘어났음)
[root@Localhost ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3             7.2G  4.8G  2.1G  71% /
/dev/sda1              99M   35M   59M  38% /boot
tmpfs                 125M     0  125M   0% /dev/shm
/dev/mapper/myVG-lvol0
                      1.5G   18M  1.4G   2% /mnt/ftp

댓글목록

등록된 댓글이 없습니다.