Recover preallocated space after a crash?
Hi list,
it is my understanding that XFS can preallocate some "extra" space via speculative EOF preallocation and speculative COW preallocation.
During normal system operation, that extra space is recovered after some time. But what if system crashes? Can it be even recovered? If so, it is done at mount time or via a (more invasive) fsck?
Thanks.
Signature · 5 lines
Danti Gionatan Supporto Tecnico Assyoma S.r.l. - www.assyoma.it email: [email protected] - [email protected] GPG public key ID: FF5F32A8
Quoted 7 lines · Gionatan Danti
Hi list,
it is my understanding that XFS can preallocate some "extra" space via speculative EOF preallocation and speculative COW preallocation.During normal system operation, that extra space is recovered after some time. But what if system crashes? Can it be even recovered? If so, it is done at mount time or via a (more invasive) fsck?
It will be done silently the next time the inode is cycled through memory via an open()/close() pair as specualtive prealloc is removed on the final close() of a file.
Alternatively, you can trigger reclaim on the current set of in-memory inodes by running:
# xfs_spaceman -c "prealloc -m 64k -s" /mnt
to remove speculative preallocations of more than 64k from all inodes that are in-memory and wait for the operation to complete.
You still need to bring the inodes into memory, so you can do this via find command that reads some inode metadata (e.g. find /mnt -ctime 2>&1 /dev/null). This means you don't need to actually open/close each inode in userspace - the filesystem will traversal all the in-memory inodes and clear the prealloc space itself.
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Il 2020-11-07 21:47 Dave Chinner ha scritto:
Quoted 27 lines · Gionatan Danti
Quoted 7 lines
Hi list,
it is my understanding that XFS can preallocate some "extra" space via speculative EOF preallocation and speculative COW preallocation.During normal system operation, that extra space is recovered after some time. But what if system crashes? Can it be even recovered? If so, it is done at mount time or via a (more invasive) fsck?
It will be done silently the next time the inode is cycled through memory via an open()/close() pair as specualtive prealloc is removed on the final
close()of a file.Alternatively, you can trigger reclaim on the current set of in-memory inodes by running:
# xfs_spaceman -c "prealloc -m 64k -s" /mntto remove speculative preallocations of more than 64k from all inodes that are in-memory and wait for the operation to complete.
You still need to bring the inodes into memory, so you can do this via find command that reads some inode metadata (e.g. find /mnt -ctime 2>&1
/dev/null). This means you don't need to actually open/close each inode in userspace - the filesystem will traversal all the in-memory inodes and clear the prealloc space itself.
Quoted 3 lines
Cheers,
Dave.
Hi Dave,
thanks so much for the clear answer.
Signature · 5 lines
Danti Gionatan Supporto Tecnico Assyoma S.r.l. - www.assyoma.it email: [email protected] - [email protected] GPG public key ID: FF5F32A8