User:Zulu Foxtrott/Parts/Blocks/LayoutBtrfsSubvolumes

== Default: Using Btrfs subvolumes ==

How many subvolumes and what for?
The layout of the Btrfs filesystem structure is highly dependent on the demands of the system. It is advised to have at least separate subvolumes for (the primary hierarchy root),  and the  which will increase security and make backups and other types of maintenance easier. If Gentoo is being installed to perform as a mail server, then should be backed by a subvolume of its own as all mails are stored inside the  directory. Game servers may have a separate subvolume to mount at since most gaming server software is installed therein. The reasoning for these is similar to the directory: security, backups, and maintenance.

What about swap space?
The copy-on-write nature of Btrfs is not suitable for swapping. That's why on Btrfs swap space is realized with swapfiles. Thus it's possible to set special file attributes to selectively disable copy-on-write. With set it becomes necessary to pre-allocate space to the swapfile.

There is no perfect value for the size of the swapfile. The purpose of swap space is to provide disk storage to the kernel when internal memory (RAM) is under pressure. A swap space allows for the kernel to move memory pages that are not likely to be accessed soon to disk (swap or page-out), freeing memory. Of course, if that memory is suddenly needed, these pages need to be put back in memory (page-in) which will take a while (as disks are very slow compared to internal memory).

When the system is not going to run memory intensive applications or the system has lots of memory available, then it probably does not need much swap space. However, swap space is also used to store the entire memory in case of hibernation. If the system is going to need hibernation, then a bigger swap space is necessary, often at least the amount of memory installed in the system.

From here, it's probably feasible to continue directly with Using parted to partition the disk.