1

I have come to a point with our production server that I am going to have to increase the size of the drive in the coming weeks. The problem is such that, this server really can't go down for an extended period of time, though reboots and 5-10 minute fixes are acceptable during "regular maintenance periods".

I have increased the drive size from 128GB to 256GB on the VMWare side, but as expected the volume in Ubuntu remains. My question is, is there a way to increase the volume size to get sda3 to "soak up" all the free space while the server is running? I fear my problem is that I have a swap partition at the end of the drive currently, so this will have to be moved/removed.

I have viewed How to resize partitions? but it doesn't address the "hot add" concern (directly).

I have viewed how to use the free space after increasing the size of the disk on VMWare Workstation but the only answer is ambiguous and does not address my concerns about "hot" adding free space to the partition.

Here is my setup:

parted -l

Model: VMware Virtual disk (scsi)
Disk /dev/sda: 275GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type      File system     Flags
 1      1049kB  1000MB  999MB   primary   ext2            boot
 3      1000MB  122GB   121GB   primary   ext4
 2      122GB   134GB   12.0GB  extended
 5      122GB   134GB   12.0GB  logical   linux-swap(v1)

fdisk -l

Disk /dev/sda: 256 GiB, 274877906944 bytes, 536870912 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xc95a459a

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1  *         2048   1953791   1951744   953M 83 Linux
/dev/sda2       238706686 262141951  23435266  11.2G  5 Extended
/dev/sda3         1953792 238704639 236750848 112.9G 83 Linux
/dev/sda5       238706688 262141951  23435264  11.2G 82 Linux swap / Solaris

Partition table entries are not in disk order.

I fear my only recourse at this point is shutting down the server, booting from an ISO, and resizing that way .. OR just spinning up another server and copying everything over onto the new, larger, server. Can this be done reasonably in a production environment?

Zak
  • 153
  • 9

1 Answers1

0

Yes, after deleting the swap and extended, you can resize the partition easily with any partitioning tool. Some partitioning tools, like gparted, will also automatically (if the resize2fs program is present) resize the filesystem on the expanded partition. Other partitioning tools, you will have to do it yourself manually. With the space now available, you can follow your procedure to increase the size of the virtual vmware. Backup everything first of course, just in case, and check how much swap you normally use, since if you are using swap, you will need to deal with that problem.

ubfan1
  • 17,838