News
Faster Speeds: Bandwidth for vStack Servers in Kazakhstan Increased to 200 Mbps
DC
May 14 2020
Updated June 27 2025

How to Expand Disk Space on Ubuntu 16.04

Ubuntu VPS

Using another OS?

Select the desired version or distribution.

After increasing the disk size in your hosting or control panel, you must also expand the available space within the Ubuntu 16.04 operating system to make full use of it.

Open a terminal as root and type the following commands:

root@Serverspace:~# echo 1 /sys/block/sda/device/rescan

Check the disk information

Using the section and disk utility parted, get information about the sections:

root@Serverspace:~# parted
(parted) p
Model: VMware Virtual disk (scsi)
Disk /dev/sda: %size%GB

Memorize disk size %size%GB.
Resize the section using the resizepart command of the parted utility, specifying the section number %partnum%

(parted) resizepart %partnum%

As "End" value we use %size% value from the (parted) p output, which you memorized earlier.

End? [XX.X GB]? %Size%GB

Finish the work of the utility parted with the command:

(parted) quit

After that we will get information about the need to make changes in the fstab:

Information: You may need to update /etc/fstab.

Now we will use the fdisk section utility:
After receiving the list of sections with the -l parameter, select the section we need (in our example /dev/sda)

root@Serverspace:~# fdisk -l
root@Serverspace:~# fdisk /dev/sda

Create a section- section type (L) - logical

Command (m for help): n
Select (default p): l
Adding logical partition %lpart%

Memorize the section number you created during the command (in the example it will be %lpart%).

Accept the value by default - press Enter twice:

First sector (XXX-YYY, default ZZZ):
Last sector, +sectors or +size{K,M,G} (XXX-YYY, default ZZZ):

Change the section type, write the number of the section you memorized earlier (in the example it was %lpart%).

Command (m for help): t
Partition number (1-X): %lpart%
Hex code (type L to list codes): 8e Command (m for help): w

nform the kernel about the changes:

root@Serverspace:~# partx -v -a /dev/sda

In the response you’ll see a line. /dev/sda: partition %lpart% added

Initialize the section, instead of %lpart% we again use the section number that we memorized earlier.

root@Serverspace:~# pvcreate /dev/sda%lpart%
Physical volume "/dev/sda%lpart" successfully created

Add a physical section to an existing volume group:

root@Serverspace:~# vgextend ubuntu-vg /dev/sda%lpart%
Volume group "ubuntu-vg" successfully extended

Expand the logical volume with lvextend.

root@Serverspace:~# lvextend -l +100%FREE //dev/ubuntu-vg/root
Extending logical volume root to YY.ZZ GiB
Logical volume root successfully resized

Expand the file system. with the utility resize2fs.

root@Serverspace:~# resize2fs /dev/ubuntu-vg/root

FAQ: Expanding Disk Space on Ubuntu 16.04

  • Q1: Why do I need to expand the disk space in the OS if I already did it in the control panel?
    Expanding disk space in the control panel only allocates more virtual storage. To make that space usable by the OS, you must manually resize partitions and logical volumes within Ubuntu.
  • Q2: Will these instructions work on other Ubuntu versions?
    While the general steps are similar, partition names, volume group names, or available tools might differ in newer versions. Always adapt commands to your specific setup.
  • Q3: What if I don’t use LVM?
    If your system doesn’t use LVM, you’ll need to resize the partition and filesystem directly (e.g., using parted and resize2fs), skipping the pvcreate, vgextend, and lvextend steps.
  • Q4: Is it safe to resize partitions on a live system?
    It’s recommended to take a backup or snapshot before proceeding. While resizing is usually safe, any mistake with partition numbers or commands can cause data loss.
  • Q5: I see a warning about updating /etc/fstab. Should I be worried?
    This is a general reminder. If you're only resizing and not changing UUIDs or mount points, /etc/fstab usually doesn't require any changes.
  • Q6: How can I check if the disk expansion was successful?
    You can run df -h to see the updated disk usage, and lsblk or lvdisplay to confirm logical volume changes.
Vote:
5 out of 5
Аverage rating : 5
Rated by: 1
1101 CT Amsterdam The Netherlands, Herikerbergweg 292
+31 20 262-58-98
700 300
ITGLOBAL.COM NL
700 300

You might also like...

We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.