Expanding the (OS-)disk - Windows & Linux

Expanding the (OS-)disk - Windows & Linux

Why expand the OS-disk?

In a Virtual Machine (VM), the OS-disk is where the Operating System (OS; for instance Windows or Linux) is installed but also encompasses your general desktop and other folders (basically anything on the C:-drive). It is always recommended to store your data on the Z:-disk, as this is the fileshare that everyone in the workspace can access. Moreover, data on the Z-disk is snapshotted (backup of all the changes compared to the previous day) every evening, whereas data on the OS-disk is not being snapshotted

However, you might have noticed that fileshares (in this case the Z:-disk) can be very slow. Unpacking .zip files is way faster if you transfer it to your desktop (= part of the C-disk). Another example is loading heavy images such as CT scans into software. This is way faster when done from your desktop. The C-disk size is 127 GB (on Windows; 16 GB on Linux) by default and there has to be enough space for the OS. In some cases it is therefore desired to increase the size of the OS-disk or to gain access to an extra data disk.

Disks can be increased in size but not decreased!

How to perform (OS-)disk expansion?

These steps will be performed only by the Accountable and Privileged Member  of the Workspace.
In order to up-size the (OS)disk, the Virtual Machine must be deallocated!
  1. Log in to your Workspace
  2. Click on the three dots on the Virtual Machine that you want to perform the up-size (OS)disk
  3. Select Up-Size OS Disk


A pop-up window will appear where you can select the new size of your (OS)disk




After selecting the disk size, check the Confirm Up-Size box and Up-Size to save the changes.



Read below on how to configure the disk to use the expanded volume!

As a self-service, you can expand data disks up to 2TB.
If a disk is 4 TiB or less, you should deallocate your VM and detach the disk before expanding it beyond 4 TiB. If a disk is already greater than 4 TiB, you can expand it without deallocating the VM and detaching the disk.

How to request (OS-)disk expansion more than 2Tb?
  1. Contact your Research Support member via a ticket. Choose your organization and request for a change. Please let us know:
    1. As with anything that incurs costs: permission of the accountable (this will be checked).
    2. The workspace name.
    3. On which VM you want to have the disk expanded and the OS (Windows/Linux).
  2. The Research Support member will contact you with advice on either increasing the OS-disk or putting an extra disk in place.
For Research Support Member
  1. Detach a data disk for resizing above 2TB
When you replace the OS Disks on a virtual machine (VM) and later delete the VM without properly cleaning up the disk, the old disk remains. This leftover disk can cause deployment failures if you try to create a new VM with the same server name. 

How to configure the disk to use the expanded volume?

Prerequisite: Workspace Accountable or Priviledged member role

Windows

  1. After confirmation, you as Owner of a workspace has to perform a couple of simple steps listed below (~5 mins):
    1. Connect to the VM.
    2. Go to the Startmenu and search for Server Manager
    3. Right click on Server Manager and click on Run as administrator.
    4. On the left side, click on File and Storage Services (red square).

    1. Click on Volumes (blue square).
    2. Right click on the disk that was expanded (in this case C:).
    3. Click on Extend volume (green square).


    1. Fill in the size that you have requested and press OK.
    2. The C-disk is now expanded to the requested volume.

Linux

After confirmation, you as Owner of a workspace has to perform partition and filesystem resizing of your Linux VM. 

The instructions below are only required for Linux CentOS machines, for Linux Ubuntu machines you only need to restart your VM. 


Resizing the partitions
  1. Login to your VM and start by checking how much space you have: 
$ df -h
  1. Here you can see the current diskspace and distribution of the partitions:

  1. Change your partition table of disk sda.
    1. (Based on the partition you see highlighted above, partition distribution might look different to you)
    2. Beware: in the command below, refer to the disk (sda) and not to the partition (sda2)
$ sudo fdisk /dev/sda
  1. If your units are not yet in sectors, press " u "
  2. Press " p " to view the partition details. Pay attention to starting and ending sectors.

This will not delete any data, it will only alter the partition table
If you are not sure which partition you should delete, please ask before trying because deleting the "wrong" partition can lead to a dysfunctional Linux VM. 
  1. Delete the /dev/sda2 partition by running in this order:
    1. " d ", <enter>
    2. " 2 ", <enter>
  2. Now create a new partition by running in this order:
    1. n ", <enter>
    2. " p ", <enter>
    3. " 2 ", <enter>
      1. p stands for primary partition and 2 for the partition 2 (if you deleted another partition, select here partition you deleted.
  3. Check that starting sector value is the same as in partition details above (this is usually by default the same value so you can just press enter)
  1. Write the partitions by running " w " <enter>
  2. Reboot the system (if you are using PuTTY or X2GO you might need to start a new session):
$ sudo reboot
Resize filesystem
$ sudo xfs_growfs /dev/sda2
You can verify that your disk was resized:
$ df -h

/dev/sda2 is now resized to 32G.


    • Related Articles

    • Extra data disk request & initialization - Windows & Linux

      Introduction The Z-drive (fileshare) is rather slow compared to a managed disk such as the C-drive. Although expansion of the C-drive is possible, it is good to keep in mind that the Operating System (OS) is also installed on the C-drive. It is not a ...
    • Windows-OSDS/1.0.0 Open Source Data Science

      Windows-OSDS/1.0.0 Open Source Data Science VM template This template has been discontinued, it is not up-to-date anymore. Please contact your local Support Team member for institute-specific VM templates. OS Windows Server 2019 Web browsers Chrome ...
    • Windows-Base 1.0.5

      OS Windows Server 2019 Browsers Microsoft Edge Chrome Utilities Notepad++ 7-Zip
    • Linux VMs

      On the myDRE platform different types of Linux virtual machines (VMs) are available. CentOS 7.5 (is reaching its end of life) Ubuntu 20 (for GPU usage) Ubuntu 22 By default, Linux VMs have no connection to the outside world, so cannot be directly ...
    • Windows VMs

      Introduction Read below how you can connect to the VM from different Operating Systems (OS, e.g. Windows, MacOS, Linux). An Azure virtual machine (VM) gives you the flexibility of virtualization without having to buy and maintain the physical ...