Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resize root partition online , on xfs filesystem?

Tags:

linux

xfs

when I am trying to extend the root partition , using below method

[root@oel7 ~]# resize2fs /dev/root_vg/root
resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Bad magic number in super-block while trying to open /dev/root_vg/root
Couldn't find valid filesystem superblock.

I am unable to do the same with above last line error.

like image 928
pathak.pk Avatar asked Jul 02 '16 13:07

pathak.pk


People also ask

Can root partition be resized?

There are three common ways to increase disk space on the root partition or any partition for that matter. Delete aging, rotated or unused files. Increase the size of the root partition and resize its filesystem. Add disks and subpartition the root filesystem.


1 Answers

You're working on an XFS filesystem, in this case you need to use xfs_growfs instead of resize2fs. Two commands are needed to perform this task :

# growpart /dev/sda 1

growpart is used to expand the sda1 partition to the whole sda disk.

# xfs_growfs -d /dev/sda1

xfs_growfs is used to resize and apply the changes.

# df -h

NB: You can check this script : https://gist.github.com/OmarTrigui/7d6ec92c8f2ef83ba15b80e30fb6a5be

like image 171
Omar_0x80 Avatar answered Sep 20 '22 14:09

Omar_0x80