Xfs Grow Not Working

XFS grow not working

You have a 4GB xfs file system on a 4GB partition, so there is no work to do.

To overcome, enlarge the partition with parted then use xfs_growfs to expand the fs. You can use parted rm without losing data.

# umount /data
# parted
GNU Parted 3.1
Using /dev/xvda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit s
(parted) print
....
(parted) rm 2
(parted) mkpart
....
(parted) print
(parted) quit

# xfs_growfs /dev/xvda2
# mount /dev/xvda2 /data

Done. No need to update /etc/fstab as the partition numbers are the same.

XFS RHEL7.3 Cold Reboot, file truncate

Both Java and Python provide access to the fsync operation in their I/O libraries, so this is not really an excuse, but I understand what you mean.

However, the key ext4/XFS difference in this area is typically something else, though. A straight

echo contents > file

will sometimes leave behind a zero-length file even with ext4, particularly if the contents written is more than just a few bytes. What is guaranteed to work on ext4 (with a default configuration) is this:

echo contents > file.new
mv file.new file

With ext4-with-defaults, this will never leave behind a partially written file (only file.new might be incomplete). XFS is different in this regard, there the contents needs to be fsynced before the rename.

In 2014, Eric Sandeen proposed a patch to align the XFS behavior with what ext4 does, but it was not well-received at the time and it was not merged. Maybe the tides have turned since then and a reproposed patch would be acceptable today. (I don't see a flush in the current code, but I'm not an XFS developer.)

If this blocks your migration to XFS, you should absolutely file a support ticket. Even though it's really not an option to deviate from the upstream kernel for this, such customer requires are always important feedback.

How to change block size on XFS

So I did more research and came up with this:

xfsdump -f /mnt/export_file /home
umount /home
mkfs.xfs -b size=1024 /dev/sda2 -f
#Minimum block size for CRC enabled filesystems is 1024 bytes.
mount /home
xfsrestore -f /mnt/export_file /home

As you can see, I was unable to change blocksize to 512B, because of minimum requirement for CRC enabled filesystems, but otherwise, complete success.
I didn't concider I have to unmount the filesystem first. You won't be able to do that if you are logging in as someone who has homedir in /home, so log in as root.

XFS No space left on device

There is a bug with xfs_growfs which causes inodes to not be properly distributed across a partition. The solution is to simply remount with the inode64 option. For example, if this was the /dev/vda1, you would do the following:

mount -o remount,inode64 /dev/vda1

You can find more information about the bug at the following link:

http://xfs.org/index.php/XFS_FAQ#Q:_Why_do_I_receive_No_space_left_on_device_after_xfs_growfs.3F

EC2 Can't resize volume after increasing size

Thank you Wilman your commands worked correctly, small improvement need to be considered if we are increasing EBSs into larger sizes

  1. Stop the instance
  2. Create a snapshot from the volume
  3. Create a new volume based on the snapshot increasing the size
  4. Check and remember the current's volume mount point (i.e. /dev/sda1)
  5. Detach current volume
  6. Attach the recently created volume to the instance, setting the exact mount point
  7. Restart the instance
  8. Access via SSH to the instance and run fdisk /dev/xvde

    WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
    switch off the mode (command 'c') and change display units to
    sectors (command 'u')

  9. Hit p to show current partitions

  10. Hit d to delete current partitions (if there are more than one, you have to delete one at a time) NOTE: Don't worry data is not lost
  11. Hit n to create a new partition
  12. Hit p to set it as primary
  13. Hit 1 to set the first cylinder
  14. Set the desired new space (if empty the whole space is reserved)
  15. Hit a to make it bootable
  16. Hit 1 and w to write changes
  17. Reboot instance OR use partprobe (from the parted package) to tell the kernel about the new partition table
  18. Log via SSH and run resize2fs /dev/xvde1
  19. Finally check the new space running df -h

How to resize xfs in CentOS on GCE?

You have to run growpart first to grow the partition that XFS is sitting on, like this:

sudo growpart /dev/[DEVICE_ID] [PARTITION_NUMBER]
sudo xfs_growfs /dev/[DEVICE_ID][PARTITION_NUMBER]

This is documented pretty well in Google's official docs here.



Related Topics



Leave a reply



Submit