VMware Communities
ogri
Contributor
Contributor

extending disk in a linux VM

Apologies if this is obvious, but the info I've been able to find so far hasn't helped.

I have a Ubuntu 16.04 VM running under VMware workstation (12.5.2 build-4638234) running on Windows 10. The VM seetings  show the disk as:

CUrrent Size: 12.0Gb

System Free: 321Gb

Maximum size: 30Gb

Within the VM, the disk usage is:

Filesystem     1K-blocks     Used Available Use% Mounted on

udev             4058652        0   4058652   0% /dev

tmpfs             815752     9564    806188   2% /run

/dev/sda1       12253360 10816720    791164  94% /

tmpfs            4078756      212   4078544   1% /dev/shm

tmpfs               5120        4      5116   1% /run/lock

tmpfs            4078756        0   4078756   0% /sys/fs/cgroup

vmhgfs-fuse    468848636 21050556 447798080   5% /mnt/hgfs

tmpfs             815752       40    815712   1% /run/user/1000

So I want to extend the root partition to the 30Gb (the max size as above). I run fdisk on /dev/sda and the info looks like:

Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 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: 0x02679b9f

Device     Boot    Start      End  Sectors Size Id Type

/dev/sda1  *        2048 25165823 25163776  12G 83 Linux

/dev/sda2       25167870 41940991 16773122   8G  5 Extended

/dev/sda5       25169920 41940991 16771072   8G 82 Linux swap / Solaris

Now the question is how do I extend the disk space? I have tried following a document (Extending a logical volume in a virtual machine running Red Hat or Cent OS (1006371) | VMware KB)  which suggested creating a partition 3, however when I try this it creates a /dev/sda3 with a size of 2048 sectors. Then pvcreate /dev/sda3 fails as the size if not large enough.

Is it actually possible to extend /dev/sda1?

Any help appreciated, thanks.

0 Kudos
4 Replies
RAJ_RAJ
Expert
Expert

Hi ,

Yes it is possible . Use the gparted live cd .

Refer below link .

Use GParted to increase disk space of a Linux native partition

RAJESH RADHAKRISHNAN VCA -DCV/WM/Cloud,VCP 5 - DCV/DT/CLOUD, ,VCP6-DCV, EMCISA,EMCSA,MCTS,MCPS,BCFA https://ae.linkedin.com/in/rajesh-radhakrishnan-76269335 Mark my post as "helpful" or "correct" if I've helped resolve or answered your query!
ogri
Contributor
Contributor

Thanks. I was trying to find a way to repartition with the machine live. It turns out there is a way, and it seems to work just fine:

disk - Increase partition size on which Ubuntu is installed? - Ask Ubuntu

0 Kudos
RAJ_RAJ
Expert
Expert

Mark my post as "helpful" or "correct" if I've helped resolve or answered your query!

RAJESH RADHAKRISHNAN VCA -DCV/WM/Cloud,VCP 5 - DCV/DT/CLOUD, ,VCP6-DCV, EMCISA,EMCSA,MCTS,MCPS,BCFA https://ae.linkedin.com/in/rajesh-radhakrishnan-76269335 Mark my post as "helpful" or "correct" if I've helped resolve or answered your query!
0 Kudos
wila
Immortal
Immortal

Hello Raj_Raj,

Please do not ask in a followup question to the user that you helped out to assign points.

That's not a very welcoming gesture to a new user.

Also see: VMware Community Code of Conduct and a quote on the relevant part:

When someone answers your question and helps resolve your issue, do your  part, and mark the best answer "correct." You can mark up to two more  answers as "helpful."

Users whose answers were marked "correct" or "helpful" will receive reward points, which will add to their rankings.

Those who answer questions should not then ask for their answer to be marked "Helpful" or "Correct" in an effort to gain more points. This points award should be objectively given by the person who posed the question, or an outside user who found the information beneficial.

FWIW as a gesture from me appreciating you trying to help out I have assigned you a "helpful" on your earlier answer.

thanks

--

Wil

(VMTN User Moderator)

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
0 Kudos