Link to home
Start Free TrialLog in
Avatar of DP230
DP230Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Hard disk problem after increase its size in ubuntu 16_Vsphere6.5

Dear Wizards, I setup the ubuntu 16.04 server in vSphere 6.5 with 250 GB hard disk, but days later I increased it to 500 GB, but seems like the VM still had only 250 GB.

How can I claim it back correctly? Many thanks!

User generated image
User generated image
Avatar of Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Flag of United Kingdom of Great Britain and Northern Ireland image

You now also need to increase the size of the OS Partitions in the Guest OS e.g. Ubuntu.

VMware vSphere ESXi 6.5 does not do this.

You've just changed the size of hard drive, not the OS partition.
When you login into your VM as user "administrator", like you did for issuing the commands "df -h" and "ifconfig" above, you will not be able to resize the partition /dev/sda1 since it will be an active partition, which you can't unmount.
So you have to stop the VM, and being sure it will not restart from a snapshot.
Here you will find a step by step description on how to proceed further.
Avatar of DP230

ASKER

When using GParted to resize the disk, I got this. How can I merge the New Partition 1 to /dev/sda1 ?

User generated image
You've got to

Remove

1. Extended.
2. SWAP

then expand

sda1...

Or move extended to end of disk, and expand sda1.

e.g. the free space needs to be  ext to /dev/sda1 e.g. contiguous.
Avatar of DP230

ASKER

Hi Andrew, yes I did it but seems like the swap is not working, although it was configured swapon. Can you please suggest?

User generated image
User generated image
Check your /etc/fstab file includes a line containing "swap".
Avatar of DP230

ASKER

Hi, this is the result in fstab:

User generated image

one more thing, when I issued command: top -h, it seems like our buff was using quite lot of RAM, was it good?

User generated image
You have to "§format" a disk as swap disk (i.e. write a "header" to it  marking it as a swap device.

The command to do so is "mkswap"

in your case this would be:
####### write swap signature to the swap partition
$ sudo mkswap /dev/sda2
####### write out buffers to disk - just to be sure
$ sync
####### identify UUID of swap partition and verify it matches the UUID in /etc/fstab
$ sudo blkid
#######  turn on swap on all devices configured in /etc/fstab
$ sudo swapon -a

sudo swapon -a
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.