Skip to main content

[Expert] How do I increase disk space on my Deskpro VM Appliance? - Knowledgebase / Managing Deskpro On-Premise / Troubleshooting - Deskpro Support

[Expert] How do I increase disk space on my Deskpro VM Appliance?

Authors list

If you installed your Deskpro on-premise server using the VM Applicance (OVA), then you would not have had the option to configure the virtual hardware during installation. By standard, the OVA requires a 64GB disk, which will be adequate for the majority of users. However, if you have a larger helpdesk, or have been using the VM Appliance for a long time, you may find you are running out of disk space.

One of the options to resolve this issue is to increase the size of the disk on your Deskpro server. However, as it is running Linux, it is not as straight forward as increasing the size of the disk on your hypervisor. We would need to tell the server that the disk has increased and how to use it.

The guide below will walk you through the process of increasing the disk size on the Deskpro OVA.

Before you start:

This guide is specifically for Ubuntu 16.04 LTS and above. Older versions of the Deskpro OVA installed Ubuntu 14.04 LTS instead. At the time of writing, this version is past the End of Standard Support, and is coming up to End of Life, so we highly recommend you update to a newer version. In this case,  we recommend performing a fresh OVA install, then increase the disk space on the new OVA following this guide. You can then migrate your old helpdesk over to your new helpdesk using the dputils tool.

To find out what version of Ubuntu your OVA is using, login to the server via SSH, and run the following command:

cat /etc/os-release

We would also recommend disabling the helpdesk, by going to Admin > Setup > Settings, and checking the box marked Disable the helpdesk, before clicking Save. This should stop any changes being made or new tickets being processed during the procedure.

Once that's done, in your hypervisor, clone the existing VM, so you have a backup in case things go wrong, and then increase the size of the disk on the original VM. 

Resizing the disk

On the VM, probe the hardware to see if it picks up the larger disk by running

partprobe

followed by

fdisk -l

to see if the disk has grown. You should be able to see that /dev/sda has increased, i.e, if you increase the disk to 100GB:

Disk /dev/sda: 100 GiB, 107374182400 bytes, 209715200 sectors

If this is still displaying the original size of 64GB, you will need to reboot the VM.

reboot

Once the server has booted back up, log back in and check fdisk.

fdisk -l

This should now display the new size of the disk /dev/sda at the top line.

However, the partition /dev/sda1 should still be set to 64GB

Device     Boot Start       End   Sectors Size Id Type
/dev/sda1  *     2048 134215679 134213632  64G 8e Linux LVM

Resizing the partitions

As the OVA uses a swap partition, you'll need to turn that off

swapoff -a

Then, we'll need to go into parted to modify the partitions. First, open the parted prompt with

parted /dev/sda

Don't forget to set your units to sectors to make it easier to track.

(parted) u s

Then print the partition table so you have it available for reference:

(parted) p
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 134217728s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number  Start  End         Size        Type     File system  Flags
1      2048s  134215679s  134213632s  primary               boot, lvm

If your VM Appliance is running Ubuntu 16.04 or newer, then the default version of parted installed should support resizepart, which allows you to resize partitions. This option is unavailable for Ubuntu 14.04 and below, and requires you to delete and re-create the partition, which if done incorrectly, can destroy your server's disks beyond recovery. If you are using Ubuntu 14.04, or the command below does not work, do NOT continue, and create a new OVA then migrate to that instead.

(parted) resizepart 
Partition number? 1 
End?  [134215679s]? 100%

You're specifying the first partition on the partition table, and extending the partition to use 100% of the disk.

Now, when you print the partition table again, the output should be different:

(parted) p
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 209715200s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number  Start  End         Size        Type     File system  Flags
 1      2048s  209715199s  209713152s  primary               boot, lvm

If this works, you should see the start sector is the same, but the end sector is much larger.

Once you're happy everything is correct, quit out of parted

(parted) quit

Then notify your kernel of the change

partprobe

You can confirm this is working by checking fdisk

fdisk -l

This should now show that the size of the partition now matches the size of the disk:

Device     Boot Start       End   Sectors  Size Id Type
/dev/sda1  *     2048 209715199 209713152  100G 8e Linux LVM

If not, you may need to reboot your server

reboot

If the server does not boot back up correctly, then an error was made when repartitioning the disk. This is extremely difficult to recover from, and may result in data loss. If this has happened to you, I recommend removing this VM and booting up the cloned VM which was made as a backup, then start again from the beginning, including a fresh cloned VM to ensure you have the ability to fallback in the event of another error.

Resizing the Physical Volume

At this point, you should have extended your disk, and your partition should match. Now we need to extend the physical volume and logical volume for LVM, and finally the filesystem so the OS can use the additional space.

First, the physical volume.

pvdisplay

This should show the size of the physical volume defined in LVM, and should return something like this:

  --- Physical volume ---
  PV Name               /dev/sda1
  VG Name               deskpro-vg
  PV Size               <64.00 GiB / not usable 2.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              16383
  Free PE               0
  Allocated PE          16383
  PV UUID               SfqUax-akDv-3ucP-noxH-DUNZ-tJbq-7Cb0GE

This now needs to be resized with the following command:

pvresize /dev/sda1

Then to confirm it works, re-run the command again

pvdisplay

And you should now see that the PV size has increased:

  --- Physical volume ---
  PV Name               /dev/sda1
  VG Name               deskpro-vg
  PV Size               <100.00 GiB / not usable 2.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              25599
  Free PE               0
  Allocated PE          25599
  PV UUID               SfqUax-akDv-3ucP-noxH-DUNZ-tJbq-7Cb0GE

Extending the Logical Volume

Now, the logical volume. For this, we will need to find the mapper address for the logical volume. First, you need to confirm which logical volume is mounted as root.

df -h

This should give an output similar to this:

Filesystem                    Size  Used Avail Use% Mounted on
udev                          972M     0  972M   0% /dev
tmpfs                         199M  9.4M  190M   5% /run
/dev/mapper/deskpro--vg-root   62G  4.9G   54G   9% /
tmpfs                         994M     0  994M   0% /dev/shm
tmpfs                         5.0M     0  5.0M   0% /run/lock
tmpfs                         994M     0  994M   0% /sys/fs/cgroup
tmpfs                         199M     0  199M   0% /run/user/0

What you need to do is look at the last column first for root (/), then check the first column to see what filesystem is mounted. For this example, it is /dev/mapper/deskpro--vg-root (note the double hyphen between deskpro and vg).

This is the logical volume that needs to be extended. You can do that with the following command:

lvextend -l +100%FREE /dev/mapper/deskpro--vg-root

This should extend the logical volume to use up the remaining space on the partition. You can confirm this has worked by checking fdisk

fdisk -l

It should now display that logical volume with the new volume size:

Disk /dev/mapper/deskpro--vg-root: 99 GiB, 106342383616 bytes, 207699968 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

Resizing the File System

Now, we can increase the filesystem to make this extra space usable with the following command:

resize2fs /dev/mapper/deskpro--vg-root

Once this has completed, your VM should now be able to use the additional space. You can confirm this with the following command:

df -h

This should now show that the size of the /dev/mapper/deskpro--vg-root filesystem mounted on / has a larger size, and is no longer 100% used.

Filesystem                    Size  Used Avail Use% Mounted on
udev                          972M     0  972M   0% /dev
tmpfs                         199M  9.4M  190M   5% /run
/dev/mapper/deskpro--vg-root   98G  4.9G   88G   6% /
tmpfs                         994M     0  994M   0% /dev/shm
tmpfs                         5.0M     0  5.0M   0% /run/lock
tmpfs                         994M     0  994M   0% /sys/fs/cgroup
tmpfs                         199M     0  199M   0% /run/user/0

Reopening your Helpdesk

 The disk upgrade should now be finished. Don't forget to turn swap back on

swapon

Now, you should be able to log back into your helpdesk and re-enable it, by going to Admin > Setup > Settings, and unchecking the box marked Disable the helpdesk, then clicking Save.

Helpful Unhelpful

1 of 2 people found this page helpful

Add a comment

Please log in or register to submit a comment.

Need a password reminder?