This would balloon out your snapshots with garbage. (Unless you left out that you made a @swap volume (or similar), and had it mounted in /swap.
You can put on the no-CoW attribute per file/directory which would have similar effect, but having it on another volume is cleaner.
Edit: I just noticed I got the directory name backwards. I really think the Arch wiki is weird calling the directory swapfile, and the file just swap. Either way, either name…
Thanks! I didn’t make a subvolume and have done auto snapshot because of installations. so before touch I make a btrfs subvolume and mount it in fstab with subvol?
Using a swap file in BTRFS is not optimal. Don’t be stingy and buy a swap-partition if you’re already partitioning.
Yes, btrfs supports swap files. In other file systems this may also be a valid option. The developers have added this out of necessity . But a swap file has to be handled differently in many respects than all other files. This limits btrfs’ freedom to clean up data (because the swap file always has to stay in the same place for reasons). I would never do that. (Even if it’s possible)
If you have enough ram, say above 16G, and do not want to make an extra partition, a valid option would be swap in ram, so that programs requiring it would be happy.