루트 볼륨 파티션 테이블 형식 변경
Kubernetes Engine 노드로 사용하는 VM 인스턴스의 루트 볼륨 디스크는 기본적으로 MBR(Master Boot Record) 파티션 테이블 형식을 사용합니다. MBR은 최대 4개의 파티션을 지원하며, 2 TB 이하의 디스크에서만 사용할 수 있습니다.
노드에서 2 TB 이상의 루트 볼륨을 사용하려면 파티션 개수와 용량에 제한이 없는 GPT(GUID Partition Table) 형식으로 변경해야 합니다.
Step 1. Kubernetes Engine 노드 볼륨 크기 확인 및 수정
Kubernetes Engine 노드에 2TB 이상의 볼륨을 사용하려면, 현재 설정되어 있는 볼륨 크기를 2TB 이상의 크기로 설정을 변경해야 합니다.
-
카카오클라우드 콘솔 > Container Pack > Kubernetes Engine 메뉴로 이동합니다.
-
클러스터 메뉴에서 클러스터를 선택 후, 노드 탭에서 특정 노드를 선택합니다.
-
노드 상세 페이지에서 인스턴스 ID를 클릭하여 인스턴스의 상세 페이지로 이동합니다.
-
인스턴스 상세 페이지의 볼륨 탭에서 설정할 볼륨의 [⋮] 버튼 > 볼륨 설정을 선택합니다.
-
볼륨 설정 팝업창에서 설정되어 있는 볼륨 크기를 확인하고, 2TB 이상의 크기로 변경하여 저장합니다.
Step 2. 현재 디스크 및 파티션 정보 확인하기
Kubernetes Engine 노드의 디스크 및 파티션 정보를 확인합니다.
기존에 사용 중인 볼륨의 파티션 테이블 형식을 변경하는 경우, 데이터 보존에 유의해야 하며 변경 전 백업을 권장합니다.
-
fdisk명령어로 현재 디스크 정보를 확인합니다. 아래 결과 예시에서는/dev/vda디스크가 약 10GB의 크기인 것을 확인할 수 있습니다.현재 파티션 정보 확인 fdisk 명령어sudo fdisk -l파티션 정보 확인 결과Disk /dev/vda: 10.7 GB, 10737418240 bytes, 20971520 sectors //디스크가 약 10GB의 크기인 것을 확인
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0009b542
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 20971486 10484719+ 83 Linux -
gdisk 명령어로 현재 디스크의 파티션 테이블 정보를 확인합니다.
현재 파티션 크기 확인 gdisk 명령어sudo gdisk -l /dev/vda파티션 크기 확인 결과GPT fdisk (gdisk) version 0.8.10
Partition table scan: // 디스크 파티션의 테이블이 MBR인 것을 확인
MBR: MBR only
BSD: not present
APM: not present
GPT: not present
***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory.
***************************************************************
Disk /dev/vda: 20971520 sectors, 10.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 79C4C601-BF62-45E4-97F8-AB21F158EED7
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 20971486
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)
Number Start (sector) End (sector) Size Code Name
1 2048 20971486 10.0 GiB 8300 Linux filesystem
Step 3. 파티션 테이블 변경하기
-
gdisk명령어로 파티션 테이블을MBR에서GPT로 변경합니다.파티션 테이블 변경 및 부트 파티션 생성sudo gdisk /dev/vda파티션 테이블 변경 및 부트 파티션 생성 gdisk 명령어GPT fdisk (gdisk) version 0.8.10
Partition table scan:
MBR: MBR only
BSD: not present
APM: not present
GPT: not present
***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory. THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by
typing 'q' if you don't want to convert your MBR partitions
to GPT format!'
*************************************************************** -
파티션 테이블 변경 시,
GPT에서는 부트 파티션이 필요합니다. 아래의 명령어를 입력하여GPT부트 파티션을 생성합니다.항목 설정값 Partition number2를 입력하여 지정
- 설정값을 바꾸지 않으면 Default로 적용됨First sector34를 입력하여 지정
- 설정값을 바꾸지 않으면 Default로 적용됨Last sector2047를 입력하여 지정
- 설정값을 바꾸지 않으면 Default로 적용됨
- Last sector에서 파티션 코드 :ef02선택GPT 부트 파티션 생성 명령어# 'n' 입력(add a new partition)
Command (? for help): n
# '2' 입력
Partition number (2-128, default 2):
# '34' 입력
First sector (34-1455966, default = 34) or {+-}size{KMGTP}: 34
# '2047' 입력
Last sector (34-1455966, default = 2047) or {+-}size{KMGTP}: 2047
# 'ef02' 입력
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): ef02
Changed type of partition to 'BIOS boot partition'
# 'w' 입력(write table to disk and exit)
Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
# 'y' 입력
Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/vda.
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot.
The operation has completed successfully. -
신규 파티션에 grub을 설치합니다.
-
주의:
GPT로 파티션 변경 후 grub 설치가 되지 않으면 노드가 재기동에 실패합니다. 반드시 grub 설치 후 재기동을 실행해 주세요.grub 설치# 신규 파티션 인식
[ubuntu@host-x-x-x-x: ~]$ sudo partprobe
# GRUB 설치
[ubuntu@host-x-x-x-x: ~]$ sudo grub-install /dev/vda
Installing for i386-pc platform.
Installation finished. No error reported.
-
-
변경 사항 반영을 위해 재기동을 실행합니다.
재기동 실행sudo reboot -
디스크 파티션 테이블 형식이 잘 변경되었는지 확인합니다.
디스크 정보 확인 lsblk 명령어sudo lsblk디스크 정보 확인 결과NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda 252:0 0 3T 0 disk
├─vda1 252:1 0 3T 0 part /
└─vda2 252:2 0 1007K 0 part현재 파티션 정보 확인 fdisk 명령어sudo fdisk -l현재 파티션 정보 확인 결과WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/vda: 3221.2 GB, 3221225472000 bytes, 6291456000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
Disk identifier: D9C42684-E18C-4B8F-9388-C2F2CDC093ED
# Start End Size Type Name
1 2048 6291455965 3T Linux filesyste Linux filesystem
2 34 2047 1007K BIOS boot BIOS boot partition