Making a swap file

My system formatted ext4 and i have also a swap partition 5GB.
I think to erase swap partition and install a swap file instead and i think if ext4 support swap file or must change partitions to btrfs format.
Thanks in advance!

It’s your system and you’re in control. But why would you want to do that? A swap partition is more efficient than a swap file, because the kernel needs access to the raw drive blocks, and with a swap file, it must first pass through the filesystem layer, whereas with a swap partition, it doesn’t have to worry about that.

Both ext4 and btrfs support swap files, but in the case of btrfs you need to take extra precautions, because the swap file must not make use of copy-on-write or compression, given that both of these things prevent the kernel from accessing the drive blocks directly.

Thank you for info!
I thought swap file is better than swap partition!
in that case i go on with my swap partition!

2 Likes

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