Extend linux partition

Kernels & Hardware, configuring network, installing services

Extend linux partition

Postby banderas20 » 2017-10-12 17:28

Hello all,

i have the following partitions and sizes:
Code: Select all
/dev/sda1 (20GB) Linux
/dev/sda2 (1GB) extended
/dev/sda5 (1GB) Swap

I have upgraded my virtual disk, so now /dev/sda has 30GB. The additional 10GB are unassigned and I want them to be an extension to /dev/sda1. The partitions are already one after another...

¿How can I achieve this?

Posts: 107
Joined: 2016-11-10 15:30

Re: Extend linux partition

Postby arzgi » 2017-10-12 18:33

Posts: 333
Joined: 2008-02-21 17:03
Location: Finland

Re: Extend linux partition

Postby peer » 2017-10-13 14:09

You cannot change the size of a harddisk when you are using it
so use a live cd with gparted
Posts: 34
Joined: 2017-03-26 10:14

Re: Extend linux partition

Postby p.H » 2017-10-13 17:29

I do not think that the OP's request has anything to do with changing the size of a disk while in use. The disk has already been extended.

The OP has several options.

1) Use Gparted on a live system to move the extended partition and the swap and extend the root partition.

2) From the installed system, disable the swap with "swapoff -a" and use Gparted as above. An ext4 partition in use can be extended online.

3) From the installed system, disable the swap as above, and use your favourite partitioning tool to delete the swap partition and the extented partition, extend the root partition and its filesystem, create a new swap partition and format it with mkswap -U same-uuid-as-before-in-fstab.

Final note : the use of LVM instead of plain partitions would have made this much easier. No need to move logical volumes around to extend another volume.
Posts: 519
Joined: 2017-09-17 07:12

Return to System configuration

Who is online

Users browsing this forum: No registered users and 3 guests