Here is the disk, it is thin provisioned vmware disk, and has been grown from 300 to 800 GB
*-disk:1 description: SCSI Disk physical id: 0.1.0 bus info: scsi@2:0.1.0 logical name: /dev/sdb size: 800GiB (858GB) capabilities: partitioned partitioned:dos configuration: sectorsize=512 signature=4268053f
here is the
df -h
output
/dev/sdb1 300G 27G 273G 9% /data
and it stays unchanged when I do this
[evn-mrs-slave]~> xfs_growfs -d /data meta-data=/dev/sdb1 isize=256 agcount=4, agsize=19660736 blks = sectsz=512 attr=2 data = bsize=4096 blocks=78642944, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 log =internal bsize=4096 blocks=38399, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 data size unchanged, skipping
Best Answer
You must grow the partition before you can grow the filesystem. The filesystem is within the partition, and the partition is still
300GiB
large, even though the disk is now800GiB
large.Resizing a Partition
Partitions can't be resized, but they can be deleted and then recreated. When a partition is deleted, the underlying data is still in tact. It's not too difficult to delete and recreate a partition, but the calculation must be done exactly right, or the filesystem inside the partition will be corrupted by misalignment or undersizing.
I don't normally prefer using GUIs, but resizing partitions using the command line is prone to human error, factoring in the partition table (usually
msdos
orgpt
), the beginning of the partition, the end of the partition, and the right size.Easy Way
GParted does all the calculations for you:
It's very self-explanatory, and it even expands the XFS filesystem to fit.
This is generally a safe procedure.
fdisk
WayUse
fdisk
to delete and recreate the partition. Full example:Note the "
Start
" position (the2048
th sector in this example). You will need to type this in as the first sector when you recreate the partition.fdisk
will default to using the largest contiguous free space. (In this example, it's the2030558
th sector.)Now you have a larger partition which contains a smaller XFS filesystem. These commands would expand the XFS filesystem:
Boom, you've got an expanded XFS partition:
xfsdump
Way (only way to shrink XFS)Did you take a backup when I told you to? Yes? Good! I prefer to use
xfsrestore
to restorexfsdump
s onto new partitions. The advantage is that you can actually shrink XFS filesystems using this method, but the downside is that all the data need to be rewritten, which is slower.You can actually use the
fdisk
method above to recreate the partition. After exitingfdisk
, do this instead: