How to disable disk read cache dropping when the system is going to sleep?
by bodqhrohro from LinuxQuestions.org on (#5NE95)
This drop leads to a prolonged freeze when the system is woken up, as lots of apps suddenly start pulling data from the disk: just like on a cold boot.
I understand why is this crucial for hibernation: another system may be loaded during the hibernation time, or the disk may be safely replugged to another machine and back, so the read cache cannot be considered reliable. Why is it crucial to flush the write buffers: the sleep may be accidentally interrupted due to a power loss. Even why is it useful for external media: they may be freely replugged while the system is sleeping, still they will appear unplugged and plugged again when the system is woken up, so no big deal here.
But I see no reason to drop the read cache for the internal drive. It wouldn't go anywhere while the system is powered, and unlike with hibernation, it's not possible to boot another system in meantime and alter the actual data on the disk.
Is the drop done on the kernel level or the systemd level? I use systemctl suspend to put the system into a sleep. Is there some excludelist, where I can put my internal drive so its read cache won't be dropped?


I understand why is this crucial for hibernation: another system may be loaded during the hibernation time, or the disk may be safely replugged to another machine and back, so the read cache cannot be considered reliable. Why is it crucial to flush the write buffers: the sleep may be accidentally interrupted due to a power loss. Even why is it useful for external media: they may be freely replugged while the system is sleeping, still they will appear unplugged and plugged again when the system is woken up, so no big deal here.
But I see no reason to drop the read cache for the internal drive. It wouldn't go anywhere while the system is powered, and unlike with hibernation, it's not possible to boot another system in meantime and alter the actual data on the disk.
Is the drop done on the kernel level or the systemd level? I use systemctl suspend to put the system into a sleep. Is there some excludelist, where I can put my internal drive so its read cache won't be dropped?