'partx -v -a /dev/sdx' shows incorrect device size and fails to update kernel about the partition table changes for >2.0TB disks using GPT

Solution Verified - Updated -

Issue

  • After adding a new partition to the 7.5 TB disk having GPT label, when partx -a -v /dev/sdx command was run to update the kernel about partition table changes, it showed incorrect disk size, sector values, partition size and was failed to update the kernel about partition table changes.

  • This issue was observed while trying to add 3rd partition to the following 7.5 TB disk which had first 2 partitions already mounted and in-use on system:

    [root@localhost ~]# parted /dev/vdb
    GNU Parted 2.1
    Using /dev/vdb
    Welcome to GNU Parted! Type 'help' to view a list of commands.
    (parted) p
    Model: Virtio Block Device (virtblk)
    Disk /dev/vdb: 7516GB
    Sector size (logical/physical): 512B/512B
    Partition Table: gpt
    
    Number  Start   End     Size    File system  Name  Flags
    1      1049kB  1074MB  1073MB  ext3
    2      1074MB  3110GB  3108GB
    

    o Created a new partition on /dev/vdb while /dev/vdb1 was mounted:

    [root@localhost ~]# parted /dev/vdb "mkpart \" \" 3109555 6040870"
    Warning: WARNING: the kernel failed to re-read the partition table on /dev/vdb
    (Device or resource busy).  As a result, it may not reflect all of your changes
    until after reboot.
    
    [root@localhost ~]# parted /dev/vdb set 3 lvm on
    Warning: WARNING: the kernel failed to re-read the partition table on /dev/vdb
    (Device or resource busy).  As a result, it may not reflect all of your changes
    until after reboot.
    

    o New partition was created by parted command:

    [root@localhost ~]# parted /dev/vdb
    GNU Parted 2.1
    Using /dev/vdb
    Welcome to GNU Parted! Type 'help' to view a list of commands.
    (parted) p
    Model: Virtio Block Device (virtblk)
    Disk /dev/vdb: 7516GB
    Sector size (logical/physical): 512B/512B
    Partition Table: gpt
    
    Number  Start   End     Size    File system  Name  Flags
    1      1049kB  1074MB  1073MB  ext3
    2      1074MB  3110GB  3108GB
    3      3110GB  6041GB  2931GB                     lvm
    

    o But while running partx command to update the kernel about partition table changes, it showed following errors:

    [root@localhost ~]# partx -v -a /dev/vdb
    device /dev/vdb: start 0 size 1795162112                    <---------- incorrect disk size
    gpt: 3 slices
    # 1:      2048-  2097151 (  2095104 sectors,   1072 MB)
    # 2:   2097152-1778382847 (1776285696 sectors, 909458 MB)   <---------- incorrect size of 2nd and
    # 3: 1778382848--1086326785 (1430257664 sectors, 732291 MB)             3rd partitions
    BLKPG: Device or resource busy
    error adding partition 1
    BLKPG: Device or resource busy
    error adding partition 2
    BLKPG: Device or resource busy                              <---------- failed to update kernel about partition table changes
    error adding partition 3
    dos: 0 slices
    

Environment

  • Red Hat Enterprise Linux 6
  • A disk device with size more than 2.0 TB and GPT label

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In