https://github.com/nsevent/expand_virtualbox_storage
A guide to expand storage in a VirtualBox VM with a Windows host and a Linux client
https://github.com/nsevent/expand_virtualbox_storage
Last synced: about 2 months ago
JSON representation
A guide to expand storage in a VirtualBox VM with a Windows host and a Linux client
- Host: GitHub
- URL: https://github.com/nsevent/expand_virtualbox_storage
- Owner: NSEvent
- Created: 2019-08-20T01:52:44.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-20T02:19:40.000Z (almost 7 years ago)
- Last Synced: 2023-09-29T12:57:06.707Z (over 2 years ago)
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Expand usable VirtualBox storage (for ext4 filesystems)
This guide details how to expand your VirtualBox VM's storage with a Windows host and a Linux client
Written by Kevin Tang
## IN WINDOWS (HOST)
### 1. Locate the VM's vdi file
Mine was in "C:\Users\kvntng\VirtualBox VMs\Ubuntu 18.04.2 LTS\Ubuntu 18.04.2 LTS.vdi"
### 2. Make a copy of the vdi before proceeding
### 3. Go to VirtualBox directory in Windows Command Prompt
```
cd “C:\Program Files\Oracle\VirtualBox”
```
### 4. Resize the virtual disk to a desired size
The following command will resize to 80 GB
```
VBoxManage modifyhd "C:\Users\kvntng\VirtualBox VMs\Ubuntu 18.04.2 LTS\Ubuntu 18.04.2 LTS.vdi" --resize 81920
```
### 5. Open VirtualBox. VirtualBox should now detect the change in disk size
## IN LINUX (CLIENT)
### 1. Use gparted to expand the disk space (physical volume)
```
gparted
```
Use the slider to adjust the space expanded
### 2. Find the name of the filesystem
```
df -h
```
Here the name is "/dev/ubuntu-vg/root" mounted on "/"
### Resize logical volume
This will expand the logical volume to 100% of the physical volume
```
sudo lvresize -r -l 100%VG /dev/mapper/ubuntu--vg-root
```
### Resize filesystem
This will resize the filesystem to the full size of the logical volume
```
sudo resize2fs /dev/mapper/ubuntu--vg-root
```