Resize disk: Difference between revisions

Create page
 
Add reference links to documentation
Line 1: Line 1:
While working on a [[VirtualBox]] VM, I initially gave it 20GB to work with, in a dynamically allocated disk image (VDI). Soon I discovered that I only really had 17GB of space allocated to the root partition and that a large database operation that I wanted to do on this VM used up all available space. So, I needed to increase the disk space allocated to the VM by VirtualBox, and ensure too that the guest OS ([[Rocky Linux]]) was aware of the space.
While working on a [[VirtualBox]] VM, I initially gave it 20GB to work with, in a dynamically allocated disk image (VDI). Soon I discovered that I only really had 17GB of space allocated to the root partition and that a large database operation that I wanted to do on this VM used up all available space. So, I needed to increase the disk space allocated to the VM by VirtualBox, and ensure too that the guest OS ([[Rocky Linux]]) was aware of the space.


Increasing the size of the disk in VirtualBox 7 was easy enough. With guest stopped, I could access the disk properties in 'Tools' and change the size to 40GB from 20GB. However, it was not sufficient to just restart the VM. Instead, I needed to download a Live CD which I could insert into the virtual CD drive of the guest with the proper tools used to re-partition the guest OS. For this task, I used gparted-live-1.5.0-6-i686.iso (470MB). The strange part was that even after resizing the guest hard drive, the partitions still were not using the full space available. In the <code>lsblk</code> output below, you can see that sda2 has 39GB available, but that the root volume is only 17GB on disk.
Increasing the size of the disk in VirtualBox 7 was easy enough. With guest stopped, I could access the disk properties in 'Tools' and change the size to 40GB from 20GB. However, it was not sufficient to just restart the VM. Instead, I needed to download a Live CD which I could insert into the virtual CD drive of the guest with the proper tools used to re-partition the guest OS. For this task, I used the '''[https://gparted.org/ Gnome Partition Editor]''', more commonly known as 'gparted'. gparted-live-1.5.0-6-i686.iso (470MB). The strange part was that even after resizing the guest hard drive, the partitions still were not using the full space available. In the <code>lsblk</code> output below, you can see that sda2 has 39GB available, but that the root volume is only 17GB on disk.
<pre>
<pre>
  lsblk -o name,type,fstype,mountpoint,size
  lsblk -o name,type,fstype,mountpoint,size
Line 83: Line 83:
tmpfs              tmpfs    769M  32K  769M  1% /run/user/1000
tmpfs              tmpfs    769M  32K  769M  1% /run/user/1000
</pre>
</pre>
== Reference ==
# https://docs.rockylinux.org/books/admin_guide/07-file-systems/
# https://www.virtualbox.org/manual/ch08.html#vboxmanage-modifymedium (note: I didn't use VBoxManage, I just used the 'Tools' in the VirtualBox GUI)


[[Category:System Administration]]
[[Category:System Administration]]
[[Category:File system]]
[[Category:File system]]