install with BTRFS: subvolume/partition scheme?

aloha.debian's picture

Forums: 

Hi all,
I'm a newbie and I'd like to install Debian GNU/Linux on a single drive (SSD) desktop computer.
The filesystem of choice is BTRFS and a couple of thing are not really clear to me:
- is a swap partition still necessary and what's the best fs for it?
- what partition scheme would you suggest?

I thought about 2 different btrfs partitions, one for /home and one for / (root) but from what I read if I'm giving the raw drive to BTRFS that would be more beneficial performance-wise, is that correct? (actually I don't even know if 2 btrfs partitions on the same drive is even possible).

If should I got for "donating" the raw/whole drive to btrfs which subvolumes scheme would you suggest for an easy management of the snapshots and backups? should /home be a subvolume or that's not really necessary...

I'm probably giving for granted that Jessie/unstable would be able to manage a root btrfs install, and I really hope so Smile

Many thanks and sorry if some questions may sound silly!

Answers

Yaro's picture

"- is a swap partition still necessary and what's the best fs for it?"

Swap is only really necessary if you have 2 GiB of RAM or lower or plan to use hibernation. Otherwise it just won't see much, if any, use. Linux software just generally doesn't use a lot of memory. If you plan to hibernate or have 2 GiB or less RAM, then the best rule of thumb is 1.5x the size of system memory. 2 GiB RAM would mean a 3 GiB allocation for swap on the hard disk. Swap is itself the "file system" used. It's not usually a file like it is on Windows. Debian's installer makes it easy to set one up. The "best" filesystem is the only filesystem there is for swap: swap.

"- what partition scheme would you suggest?"

As for partition scheme, if you're planning to use btrfs and don't have UEFI, just make one big btrfs partition (plus your swap partition if needed.) and create subvolumes for /boot and /home. With stuff like LVM or btrfs, partitioning is just not something you should have to hassle with in Linux anymore when you can set up logical volumes or subvolumes and let your filesystem or the logical volume manager handle where your stuff goes. LVM's a little more advanced, though, and if you plan to use btrfs, it's not needed at all since btrfs already has built in support for a lot of features LVM has, with some caveats you probably need not worry about on a single disk system.

"I thought about 2 different btrfs partitions, one for /home and one for / (root) but from what I read if I'm giving the raw drive to BTRFS that would be more beneficial performance-wise, is that correct? (actually I don't even know if 2 btrfs partitions on the same drive is even possible)."

Sure, it's possible. But btrfs does subvolumes, which makes it unnecessary. Just make one big btrfs partition and create /home to be a subvolume. Don't know if the Debian installer offers support for that. I could do it in Arch. Failing that, it's still just better to do something like LVM which offers more flexibility than just raw partitions. With LVM you can more readily grow or shrink filesystems and NOT have to worry at all about moving them around on the disk like you would partitions. Bottom line, straight up to-the-metal partitions are not something you should have to do in Linux these days, just make a swap partition and either a btrfs filesystem or an LVM volume group and forget about it. Smile

"If should I got for "donating" the raw/whole drive to btrfs which subvolumes scheme would you suggest for an easy management of the snapshots and backups? should /home be a subvolume or that's not really necessary..."

As I said a couple times already, except for the swap space, yeah, just give it all to btrfs. And if you plan to do snapshots I'd definitely recommend putting /home on a subvolume. You don't necessarily need to snapshot / when you change /home and vice versa.

"I'm probably giving for granted that Jessie/unstable would be able to manage a root btrfs install, and I really hope so."

btrfs is pretty stable by the time Jessie came out last month. But if you're iffy about btrfs, drop it in favor of LVM logical volumes containing ext4. LVM itself does snapshots as well, though I've never used snapshots in btrfs or LVM. You'll pretty much only be giving up transparent compression, but you CAN do encryption, which is a better tradeoff (btrfs has no built in encryption, so you can't encrypt a /home subvolume unless you plan to encrypt the entire btrfs block.