Solved: VirtualBox new disk space not available even after resize
Why making things so complicated?
Environment:
- Oracle VirtualBox
- Ubuntu Linux 22.04 Server (i.e. CLI only)
Problem:
- In VM I original have 15 GB HD, and extend it to 30GB, but in VM I still see 15GB.
Solve:
- First, make sure you are following this tutorial to add and extend your disk space.
- But the above tutorial is not completed.
- You also need to read this post to get an idea on what is missing.
- But even if you read that, that post is not clear at all.
- So follow this:
- Run `lsblk` first to understand what you have
- In my case, my ubuntu is installed in /dev/sda3, which "said" it has 30GB, but only 14GB is mount to /
- Run `vgs` to see more
- Start resize:
- First, run `pvresize /dev/sda3` to resize your partition
- Then you run `lvresize -L <SIZE>GB <VG_NAME>/<LV_NAME>` to resize volume group and LV_Name
- But how to find SIZE, VG_NAME and LV_NAME?
- SIZE = 30GB
- To find VG_NAME and LV_NAME, run `sudo lvdisplay`
- Now you can complete this command, run
- `sudo lvresize -L 30GB ubuntu-vg/ubuntu-lv`
- In my case, I tried different GB value, like 16GB, 28GB, 29GB
- In this answer, you can also use +5GB to increase space
- Now you need to resize your file system.
- To get your file system, run `df -h`
- Run `sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv`
- Completed. View your result: `df -h`
Comments