You are not logged in.

#1 2020-08-27 20:52:24

Lemanr
Member
Registered: 2020-03-22
Posts: 36

How do you feel about SwapFile vs Swap partition in a low RAM computer

Hi all!

So I've come a long way but recently I tried (and gave up) trying to shrink my root partition to add that into my swap partition. I ended up simply making a swap file & everything is working great.

That got me thinking, with a lot of people saying swap partitions are basically obsolete (because we have swap files now) is that the whole story? Does anyone have differing opinions for why they might prefer using a swap partition as opposed to a swap file? For me personally I have about 4G of RAM then + 2G swap partition. I'm also thinking about just getting rid of the swap partition & throwing that new memory into the swap file so I'd have 4G RAM & a 10G swap file.

Overall I think I've gasped the basic concepts but am hoping for either a good discussion or perhaps some good resources so I can be better educated on the detailed differences (in function) of a swap partition vs swap file.


Warning recovering help-vampire: Do not feed me help (July, 8th 2020)
Fully Recovered help-vampire big_smile (at some point late 2021)
Linux journey (approximately) Ubuntu -> Arch -> Debian -> Manjaro -> NixOs -> (attempted: unresolved hardware issues) gnu guix -> Gentoo -> Fedora -> Arch (current) (very outdated but back to arch as I put together my own distro).

Offline

#2 2020-08-27 21:10:01

GaKu999
Member
From: US/Eastern
Registered: 2020-06-21
Posts: 696

Re: How do you feel about SwapFile vs Swap partition in a low RAM computer

Depends on your needs and what do you want, idk if it’s actually obsolete tho...

I have an encrypted swap partition, planning to make it usable by all the distros I decide to install (none other than Arch now tho, and the Gentoo guide is long AF)...

Hibernation and etc may be also of consideration, and I believe a big swap partition saved some known Archer root filesystem from a dd whoopsie...


My reposSome snippets

Heisenberg might have been here.

Offline

#3 2020-08-27 21:30:30

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,649
Website

Re: How do you feel about SwapFile vs Swap partition in a low RAM computer

Mod note: Moving to NC.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#4 2020-08-27 22:15:03

liewkj
Member
Registered: 2019-07-08
Posts: 210

Re: How do you feel about SwapFile vs Swap partition in a low RAM computer

In the old days when Linux just got hibernation support, swap partition was required for hibernation (but most people who ran Linux in the old days didn't really care, Linux was meant to be 24/7 uptime, anyway.) I would guess swap partition was easier to manage from the kernel as it was guaranteed to be contiguous and simple linear block addressing. Nowadays, things could have improved tremendously and filesystem could have taken care of swap file fragmentation. The kernel could have been smarter today and managing swap space at filesystem layer instead of block layer could have been trivial.

Offline

#5 2020-09-08 23:08:12

Lemanr
Member
Registered: 2020-03-22
Posts: 36

Re: How do you feel about SwapFile vs Swap partition in a low RAM computer

Gaku,

That's a pretty cool thought. I didn't know you could have different operating systems (distros) sharing a partition. I suppose you couldn't do this with a swap file because each distro only has access to files within their environment unless I'm mistaken. But at the same time, if files are stored on the hard drives of a computer then shouldn't they be able to share partitions as well as files? thus you should be able to allow different distros to access the same swap file?

Wormzy, thanks for keeping the forum well organized.


Warning recovering help-vampire: Do not feed me help (July, 8th 2020)
Fully Recovered help-vampire big_smile (at some point late 2021)
Linux journey (approximately) Ubuntu -> Arch -> Debian -> Manjaro -> NixOs -> (attempted: unresolved hardware issues) gnu guix -> Gentoo -> Fedora -> Arch (current) (very outdated but back to arch as I put together my own distro).

Offline

#6 2020-09-09 04:10:54

GaKu999
Member
From: US/Eastern
Registered: 2020-06-21
Posts: 696

Re: How do you feel about SwapFile vs Swap partition in a low RAM computer

Lemanr wrote:

But at the same time, if files are stored on the hard drives of a computer then shouldn't they be able to share partitions as well as files? thus you should be able to allow different distros to access the same swap file?

Well, that would require different distros to access the same filesystem where the swapfiles are stored, and when you think of it, it’s the same as swap partition, just with extra steps. tongue

Depends on use case, when you want different distros to live isolated and avoid dual hibernation into the same swap, the isolating the swap spaces would be the sane idea.

For a desktop I only care for occasional swapping and to give time to ctrl-c on dd mess-up by accident tongue
So lack of isolation is not an issue, I haven’t tested with multiple distros, haven’t seen one smooth enough, it’s funny how nice installing Arch is...


My reposSome snippets

Heisenberg might have been here.

Offline

Board footer

Powered by FluxBB