15 points jenders 2 days ago 10 comments

mdspan 2 days ago | parent

Swap files are also much easier to set up than partitions if you're using full disk encryption.

demomode 1 hour ago | parent

Swap files are very fragile if you are using hibernation. For FDE I prefer LVM-over-LUKS and a dedicate partition

dwedge 1 hour ago | parent

Interestingly I always use swapfiles and this page made me realise there can be a performance impact if the filesystem is old - the lkml link says as long as the swap file isn't fragmented there's no impact

WalterGR 1 hour ago | parent

In practice, there’s a potentially tremendous impact if you’re using a spinning metal disk. Sectors at the beginning of the disk (which is at the outer edge) are read/written way faster than sectors at the end. File systems tend to prefer writing files at the beginning. If the file system has been used for ‘a long time’ then it’s either fragmented - or it’s been defragmented and the free space is at the slow end of the drive.

One nice thing about swap partitions is that they can be fixed in place even before OS installation.

(Of course, if you’re using swap enough for this to be a huge factor, you probably have bigger problems. But I haven’t done the math.)

gblargg 18 minutes ago | parent

Indeed. I'd always put swap near the beginning, then a small root partition, then the rest. This reduced head movement for often-accessed data, and used the higher bandwidth of the outer tracks.

charcircuit 59 minutes ago | parent

Linux distros that do use swap files do so statically. It doesn't handle dynamically growing and shrinking it like other operating systems.

0xbadcafebee 52 minutes ago | parent

Unless you use the Linux package that does manage swap files dynamically.

weinzierl 31 minutes ago | parent

There used to be a time when not only the OS required using partitions for optimum performace (swapfiles) but also applications.

In the late 90s databases were regularly set up in a way to store their data on raw partitions. There were other types of applications too that required partitions but for databases it was really common.

The practice really only died with OSes allowing apps to bypass the normal filesystem cache.

In Linux this is O_DIRECT and interestingly Linux was super late to the party because Linus hated it with a passion. Now, he was far from the only one, at least Alan Cox and Andrew Morton were skeptical. Linus will forever be remembered for it because that particular discussion is probably the source of the majority of quotes people use against him.

holowoodman 19 minutes ago | parent

Stop using partitions. Use LVM!

Kim_Bruning 6 minutes ago | parent

Every rule has an exception. Beware of this advice on zfs, for instance.