Ubuntu 18.04 GPT PMBR size mismatch 디스크 에러 fix

| 2020년 7월 10일 | 0 Comments

iwinv에서 ubuntu 18.04 서버 사용중에 디스크가 확장되는 상품 변경후 확장이 안되고 GPT PMBR size mismatch 에러 발생 하였습니다.

문제 해결은 간단하며 parted로 fix 해주고 진행 하면 해당 문제가 해결 됩니다.

 


– 문제 사항

# fdisk -l
GPT PMBR size mismatch (52428799 != 209715199) will be corrected by w(rite).
Disk /dev/vda: 100 GiB, 107374182400 bytes, 209715200 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
Disklabel type: gpt
Disk identifier: 5D3036B0-DA35-4E51-9DB7-95BCBB8EC576

Device Start End Sectors Size Type
/dev/vda1 227328 52428766 52201439 24.9G Linux filesystem
/dev/vda14 2048 10239 8192 4M BIOS boot
/dev/vda15 10240 227327 217088 106M EFI System

Partition table entries are not in disk order.

# df -Th
Filesystem Type Size Used Avail Use% Mounted on
udev devtmpfs 12G 0 12G 0% /dev
tmpfs tmpfs 2.4G 7.4M 2.4G 1% /run
/dev/vda1 ext4 25G 2.8G 22G 12% /
tmpfs tmpfs 12G 0 12G 0% /dev/shm
tmpfs tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs tmpfs 12G 0 12G 0% /sys/fs/cgroup
/dev/vda15 vfat 105M 3.4M 102M 4% /boot/efi
tmpfs tmpfs 2.4G 0 2.4G 0% /run/user/1001

※ 상품 변경으로 100G로 출력이 되야 하나 25G 그대로 출력.

 

– parted로 fix 진행

# parted /dev/vda
GNU Parted 3.2
Using /dev/vda
Welcome to GNU Parted! Type ‘help’ to view a list of commands.
(parted) print
Warning: Not all of the space available to /dev/vda appears to be used, you can fix the GPT to use all of the space (an extra 157286400 blocks) or continue with the current setting?
Fix/Ignore? F
Model: Virtio Block Device (virtblk)
Disk /dev/vda: 107GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
14 1049kB 5243kB 4194kB bios_grub
15 5243kB 116MB 111MB fat32 boot, esp
1 116MB 26.8GB 26.7GB ext4

(parted)

 

–  fdisk로 디스크 조정

# fdisk /dev/vda

Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): print
Disk /dev/vda: 100 GiB, 107374182400 bytes, 209715200 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
Disklabel type: gpt
Disk identifier: 5D3036B0-DA35-4E51-9DB7-95BCBB8EC576

Device Start End Sectors Size Type
/dev/vda1 227328 52428766 52201439 24.9G Linux filesystem
/dev/vda14 2048 10239 8192 4M BIOS boot
/dev/vda15 10240 227327 217088 106M EFI System

Partition table entries are not in disk order.

Command (m for help): d
Partition number (1,14,15, default 15): 1

Partition 1 has been deleted.

Command (m for help): n
Partition number (1-13,16-128, default 1):
First sector (34-209715166, default 227328):
Last sector, +sectors or +size{K,M,G,T,P} (227328-209715166, default 209715166):

Created a new partition 1 of type ‘Linux filesystem’ and of size 99.9 GiB.
Partition #1 contains a ext4 signature.

Do you want to remove the signature? [Y]es/[N]o: n

Command (m for help): w

The partition table has been altered.
Syncing disks.

 

–  resize2fs로 적용

# resize2fs /dev/vda1
resize2fs 1.44.1 (24-Mar-2018)
Filesystem at /dev/vda1 is mounted on /; on-line resizing required
old_desc_blocks = 4, new_desc_blocks = 13
The filesystem on /dev/vda1 is now 26185979 (4k) blocks long.

 

–  확인

# df -Th
Filesystem Type Size Used Avail Use% Mounted on
udev devtmpfs 12G 0 12G 0% /dev
tmpfs tmpfs 2.4G 7.4M 2.4G 1% /run
/dev/vda1 ext4 97G 2.8G 94G 3% /
tmpfs tmpfs 12G 0 12G 0% /dev/shm
tmpfs tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs tmpfs 12G 0 12G 0% /sys/fs/cgroup
/dev/vda15 vfat 105M 3.4M 102M 4% /boot/efi
tmpfs tmpfs 2.4G 0 2.4G 0% /run/user/1001

Category: LINUX

장영호

About the Author ()