The device /dev/sda2 original space at 32GB, then I try to expand to 512GB as it is shown in lsblk but not in disk free listing still show 32GB. I've rebooted the redhat 7.6 vm.

    $ df -h
    Filesystem      Size  Used Avail Use% Mounted on
    /dev/sda2        32G  6.0G   26G  19% /
    devtmpfs         16G     0   16G   0% /dev
    tmpfs            16G     0   16G   0% /dev/shm
    tmpfs            16G  1.6G   15G  10% /run
    tmpfs            16G     0   16G   0% /sys/fs/cgroup
    tmpfs            16G   32K   16G   1% /tmp
    /dev/sda1       497M  132M  366M  27% /boot
    /dev/sdb1        63G  2.1G   58G   4% /mnt/resource
    tmpfs           3.2G     0  3.2G   0% /run/user/1000

    $ lsblk
    fd0      2:0    1     4K  0 disk 
    sda      8:0    0   512G  0 disk 
    ├─sda1   8:1    0   500M  0 part /boot
    └─sda2   8:2    0 511.5G  0 part /
    sdb      8:16   0    64G  0 disk 
    └─sdb1   8:17   0    64G  0 part /mnt/resource
    sr0     11:0    1  1024M  0 rom

    $cat /proc/partitions | grep sda2
       8        2  536357888 sda2

    # parted /dev/sda2
    GNU Parted 3.1
    Using /dev/sda2
    Welcome to GNU Parted! Type 'help' to view a list of commands.
    (parted) print                                                            
    Model: Unknown (unknown)
    Disk /dev/sda2: 549GB
    Sector size (logical/physical): 512B/4096B
    Partition Table: loop
    Disk Flags: 

    Number  Start  End    Size   File system  Flags
     1      0.00B  549GB  549GB  xfs

I'm wondering If i missed any steps.

  • 2
    If the physical block device has expanded, but the filesystem within the partition has not grown, you could try resize2fs? – DopeGhoti Jan 31 at 22:27

You must also resize the file system, not only the partition.

The partition has to be expanded first, then the file system. For shrinking, the order would be reverse.

For xfs, the command to extend the file system seems to be xfs_growfs - expand an XFS filesystem. The default action is to grow the file system to fill the available space on the partition.

For ext file systems, the command is resize2fs.

  • Was missing the xfs_growfs /dev/sda2 command. Thanks. – Surfs Up Feb 1 at 5:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.