A question about using a swapfile on a lvm partition

I apologize if this question is in the wrong place.

I have wanted to setup my system to use a swap file instead of using a swap partition. I ran across an article several months ago stating that it was not recommended to use a swapfile on a lvm partition. Although, I can’t remember why it wasn’t recommended, nor can I seem to find the article again.

Is still not recommended, or should it work just fine?

Current setup:
2 hdds (1 TB, 2TB)
EFI partition (512 MB)
Vg1 spans the rest of both drives
2 partitions:
Vg1-root (system root, 2.99 TB)
Vg1-swap (swap, 1 GB)

No partition is encrypted

When in doubt, check the wiki instead of a shadowy article Swap - Manjaro

I didn’t see anything about lvm partitions. So I’m guessing that there shouldn’t be any reason why it wouldn’t work? I guess there’s only one way to find out…

Hi! A swap partition in a lvm partition works fine. I use it at my desktop. Regarding a swap file, I never tried it, but I guess it should work too. Anyway, you already have a swap partition, so I’m guessing you really meant partition and not file.

Oh, no, I wanted to switch from a swap partition to a swap file. I just wanted to see if anyone knew of any major problems running a swap file on a lvm partition (demons will devour your HDDs, or something). But, I followed the wiki guide, made the switch, and so far no problems.

It’s a file.
Like any other file.
Why would it not work?
It does work.
I run an encrypted setup.
Luks encrypted disk, with lvm partitions on it - and a swap file.
Perhaps you could have shared the source of the info that made you doubt it would work or be somehow dodgy.

I thought I had made it clear (apologies if anything I said was unclear): I was asking because I cannot find the article in question. Therefore, I asked for advice if anyone knew of any reason why this would not work or was inadvisable to attempt, BEFORE possibly borking my system (again).

Short answer: No, there are no known issues.

Thanks @bogdancovaciu for the pointer to the wiki article. If not for that I probably would never have known about the systemd-swap method.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.