Ext tries to avoid it by trying to keep space open in front of the write sector, or finding a space when it commits to disk rather than up front. If that fails the file gets fragmented. If you don’t have a lot of space available on the disk it’s more likely to happen (though this is the case on Windows as well for a slightly different reason. It’s why Windows used to recommend that you leave at least 10% free space on the disk). Larger files obviously more likely to fragment as well.
Ext tries to avoid it by trying to keep space open in front of the write sector, or finding a space when it commits to disk rather than up front. If that fails the file gets fragmented. If you don’t have a lot of space available on the disk it’s more likely to happen (though this is the case on Windows as well for a slightly different reason. It’s why Windows used to recommend that you leave at least 10% free space on the disk). Larger files obviously more likely to fragment as well.