Skip to main content

Change root volume partition table format

The default partition table format of the root volume disk used by the VM instance as a Kubernetes Engine node is MBR (Master Boot Record). The MBR partitioning scheme supports up to 4 partitions and operates only on disks smaller than 2TB. If the Kubernetes Engine node needs to use a root volume larger than 2TB, it must be changed to the GPT (GUID Partition Table) partition table format, which has no restrictions on the number of partitions or disk size.
The following describes how to change the MBR (Master Boot Record) table format to the GPT (GUID Partition Table) format.

Step 1. Check and modify Kubernetes Engine node volume size

To use a volume larger than 2TB on a Kubernetes Engine node, modify the current volume size to more than 2TB.

  1. Go to KakaoCloud Console > Container Pack > Kubernetes Engine.

  2. Select the cluster from the Cluster menu, and then choose a specific node from the Node tab.

  3. In the node detail page, click the Instance ID to access the instance detail page.

    Image: Console Node Detail Page
    Node detail page

  4. In the instance detail page, go to the Volume tab, and select [More] icon > Set volume for the volume you want to configure.

  5. In the Set volume popup, check the current volume size and change it to a size larger than 2TB if needed.

    Image: Console Set volume Popup
    Volume settings popup

Step 2. Check current disk and partition information

Check the disk and partition information of the Kubernetes Engine node.

caution

When changing the partition table format of an existing volume, ensure data preservation. A backup is recommended before making changes.

  1. Use the fdisk command to check the current disk information. In the example below, the /dev/vda disk has a size of approximately 10GB.

    Check current partition information using fdisk command
    sudo fdisk -l
    Partition information check result
    Disk /dev/vda: 10.7 GB, 10737418240 bytes, 20971520 sectors  //Verify that the disk size is approximately 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
  2. Check the partition table information of the current disk using the gdisk command.

    Check current partition size using gdisk command
    sudo gdisk -l /dev/vda
    Partition size check result
    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. Change the partition table

  1. Use the gdisk command to change the partition table from MBR to GPT.

    Change partition table and create boot partition
    sudo gdisk /dev/vda
    Change partition table and create boot partition using gdisk command
    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!'
    ***************************************************************
  2. When changing the partition table to GPT, a boot partition is required. Enter the following commands to create a GPT boot partition.

    ItemSetting Value
    Partition numberEnter 2 to set
    - Defaults if not changed
    First sectorEnter 34 to set
    - Defaults if not changed
    Last sectorEnter 2047 to set
    - Defaults if not changed
    - At the last sector, choose partition code: ef02
    Create GPT boot partition command
    # Enter 'n' (add a new partition)
    Command (? for help): n

    # Enter '2'
    Partition number (2-128, default 2):

    # Enter '34'
    First sector (34-1455966, default = 34) or {+-}size{KMGTP}: 34

    # Enter '2047'
    Last sector (34-1455966, default = 2047) or {+-}size{KMGTP}: 2047

    # Enter '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'

    # Enter 'w' (write table to disk and exit)
    Command (? for help): w
    Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
    PARTITIONS!!

    # Enter '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.
  3. Install grub on the new partition.

    • Caution: If grub is not installed after changing the partition to GPT, the node may fail to reboot. Ensure grub is installed before rebooting.

      Install grub
      # Detect new partition
      [ubuntu@host-x-x-x-x: ~]$ sudo partprobe
      # Install GRUB
      [ubuntu@host-x-x-x-x: ~]$ sudo grub-install /dev/vda
      Installing for i386-pc platform.
      Installation finished. No error reported.
  4. Reboot the system to apply the changes.

    Execute reboot
    sudo reboot
  5. Verify that the disk partition table format has been successfully changed.

    Check disk information using lsblk command
    sudo lsblk
    Disk information check result
    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
    Check current partition information using fdisk command
    sudo fdisk -l
    Current partition information check result
    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