[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Swap size in debain 12



Hello,

On Sun, Aug 13, 2023 at 01:38:35PM +0100, Darac Marjal wrote:
> If it's useful, you *can* Hibernate to a swap file.
> https://wiki.debian.org/Hibernation/Hibernate_Without_Swap_Partition It
> looks a little flaky, though, because you need to tell the kernel how many
> bytes into a device to find the file (which, if you defrag your filesystems
> often could be a problem, but generally speaking files don't move around on
> disk much).

Swap files are fine and their contents never move around on disk.
Not by normal use, anyway.

However, if you create one for the first time when the filesystem is
quite full then there may not be enough contiguous space for the
swap file so it may start off fragmented into several pieces, which
is not optimal.

This isn't usually a concern because:

- Most people that are going to use a swap file set it up quite
  early on when the file system that it's on is pretty empty.

- Swap is inherently slow anyway (even to SSD) so some fragmentation
  isn't going to change much.

Once the actual swap file is created it is a static chunk of data
that doesn't move around as its IO doesn't go through the filesystem
that it is on.

Swap files are a good solution when you later decide to do
hibernation on a machine that either doesn't have a swap partition
or doesn't have one big enough for the task.

Cheers,
Andy

-- 
https://bitfolk.com/ -- No-nonsense VPS hosting


Reply to: