Swap partition as a logical partition

My PC uses MBR and not GPT. Is it ok to have ArchLabs installed on a primary partition and Swap partition in a logical partition?


But the latest version uses the new method for creating a swap file so there is no need for a dedicated partition.

The Arch Wiki has the details about creating a swap; the new method - which works fine with legacy BIOS - and older method.

Is this more efficient then having a dedicated partition that deals with swap?

Don’t know from an actual data exchange point of view if one is faster/more efficient than the other. Having a dynamic swap file that will be as large as needed would be more efficient from a disk space point of view.

1 Like

Is the swap file enabled by default if I installed ArchLabs?

No, you have the option to add a swap partition. Have you actually installed AL before?


@Dobbie03 Yes I have, but I have uninstalled it due to other issues which I thought was only present on ArchLabs (such as screen tearing but then it turns out that other distros have the same issues as well that use XFCE). So I am going to install it again and I already have all the partitions set up and I just need to install ArchLabs on one of the partitions.

Aren’t swap partitions different from swap files? As I’m wondering if swap file (not swap partition) is enabled by default?

This doesn’t need it’s own thread. Merging.

I was told if it is going to go off topic then I should link to the current thread and continue, but ok thanks for letting me know.

Only in the way they occupy space on the hard drive; an actual physical partition as opposed to a file. As far as data exchange is concerned, no discernable difference. My ArchLabs install is also on a legacy BIOS system with a dynamic swap file.

During the install you will be asked if you want a swap file and, if yes, set the initial size.

If you already created a small partition to use as swap, you can reclaim that hard drive space. Be easiest to do that before installing.

1 Like

Thanks for informing me of this.

I though that the swap file grows and shrinks dynamically based on the amount of data it needs to store?

You need to give it an initial size so it exists. The default is minimal as I recall.

So say it is 1 GB minimal size. So if my RAM is filled up and it uses the swap file, would the swap file grow in size then? Sorry I am asking this as I want to ensure I have the best set up?

That’s the way I understand it. 1GB will be available and it will expand past that if needed.

Are you using a low end system that may actually needs a swap file? 1GB should be plenty as is, you may be able to just accept the minimal value offered.

1 Like

And this file will shrink if the data is cleared up, right?

Why would ArchLabs give users the ability to set the initial size? Wouldn’t the user want to keep the size minimal, especially if it can increase dynamically? What would be the advantage of increasing the initial size?

Well I am using a HDD with 8 GB of RAM and it is slow (well at least with Windows it is slow) so yes I do need swap.

The swapfile is not dynamic in any way, it is a static size file and will not change based on usage.

The benefit of a file vs. partition is that a swapfile can be easily resized without the need to change the partition layout. It also makes swap encryption work without the need for additional hooks or setup.

To resize the swapfile one would follow the same process to set one up and do the following as root

swapoff /swapfile   # first make sure swap is disabled

fallocate -l 8G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile

If you didn’t already have a swapfile set up you will also need to edit the fstab file at /etc/fstab

/swapfile none swap defaults 0 0

See https://wiki.archlinux.org/index.php/swap for more details.

If for whatever reason you need dynamically sized swap, I suggest checking out swapspace.

There is also a package available in the AUR.

The reason the file is set to the same size as your system RAM (unless changed) is due to sleep and hibernation, without enough swap space to fit everything from RAM sleep and hibernation will no longer be an option. Once again https://wiki.archlinux.org/index.php/swap explains all of this very concisely without the need to ask basic questions.

1 Like

I stand corrected then; I read this line from the Arch Wiki:

As an alternative to creating an entire partition, a swap file offers the ability to vary its size on-the-fly, and is more easily removed altogether.

and interpreted it to mean the file was dynamic.


That is rather vague, the way they put it. Understandable to get it mixed up.

I may be wrong above and you don’t need to do all the extra steps, perhaps just fallocate new size is enough. I just figured better safe than sorry.


@natemaia @PackRat Thanks guys for the explanation.

1 Like