문 서 명 : VM 환경의 Linux OS 디스크 사이즈 늘리기 문 서 버 전 : Ver_1.0 문 서 구 분 : ■ Manual □ Summary 작 성 일 : 2016년 10월 25일 작 성 자 : 우리들의 삶 테 스 트 환 경 : ESXi 5.5, RHEL 6.7, LVM 2.0 출 처 : 본인 |
2. OS에서 fdisk 명령을 통해 disk label 정의
[root@testsvrdwa01 ~]# fdisk -l Disk /dev/sda: 193.3 GB, 193273528320 bytes <늘어난 용량 체크 255 heads, 63 sectors/track, 23497 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000b22b4 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 3264 25701376 8e Linux LVM /dev/sda3 3264 10051 54520257+ 8e Linux LVM [root@testsvrdwa01 ~]# fdisk /dev/sda WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): p Disk /dev/sda: 193.3 GB, 193273528320 bytes 255 heads, 63 sectors/track, 23497 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000b22b4 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 3264 25701376 8e Linux LVM /dev/sda3 3264 10051 54520257+ 8e Linux LVM Command (m for help): n Command action e extended p primary partition (1-4) p <- 만약 차후 더 확장할 계획이 있다면 e 키를 눌러 extended 로 하여야 한다. Selected partition 4 <- 현재 시스템은 1~3번까지 쓰고 있으므로 4번 First cylinder (10052-23497, default 10052): 10052 Last cylinder, +cylinders or +size{K,M,G} (10052-23497, default 23497): Using default value 23497 Command (m for help): p Disk /dev/sda: 193.3 GB, 193273528320 bytes 255 heads, 63 sectors/track, 23497 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000b22b4 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 3264 25701376 8e Linux LVM /dev/sda3 3264 10051 54520257+ 8e Linux LVM /dev/sda4 10052 23497 108004995 83 Linux <- 4번 볼륨이 추가됨 Command (m for help): t <- change a partition's system id Partition number (1-4): 4 <- 4번 볼륨 선택 Hex code (type L to list codes): 8e <- Linux LVM용으로 만들기 위해 partition system id를 8e 로 정의한다. Changed system type of partition 4 to 8e (Linux LVM) Command (m for help): w <- 설정한 내용을 저장 The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error 16: 장치나 자원이 동작 중. The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks. |
[root@testsvrdwa01 ~]# init 6 |
[root@testsvrdwa01 ~]# pvcreate /dev/sda4 <- 방금 정의한 볼륨을 PV로 만들어 준다. Physical volume "/dev/sda4" successfully created [root@testsvrdwa01 ~]# pvs <- 확인 PV VG Fmt Attr PSize PFree /dev/sda2 vg_test lvm2 a-- 24.51g 0 /dev/sda3 vg_test lvm2 a-- 51.99g 0 /dev/sda4 lvm2 --- 103.00g 103.00g <- PV로 만들어졌고, 아무런 VG에 속하지 않는것이 보인다. |
[root@testsvrdwa01 ~]# vgs <- 설정 전 확인 VG #PV #LV #SN Attr VSize VFree vg_test 2 3 0 wz--n- 76.50g 0 [root@testsvrdwa01 ~]# vgextend vg_test /dev/sda4 <- vgextend vg_name pv_path Volume group "vg_test" successfully extended [root@testsvrdwa01 ~]# vgs <- 늘어난 공간 확인 VG #PV #LV #SN Attr VSize VFree vg_test 3 3 0 wz--n- 179.50g 103.00g |
[root@testsvrdwa01 ~]# lvextend /dev/vg_test/lv_home -l +100%FREE <- lv_home을 vg 남은 공간 전체로 확장한다. Size of logical volume vg_test/lv_home changed from 40.00 GiB (10240 extents) to 143.00 GiB (36608 extents). Logical volume lv_home successfully resized [root@testsvrdwa01 ~]# lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert lv_home vg_test -wi-ao---- 143.00g lv_root vg_test -wi-ao---- 20.51g lv_swap vg_test -wi-ao---- 15.99g |
[root@testsvrdwa01 ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_test-lv_root 21G 4.5G 15G 24% / tmpfs 5.9G 0 5.9G 0% /dev/shm /dev/mapper/vg_test-lv_home 40G 30G 7.7G 80% /home /dev/sda1 477M 42M 410M 10% /boot [root@testsvrdwa01 ~]# resize2fs /dev/vg_test/lv_home resize2fs 1.41.12 (17-May-2010) Filesystem at /dev/vg_test/lv_home is mounted on /home; on-line resizing required old desc_blocks = 3, new_desc_blocks = 9 Performing an on-line resize of /dev/vg_test/lv_home to 37486592 (4k) blocks. The filesystem on /dev/vg_test/lv_home is now 37486592 blocks long. [root@testsvrdwa01 ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_test-lv_root 21G 4.5G 15G 24% / tmpfs 5.9G 0 5.9G 0% /dev/shm /dev/mapper/vg_test-lv_home 141G 30G 104G 23% /home /dev/sda1 477M 42M 410M 10% /boot [root@testsvrdwa01 ~]# |
리눅스 디스크 사이즈 확장, 리눅스 용량 확장, 리눅스 용량 증설, Redhat Disk expended, resize2fs, vgextend, lvextend
'시스템 > Operating System' 카테고리의 다른 글
[Linux] FTP 553 Could not create file 에러 메시지 조치 방법 (0) | 2016.12.21 |
---|---|
[Linux] 리눅스 한글이 깨질때 LANG 조치방법 (0) | 2016.12.21 |
[Solaris] 솔라리스 패스워드 복잡성 설정 (0) | 2016.09.30 |
[Redhat 6] LVM 관리 기본!! (0) | 2016.09.06 |
[Redhat 6] RAW Device 생성 및 관리 방법 (0) | 2016.09.06 |