How does EXT4 handle sudden lack of space in the underlying storage?
8
votes
2
answers
1871
views
Usually, block device drivers report correct size of the device, and it is possible to actually use all the "available" blocks. So, the filesystem knows how much it can write to such device in prior.
But in some special cases, like it is with
Therefore, my question is, what happens in such scenario: an EXT4 filesystem is mounted
But suddenly, the underlying block device of that EXT4 filesystem starts to refuse any writes due to "no space left". What will be the behavior of the filesystem?
Will it print errors and go to
Considering worst scenario, if the disk cache was taking up most of the RAM at the moment of
Thanks in advance.
But in some special cases, like it is with
dm-thin
or dm-vdo
devices, this statement is false. This kind of block devices can return ENOSPC
error at any moment, if their underlying storage (which the upper-level FS knows nothing about) gets full.Therefore, my question is, what happens in such scenario: an EXT4 filesystem is mounted
r/w
, in async
mode (which is the default), and it is doing a massive amount of writes. The disk cache (dirty memory) gets involved too, and at the moment there is a lot of data to be written if user runs sync
command.But suddenly, the underlying block device of that EXT4 filesystem starts to refuse any writes due to "no space left". What will be the behavior of the filesystem?
Will it print errors and go to
r/o
mode aborting all the writes and possibly causing data loss? If not, will it just wait for space, periodically retrying writes and refusing new ones? In that case, what will happen to the huge disk cache, if other processes try to allocate lots of RAM? (On Linux, dirty memory is considered Available, isn't it?).Considering worst scenario, if the disk cache was taking up most of the RAM at the moment of
ENOSPC
error (because admin has set vm.dirty_ratio
too high), can the kernel crash or lock up? Or it will just make all processes which want allocate memory wait/hang? Finally, does the behavior differ across filesystems?
Thanks in advance.
Asked by melonfsck - she her
(150 rep)
Feb 20, 2024, 12:16 PM
Last activity: Feb 25, 2024, 12:39 PM
Last activity: Feb 25, 2024, 12:39 PM