LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Increasing the size of an extended partition to allow the creation of a new partition (https://www.linuxquestions.org/questions/linux-server-73/increasing-the-size-of-an-extended-partition-to-allow-the-creation-of-a-new-partition-808723/)

chakkerz 05-18-2010 08:46 PM

Increasing the size of an extended partition to allow the creation of a new partition
 
Hello there

I've got a server that needs more space. To achieve this we added space (by extending the VMware disk attached to it).

Normally this isn't an issue, because we just add an new partition and LVM it from there, but this host predates our deployment of LVM everywhere.

Thus i'm facing this issue:

Code:

Command (m for help): p

Disk /dev/sda: 204.0 GB, 204010946560 bytes
255 heads, 63 sectors/track, 24802 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          1          16      128488+  83  Linux
/dev/sda2              17        538    4192965  83  Linux
/dev/sda3            539        799    2096482+  82  Linux swap / Solaris
/dev/sda4            800      18275  140375970    5  Extended
/dev/sda5            800        1060    2096451  83  Linux
/dev/sda6            1061        1321    2096451  83  Linux
/dev/sda7            1322        1582    2096451  83  Linux
/dev/sda8            1583        1843    2096451  83  Linux
/dev/sda9            1844      18275  131990008+  83  Linux

Command (m for help): v
104871377 unallocated sectors

Command (m for help): n
No free sectors available

Our current theory is that the unallocated sectors can not be assigned because they aren't part of the extended partition, and thus ... we go in a circle.

So what i believe the way forward is to extend sda4 so that i can then create an sda10 inside of it. Anyone have any ideas on how to do this? I was thinking gparted may do the trick ... but being a server i'm in runlevel3, with no X...

Cheers
chakkerz

syg00 05-18-2010 08:57 PM

gparted wil certainly do it, but here's a trick using cfdisk.
Allocate a new logical to occupy all that space - that will extend the extended. Then delete the new logical.

Tada ...

chakkerz 05-18-2010 10:03 PM

Too easy.

So I:
- installed cfdisk,
- created a new partition using the unallocated space;
- took the warning about dataloss serious (for once) and thus took a snapshot of the vm;
- wrote the partition table to disk;
- verified that what i wanted to see was happening using fdisk:
Code:

[root@tangelo ~]# fdisk /dev/sda

The number of cylinders for this disk is set to 24802.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
  (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sda: 204.0 GB, 204010946560 bytes
255 heads, 63 sectors/track, 24802 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          1          16      128488+  83  Linux
/dev/sda2              17        538    4192965  83  Linux
/dev/sda3            539        799    2096482+  82  Linux swap / Solaris
/dev/sda4            800      24802  192804097+  5  Extended
/dev/sda5            800        1060    2096451  83  Linux
/dev/sda6            1061        1321    2096451  83  Linux
/dev/sda7            1322        1582    2096451  83  Linux
/dev/sda8            1583        1843    2096451  83  Linux
/dev/sda9            1844      18275  131990008+  83  Linux
/dev/sda10          18276      24802    52428096  83  Linux

- and made the system see the partition using partprobe:
Code:

[root@tangelo ~]# ls /dev/sda*
/dev/sda  /dev/sda2  /dev/sda4  /dev/sda6  /dev/sda8
/dev/sda1  /dev/sda3  /dev/sda5  /dev/sda7  /dev/sda9
[root@tangelo ~]# partprobe
[root@tangelo ~]# ls /dev/sda*
/dev/sda  /dev/sda10  /dev/sda3  /dev/sda5  /dev/sda7  /dev/sda9
/dev/sda1  /dev/sda2  /dev/sda4  /dev/sda6  /dev/sda8
[root@tangelo ~]#

Once again, thanks

syg00 05-18-2010 10:08 PM

Didn't notice you were in Brisbane - I could have dropped in and done it for you.

chakkerz 05-18-2010 10:18 PM

too late now :) next time


All times are GMT -5. The time now is 05:41 PM.