Skip to content

Instantly share code, notes, and snippets.

@jiyuhan
Created July 13, 2021 02:42
Show Gist options
  • Save jiyuhan/a5dd890ab9fa3ade05611231490dd3a6 to your computer and use it in GitHub Desktop.
Save jiyuhan/a5dd890ab9fa3ade05611231490dd3a6 to your computer and use it in GitHub Desktop.
Linux filesystem resizing with NVME LVM partitioned - after cloning/duplication
# let partition take all the extra space
$ sudo growpart <disk location: /dev/nvme0n1> <partition num> # i.e. nvme0n1p3 typically means it is on partition 3
# run a lsblk to validate what you see
$ lsblk
# you should see the partition has grown to consume all the leftover space
# then run pvresize to have your physical volume (on that partition)
$ sudo pvresize /dev/nvme0n1p3
# then run lvm resize command to let your lvm take all the space
$ sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
# finally, resize your lvm to reflect the new space that has been allocated to that LVM
$ sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
# profit! to check results
$ df
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment