Skip to content

Instantly share code, notes, and snippets.

@miketzian
Last active October 27, 2024 06:19
Show Gist options
  • Save miketzian/353b4246670f6c86ea779860032153cc to your computer and use it in GitHub Desktop.
Save miketzian/353b4246670f6c86ea779860032153cc to your computer and use it in GitHub Desktop.
How to increase Ubuntu vm disk

Resizing Ubuntu vm

  1. In vmware fusion, stop the vm
  2. Virtual Machine > Hard Disk > Nvme settings
  3. Change disk size / close / start the vm
# run command line partition tool
$ parted

# check the partition number 
parted(parted) print list

Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/ubuntu--vg-ubuntu--lv: 62.8GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags: 

Number  Start  End     Size    File system  Flags
 1      0.00B  62.8GB  62.8GB  ext4


Model: VMware Virtual NVMe Disk (nvme)
Disk /dev/nvme0n1: 64.4GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  538MB   537MB   fat32              boot, esp
 2      538MB   1612MB  1074MB  ext4
 3      1612MB  64.4GB  62.8GB

# exit partition tool
(parted) exit

# grow the partition (
# growpart ${disk_device} ${partition_number}
growpart /dev/nvme0n1 3 

# extend the logical volume
lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv

# show the volume groups 
vgdisplay

# expand the file system 
resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment