3

I have increased disk size of the VM from vmware player from 30G to 50G. I am not able to figure how to extend the partition inside the Ubuntu server (VM).

Is it possible to increase /dev/sda1 to 50G?

guest os: ubuntu 64bit 16.04 vmware workstation 12 player

#fdisk -l ... ... Disk /dev/ram15: 64 MiB, 67108864 bytes, 131072 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk /dev/sda: 50 GiB, 53687091200 bytes, 104857600 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: 0x0001183e Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 58722303 58720256 28G 83 Linux /dev/sda2 58724350 62912511 4188162 2G 5 Extended /dev/sda5 58724352 62912511 4188160 2G 82 Linux swap / Solaris root@ubs:~# root@ubs:~# root@ubs:~# df -h Filesystem Size Used Avail Use% Mounted on udev 2.0G 0 2.0G 0% /dev tmpfs 394M 5.8M 388M 2% /run /dev/sda1 28G 13G 14G 48% / tmpfs 2.0G 0 2.0G 0% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup cgmfs 100K 0 100K 0% /run/cgmanager/fs tmpfs 394M 0 394M 0% /run/user/1000 root@ubs:~# 

2 Answers 2

2

The problem is that sda2 and sda5 are "in the way". Fortunately sda5 is just swap and so doesn't contain any persistent data.

The steps would be:

  1. Disable all swapping. This will make sda5 free to be deleted.
  2. Delete sda5
  3. Delete sda2
  4. Resize sda1
  5. Create sda2
  6. Create sda5
  7. mkswap sda5
  8. swapon
  9. resizefs /

This might be easier from the console in single user mode, but may be doable without any reboot needed.

0
1

Given your configuration, it is possible but extremely time-consuming to extend /dev/sda1. You must first move sda2 and sda5 to the end of the disk, which will likely require backing up the data, deleting the partitions, extending /dev/sda1, recreating the 2 and 5 partitions, and restoring the data on those partitions. You can then expand the filesystem on /dev/sda1 to use the entirety of the new space.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.