While fixing a broken harddisk i just put a bigger disk with 3 TB instead of 2 TB into my Server box.
First because i dont trust the harddisk manufactures to sell me the exact same size i’ve got currently and secondly because
i might use that additional 1 TB for some temporary stuff which doesnt need a RAID.
2 TB was still barely usable with fdisk, but 3 TB will not be. Therefore i needed to dump and load the partition table and convert it on the fly. Sounded complicated but its incredibly easy after i found the right switches.
Normally i would use sfdisk to dump and restore partitions in commandline but it doesnt like GPT Partitions.
For this i use gdisk which can handle both Formats. (it even can convert TO MBR if someone has that weird need)
sda is my working 2 TB disk which has some 300GB partitions (i like to split disks in smaller parts, makes the raid rebuild easier).
Device Boot Start End Blocks Id System
/dev/sda1 63 4883759 2441848+ fd Linux raid autodetect
Partition 1 does not start on physical sector boundary.
/dev/sda2 4883760 786140774 390628507+ fd Linux raid autodetect
/dev/sda3 786140775 1567397789 390628507+ fd Linux raid autodetect
Partition 3 does not start on physical sector boundary.
/dev/sda4 1567397790 3907024064 1169813137+ 5 Extended
Partition 4 does not start on physical sector boundary.
/dev/sda5 1567397853 2348654804 390628476 fd Linux raid autodetect
Partition 5 does not start on physical sector boundary.
/dev/sda6 2348654868 3129911819 390628476 fd Linux raid autodetect
Partition 6 does not start on physical sector boundary.
/dev/sda7 3129911883 3907024064 388556091 fd Linux raid autodetect
Partition 7 does not start on physical sector boundary.
Now i just “open” my sda disk with gdisk and gdisk immediately warns me that it will be convert to GPT if i save, which i dont want to.
But gdisk already has the GPT Format in Memory, so i can create a backup of this GPT Format with Command “b” and save it to a file named partitions.
After this i quit gdisk without writing, open my new 3 TB disk (/dev/sdb) and load that partition. gdisk has some commands that say thay load backups but some of them use the GPT backup partition table, but we want to load a saved backup file.
When the backup is loaded i recheck with “p” and save it with “w” if it is ok.
# 2 TB working RAID member
Backup> Enter the filename "partitions"
# open the new disk
Restore> Enter the filename "partitions"