Swap partition or a swap file?

Swap partition or a swap file?

What is your opinion?

Other urls found in this thread:

btrfs.wiki.kernel.org/index.php/Main_Page
pointclouds.org/
twitter.com/SFWRedditGifs

Partition. Not sure what the advantage is of a swap file. Redpill me.

Easy as hell to use. Need some extra space? Swap off, delete the swapfile, and you're done. Need more swap? Make a bigger swapfile, delete the old one, swap on. No rebooting required or partition tinkering or anything of the sort.

I think Btrfs is the only thing that doesn't play nice with swap files, but it should seriously be the default for ext4 filesystems.

I personally like using a swapfile inside a ramdisk.

Why doesn't btrfs work with swapfiles? I was going to try installing linux on a USB with btrfs and the limited space makes me question if I really need a swap partition.

Interesting. Is there any case in which a swap partition would be better (outside of that btrfs thing)?

If not, then I'll be sure to use swap files on my next GNU/Linux install

Doesn't matter, use whatever you want, if you need flexibility use swap files, if you use your computer to compile use swap partition.

a swap file has to go through the file system which hosts it, so it has a bigger overhead

Ah, so partitions are better for if you're doing a lot of compiling?

Heads or Tails.

Swapfile, definitely. More convenient than a partition. You can easily disable it at will, and the extra overhead is negligible.

Doesn't really matter.

I'll go with "enough RAM that you don't need swap", it works in many -though not all- use cases.

The COW design will lead to fs corruption.
Workaround: Swapfile -> Loop Device -> Swap

Sorry for the annoying question, but allow me to ask what Btrfs is for and when would you want to use that?

Btrfs is a filesystem still in development. It's got a lot of features that some people like. I personally don't understand a lot of this, but this is the official page.
btrfs.wiki.kernel.org/index.php/Main_Page

Do I need a swap file/partition at all though?

Better safe than sorry. That is why I'll only use a swap file on my next install.

avoid it, it's trying to be a feature rich equivalent of ZFS, but it isn't finished

If I ever meet the 1990s version of myself I'll go ahead and ask him.

On a serious note, it's 2017. RAM costs nothing. Swapping ruins your SSD and is useless on your HDD. Why are you using swaps? Just buy more RAM.

BTRFS is another filesystem with lots of features & it's quite broadly applicable.

> when would you want to use that?
Broad range of uses, but in a way the usual practice is "when you need more features than ext4". You could also go with XFS (which is great if you want features to disable features or great performance metrics at scale), ZFS (more features but weird performance flaws and higher hardware requirements in many cases) or such, but BTRFS is probably for many the most obvious step up from ext4.

What is this ZFS meme? I know about XFS, which is the current default on Redhat/CentOS and is apparently good for storing and handling huge amounts of data, but what is ZFS about?

> Swapping ruins your SSD
This meem needs to die.

It's just not true that you're likely at all to swap enough to ruin your SSD any time soon, unless you set it up in a positively retarded way.

ZFS is a filesystem that has essentially integrated mdadm and LVM apart from the btrfs features, all in one.

You can do filesystem-specific RAID (unfortunately without mdadm's ability to grow and shrink most), snapshots, error correction coding, deduplication and more with that.

Has a lot of features. The reason why relatively few use it for big data and such is that its performance is rather shit particularly at scale, and hardware requirements are high - but it's very popular with home NAS builders and such who get a lot of pretty nice features pretty easily with it.

16GiB of ram, you're ramlet

I see. It looks like Btrfs is trying to do a lot of that stuff, but it's way too early in development (Redhat is getting rid of it now). For now, I think Ext4, and XFS are fine.

> It looks like Btrfs is trying to do a lot of that stuff, but it's way too early in development
It's perfectly viable for many use cases. I've been pretty happy with it for my "/" and more.

> Redhat is getting rid of it now
RedHat is also expecting its customers to use Ceph (this thing is pretty damn great! but complex) or GlusterFS (same performance nightmare as ZFS, avoid IMO) to get analogies of most of the features they'd get from BTRFS.

They maybe don't want to push BTRFS since it in many ways is performance-wise in the way of running Ceph or GlusterFS.

> For now, I think Ext4, and XFS are fine.
Sure, if you find no need to use btrfs features, stick with ext4.

they have better performance, so it is a bit more noticeable if you're swapping in and out constantly (as compiling does).

however, if you're using a lot of swap, it might be better to use another compiler (clang uses considerably less memory than gcc, and has faster compile times) or to lower the number of make jobs.

only retards uses swap having >= 8Gb ram.

I had to do some mental processing on that one.

Ah I see. So:
Swapfiles
>Easily created if you need more swap
>Easily deleted if you don't need them and wanna save space
>Easily Resized
>A bit less performance
>Worse for compiling

Swap partitions
>Faster/better compiling
>More Performance
>Not as flexible as files.

I think I'll probably stick with files. I'm not a C/C++ programmer and I don't currently use Gentoo or BSD, so I don't really compile that much. I also currently have MacOS as a host (with GNU/Linux VMs), and even though MacOS is a bloated pile of fuckshit, It still never uses more RAM than I have when under load, so if I switched to GNU/Linux host, I basically wouldn't even need swap to begin with, so I could just make them as needed if I find that I want them.

btrfs needs a couple more years for big companies to start using it, but it will take over, especially because its libre and ZFS is not.
One feature I love is that nearly all operations you can do live. I converted my setup from 1HDD to a 3 drive RAID1 (yes RAID1, btrfs is very versatile) setup without any downtime. It's really easy to add, remove, grow, shrink the array as well.

I'm waiting for it to be considered stable in RAID 5, and then I'll do a live convert.

I'm new here, what the hack do you compile that does require swapping? Do you have some singleprocess running supercomputer?

actually if somebody needs to swap to compile a big proyect he is running a potato, I tried to compile this some years ago pointclouds.org/ having 2gb of ram and had to kill all I could because started swaping but today has no sense to have swap.

Compiling C++ with max of optimizations uses a few GBs of RAM. I only have 2GB at the moment so it grinds my computer to a halt.

some c++ template monsters can take around 400-700 mb per process (if you use -pipe). if you use all your threads to compile it can easily chew through 4 and even 8 gb of ram.

try compiling chromium or webkit-gtk, just for fun.