swapon fails with fallocate on xfs #5
What happens when you run fallocate on it's own? https://github.com/sethvargo-cookbooks/swap/blob/master/libraries/swapfile.rb#L16
Is fallocate supported on 10.04? It could be an ec2-specific thing too. Any more debugging output?
On Thu, Apr 4, 2013 at 3:24 PM, Seth Vargo firstname.lastname@example.org wrote:
Assuming you've seen fallocate work properly on xfs while creating
Here's all the debugging output I can give:
size=$((1048576 * 100))
fallocate -l $size /mnt/testfallocate
chmod 0600 /mnt/testfallocate
mkswap: /mnt/testfallocate: warning: don't erase bootbits sectors
swapon -v /mnt/testfallocate
swapon on /mnt/testfallocate
Apr 5 17:46:08 prod1-db4b kernel: [4246771.122510] swapon: swapfile has holes
Maybe we should rescue the fallocate call and use dd
This message was sent from my mobile device.
I apologize in advance for any typographical errors or autocorrections.
On Apr 7, 2013, at 1:51 PM, Andrew Gross email@example.com wrote:
Looks like an issue with older versions of XFS.
In 10.04 the version of XFS Progs is
I will see if I can track down anything from bug reports, but my guess is that it will be an issue that cannot be "fixed" without upgrading or degrading to DD.
The issue is coming from
It normally does not cause an issue with swapfiles since the filesystem is supposed to recognize this form of sparse file creation and emulate behavior that would make it seem like it is not a sparse file, however it seems that the older version of XFS is not behaving properly when called on to make swapfiles.
Check out some discussion on
@sethvargo any thoughts on a good way to wrap the logic to retry with dd? It looks like you should be able to catch the error from fallocate when running
Well, we'd need to have some type of cleanup too. It wouldn't just be "retry" with dd. There's also no easy way to begin-rescue in Chef. Ideally we could use something like
bash 'create_swap_file' do code 'fallocate || dd' end
But the fallocate will succeed, just fail to mount.
It could be brought purely in to ruby code and manage the system calls with
On the plus side we should not need to do any 'rolling back'. If we fail at
I have a PoC working at https://github.com/andrewgross/swap/tree/feature/degrade-to-dd
I will need to polish it a little more to make sure it fits with HWRP standards.
This issue seems to be happening again -- at least to an Ubuntu 12 and Ubuntu 14 system running a recent version of the xfsprogs (3.1.8). I'm going to, for now, fork the repo and disable the fallocate code entirely for our own purposes... but it seems like other people are seeing this too: