Resize VM Disk: Difference between revisions

Jump to navigation Jump to search
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 23: Line 23:


== Step 2 ==
== Step 2 ==
To increase the disk partition:
Resize the Partition to Use the Extra Space:
* In the VM, first get the partition table for info (Assuming the disk is /dev/sda) with `fdisk -l /dev/sda | grep ^/dev`
 
Output should something like this:
[[File:Fdisk-output.png|thumb]]
* Resize using 'parted':
* Resize using 'parted':
   * parted /dev/sda
This is assuming that you need to resize /dev/sda2 (which the 'print' command will help you determine)
   * print
   * `parted /dev/sda`, opens the partition table editor for /dev/sda
   * resizepart 2 100%
   * `print`, double-checks the disk layout
   * quit
   * `resizepart 2 100%`, choose partition you want to resize, here partition 2 is resized to use all available space
This is assuming that you need to resize /dev/sda2 (which the 'print' will help you determine)
   * `quit`, exit parted
 
You can verify the updated partition table running `lsblk`, this lists all storage devices, showing partitions and their sizes.
[[File:Screenshot 2025-03-19 at 15.49.02.png|thumb|center|`lsblk`]]
 
== Step 3 ==
== Step 3 ==
To increase file system's size:
To increase file system's size:
* 'resize2fs /dev/sda2' (Assuming you need to increase /dev/sda2)
* 'resize2fs /dev/sda2' (Assuming you need to increase /dev/sda2), this expands the filesystem on /dev/sda2 to use the full partition
[[File:Screenshot 2025-03-19 at 15.53.12.png|thumb|center|`resize2fs /dev/sda2`]]
 
Verify available space running `df -h`, displays disk usage in a human-readable format
[[File:Screenshot 2025-03-19 at 15.55.56.png|thumb|center|`df -h`]]
 
As a final check you can also check Zabbix for Latest Data > Total Space for your vm
92

edits

Navigation menu