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 fsync
ed 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
- Stop the instance
- Create a snapshot from the volume
- Create a new volume based on the snapshot increasing the size
- Check and remember the current's volume mount point (i.e.
/dev/sda1
) - Detach current volume
- Attach the recently created volume to the instance, setting the exact mount point
- Restart the instance
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')Hit p to show current partitions
- 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
- Hit n to create a new partition
- Hit p to set it as primary
- Hit 1 to set the first cylinder
- Set the desired new space (if empty the whole space is reserved)
- Hit a to make it bootable
- Hit 1 and w to write changes
- Reboot instance OR use
partprobe
(from theparted
package) to tell the kernel about the new partition table - Log via SSH and run resize2fs /dev/xvde1
- 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
How to Execute a Command in a Bash Script and Then Focus The Appearing Window
Sending Snmp2 Trap Message from Linux Command Lne
How to Create a File in Assembly with a Dynamically Specified File Path
"Nothing to Commit (Working Directory Clean)" When a Folder Has Been Added
Linux Kernel Hardware Break Points
Finding and Listing Duplicate Words in a Plain Text File
How to Install and Run Tacotron2 on Ubuntu Wsl
Re-Stream a Mpeg2 Ts Pal Stream with Crtmpserver
Is It Secure to Rely on "X-Forwarded-For" to Restrict Access by Ip in Apache While Using Cloudflare
Xfs - How to Not Modify Mtime When Writing to File
Unexpected Periodic Behaviour of an Ultra Low Latency Hard Real Time Multi-Threaded X86 Code
Where Do You Send The Kernel Console on an Embedded System
Linux + Verify If File Is Text or Binary
Undelete The Deleted Command in Bash
Install Python 32 Bit on 64 Bit Linux
Docker Can't Write to Directory Mounted Using -V Unless It Has 777 Permissions
Remote Linux Server to Remote Linux Server Large Sparse Files Copy - How To