This article will guide you through the process of increasing the hard disk space provisioned for a virtual machine (SUSE Linux) from 100GB to 200GB. Thin provisioning allows for efficient use of disk space, but there may come a time when you need to expand the size of your virtual disk.
Prerequisites
Before you begin, ensure that you have the following:
- Access to the virtualization software and the SUSE Linux virtual machine
- Sufficient unallocated space on the host machine to expand the virtual disk
Expanding the Virtual Disk
The first step in increasing the hard disk space for your SUSE Linux virtual machine is to expand the virtual disk itself within your virtualization software. The exact steps to do this will vary depending on the software you are using. Here, we will demonstrate using VirtualBox as an example.
# List existing virtual disks
VBoxManage list hdds
# Find the UUID of the disk you want to modify
VBoxManage showhdinfo UUID
# Modify the disk, expanding it to 200 GB
VBoxManage modifymedium disk UUID --resize 200000
Adding the New Disk Space to the Filesystem
Once the virtual disk has been expanded, you'll need to address it from within the SUSE Linux operating system itself. First, you'll want to ensure that the system recognizes the new disk size.
# Check the current partition setup
fdisk -l
# Delete the existing partition to create a new one that utilizes the entire disk space
parted /dev/sda rm 1
# Create a new primary partition utilizing all available space
parted /dev/sda mkpart primary 0% 100%
# Display the updated partition table
parted /dev/sda print
Resizing the Filesystem
After adjusting the partition, you will now need to resize the filesystem to make use of the newly allocated space. For SUSE Linux, we will use the XFS filesystem as an example.
# Ensure the file system is mounted
mount /dev/sda1 /
# Use xfs_growfs to resize the file system
xfs_growfs /
# Confirm updated file system size
df -h
Increasing the hard disk space provisioned for a SUSE Linux virtual machine involves expanding the virtual disk using your virtualization software and then adjusting the partition and filesystem within the operating system. This article discussed the steps for accomplishing this using VirtualBox, parted, and xfs_growfs. Always ensure to back up your data before making these changes, and confirm that the new disk space has been added correctly afterward.