1

I have RH6 wtith GPT disk, which is partitioned as following:

parted /dev/sdb print free
Model: IBM ServeRAID M5110e (scsi)
Disk /dev/sdb: 4599GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Number  Start   End     Size    File system  Name  Flags
        17.4kB  1049kB  1031kB  Free Space
 1      1049kB  2199GB  2199GB  ext4
 2      2199GB  2843GB  644GB   ext4
 3      2843GB  3165GB  322GB   ext4
 4      3165GB  3488GB  322GB   ext4
        3488GB  4599GB  1111GB  Free Space

I want to resize 2 and 3 partitions using 'Free Space' at the end of the block device. These partitions currently unmounted . What is the most proper way to complete the task ? It is not completely clear in manual of parted, as in 'resize' section it gives examples to resize partition with no other partitions present. This is production critical server and no place for mistake here.

  • You cannot. You can only resize partition 4. – NickD Oct 30 '17 at 13:21
  • A.B. This is what I`ve done exactly and now it is looks good. Also i have increased the size of partitions ( all, but / ) by tune2fs -m 1 /dev/sdX – nix-power Oct 30 '17 at 15:20
  • parted can resize partition only in case free space is located directly at the end after the partition in current case the only possible and correct way, is to create brand new partition in free space at the end of the disk, then move all data from partition 3 to to the newly created one, then remove partition 3, and only then resize partition 2 (partition + resize2fs) to whole space created from partition 2 deletion. There is also the way to move 3 partition to the end of disk ( and then resizing it) but it will take more time and more dangerous operation, generally – nix-power Nov 2 '17 at 9:35
2

You can't create a partition that is not contiguous directly on GPT, MBR or pretty much any partition table.

To use the disk with more freedom the most common solution is using an LVM as a single partition over the table and then creating your actual partitions over the lvm, but still you won't be able to just do that with parted. You pretty much would need to recreate all partitions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.