How to resize centos root partition

Jugal Patel 21 Reputation points
2021-09-18T08:35:01.98+00:00

df -h

/dev/sda2        30G   25G  4.8G  84% /
devtmpfs        3.9G     0  3.9G   0% /dev
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           3.9G  9.1M  3.9G   1% /run
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sda1       497M   81M  417M  17% /boot
tmpfs           799M     0  799M   0% /run/user/1000

We have resize os partition from Azure Portal to 64GB but it is not reflectingin df -h command.

It is showing old size for **/dev/sda2 ** partition

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,373 questions
Azure Disk Storage
Azure Disk Storage
A high-performance, durable block storage designed to be used with Azure Virtual Machines and Azure VMware Solution.
586 questions
0 comments No comments
{count} votes

Accepted answer
  1. Andreas Baumgarten 99,466 Reputation points MVP
    2021-09-18T08:58:25.227+00:00

    Hi @Jugal Patel ,

    I am not familiar with Linux but using a search engine is helpful. There are a lot of search results "how to resize a partition in Linux/CentOS". Here are a few:

    https://serverfault.com/questions/861517/centos-7-extend-partition-with-unallocated-space
    https://blog.bertello.org/2019/12/resizing-centos-7-disk/
    https://www.golinuxcloud.com/extend-resize-primary-partition-non-lvm-linux/
    https://gist.github.com/troyfontaine/87091bd6a5c68f45dd62ced3d12bc377
    Resize Azure Linux CentOS 7 VM OS Disk -> https://www.ntweekly.com/2020/04/20/resize-azure-linux-centos-7-vm-os-disk/

    As always when working on partitions in any OS: Create a proper backup of the VM first! If something is going wrong you are able to restore the vm from backup.

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Jugal Patel 21 Reputation points
    2021-09-18T10:51:24.057+00:00

    Thanks for your Help & Time @Andreas Baumgarten

    I have been to this link https://www.ntweekly.com/2020/04/20/resize-azure-linux-centos-7-vm-os-disk/

    but have to ran xfs_growfs / after reboot.