You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
filesystem: xfs resize: minimal required increment (#11033)
Internally XFS uses allocation groups. Allocation groups have a maximum
size of 1 TiB - 1 block. For devices >= 4 TiB XFS uses max size
allocation groups. If a filesystem is extended and the last allocation
group is already at max size, a new allocation group is added. An
allocation group seems to require at least 64 4 KiB blocks.
For devices with integer TiB size (>4), this creates a filesystem that
has initially has 1 unused block per TiB size. The `resize` option
detects this unused space, and tries to resize the filesystem. The
xfs_growfs call is successful (exit 0), but does not increase the file
system size. This is detected as repeated change in the task.
Test case:
```
- hosts: localhost
tasks:
- ansible.builtin.command:
cmd: truncate -s 4T /media/xfs.img
creates: /media/xfs.img
notify: loopdev xfs
- ansible.builtin.meta: flush_handlers
- name: pickup xfs.img resize
ansible.builtin.command:
cmd: losetup -c /dev/loop0
changed_when: false
- community.general.filesystem:
dev: "/dev/loop0"
fstype: "xfs"
- ansible.posix.mount:
src: "/dev/loop0"
fstype: "xfs"
path: "/media/xfs"
state: "mounted"
# always shows a diff even for newly created filesystems
- community.general.filesystem:
dev: "/dev/loop0"
fstype: "xfs"
resizefs: true
handlers:
- name: loopdev xfs
ansible.builtin.command:
cmd: losetup /dev/loop0 /media/xfs.img
```
NB: If the last allocation group is not yet at max size, the filesystem
can be resized. Detecting this requires considering the XFS topology.
Other filesystems (at least ext4) also seem to require a minimum
increment after the initial device size, but seem to use the entire
device after initial creation.
Fun observation: creating a 64(+) TiB filesystem leaves a 64(+) block
gap at the end, that is allocated in a subsequent xfs_growfs call.
(cherry picked from commit f594320)
Co-authored-by: jnaab <[email protected]>
Co-authored-by: Johannes Naab <[email protected]>
- filesystem - avoid false positive change detection on XFS resize due to unusable slack space (https://github.com/ansible-collections/community.general/pull/11033).
0 commit comments