How to increase the disk size of an Ubuntu virtual mach…
To expand the disk of an Ubuntu virtual machine, you can follow the steps below:
- Turn off the virtual machine in virtual machine management software such as VMware or VirtualBox.
- Open the virtual machine management software and locate the location of the virtual machine’s disk file (usually a .vmdk or .vdi file).
- Utilize virtual machine management software to increase the size of the virtual disk to the required size.
- Open the virtual machine.
- Open the terminal in the Ubuntu virtual machine.
- Run the following command to check if the disk has been expanded to the desired size:
- List all disks using the sudo command.
- Locate the device name corresponding to the virtual disk in the output (e.g. /dev/sda).
- Execute the following command to resize the partition:
- Resize partition 1 on /dev/sda using sudo parted.
- The number “1” in the command represents the partition to be adjusted, which can be modified according to the actual situation.
- Run the following command to resize the file system:
- Adjust the size of the file system on /dev/sda1 using sudo resize2fs.
- The file system to be resized is represented by /dev/sda1 in the command, and can be adjusted according to the actual situation.
- Run the following command to confirm that the disk has been successfully expanded:
- Show the disk usage in a human-readable format.
- Check if the available disk space has increased in the output.
After completing the above steps, the disk of your Ubuntu virtual machine has been successfully expanded.