How can i expand the disk of VM

centos7 virtual machine,How can I increase the disk space to 100GiB,I using non-cloud-init based images, and execute two commands:
growpart /dev/sda 2
resize2fs /dev/sda2

1 Like

Maybe someone else will chime in, but I believe the VM root partitions have a default size. You just need to pass a bigger root disk. E.g. you can make a profile like this:

$ lxc profile show vm-bigroot
config: {}
description: VM Profile for a bigger root disk
devices:
  root:
    path: /
    pool: default
    size: 100GB
    type: disk

If you launch a VM with this profile, it will have a disk of the appropriate size. Check df -h inside the container to see if you need to run your growpart commands.

1 Like

Thanks jmiahjones, In this way I was able to solve this problem

1 Like