Extend MBR disk with ext4 partition to over 2 TB on CentOS 7

centos7fdiskmbrparted

I have a CentOS 7 machine with two disks mounted [ /dev/sda and /dev/sdb ] using ext4.

I need to extend /dev/sdb1 to over 2 TB.

I extended the disk from 2 TB to 2.5 TB (google cloud)

After using fdisk to delete and recreate the partition, after the reboot the resize2fs /dev/sdb1 does not resize the partition to 2.5 TB, since it looks like fdisk has reached the magical 2 TB limit.

Is there a way to extend /dev/sdb1 to lets say 3 TB without losing the data?

Thanks

update

as suggested by the fellow serverfault user @mzhaase I tried the gdisk with the following steps. The disk was formated with fdisk in total size of 2T

  1. stop all services using the /dev/sdb1 partition

  2. umount the device

  3. Create a backup/snapshot

  4. Extend the disk to 3T

  5. install gdisk if not already installed on the instance

  6. gdisk procedure
    gdisk /dev/sdb
    p #print and save the GUID
    o #delete all partitions
    n #create new partition
    c #label press ENTER or name if it had it
    x #enter expert mode
    g #paste the GUID
    w #write changes

  7. umount /dev/sdb1 #if it gets remounted by gdisk

  8. e2fsck -f /dev/sdb1 #check disk

  9. resize2fs /dev/sdb1 #resize the partition

  10. mount -a #check if the partitions mount as per fstab

  11. reboot #just to be sure

Best Answer

There are two major partitioning schemes in use today: MBR and GPT.

The older, deprecated, and probably still most used one is MBR. However, MBR uses 32 bit to address storage space, using 512 Byte blocks, and 2^32 * 512 Byte are.. 2 TB. So no, you cannot extend an MBR partition over 2 TB. You will need to use GPT for that.

I have never done it myself, but it seems to be possible to convert MBR to GPT without losing data, using gdisk. Try it on your own risk.

Related Topic