I’m planning to switch over to NixOS after setting things up and using NixOS on a VM for a couple of months. The one thing I haven’t really been able to find information about is setting up NixOS in a way where there is a boot drive and a “main drive” and the best way to tackle that.
My current set up is windows but I have a 250gb NVME drive for boot and a 2tb drive for basically everything else; storage, games, documents, photos, etc. I was hoping to replicate this on NixOS. I know the nix store can grow fast if you don’t garbage collect every so often so I was hoping to move that over to the second drive as well.
What’s the best way to achieve this and is there a filesysyem that might work better? I’ve only ever used ext4 when using linux before but I’ve heard of btrfs and zfs so I’m willing to learn more in that department as well if anything is reconmmended
Personally I’d keep the nix store on the 250GB drive and maybe setup automatic garbage collection (nix.gc.automatic = true;) but that’s personal choice in how you want to partition things.
EDIT: fixed the permissions I had in fileSystems."/boot".options
I recommend making both drives btrfs, albeit seperate, then having / being on the 250GB drive and making bind mounts or some subvolume things for /home and /nix on the 2TB one.
With only 1 NVME and 1 HDD I would recommend keeping almost everything on the NVME drive. I would then mount the HDD to something like /mnt/HDD and create folders that I would link to elsewhere, such as creating /mnt/HDD/Library and linking to that at ~/Library. The logic for this is that the NVME will be significantly faster for random reads, so you want the OS files (/nix/store) on there for quick loading as well as your users home directory as keeping dotfiles on the HDD can slightly slow loading compared to the NVME. I don’t recommend keeping /nix/store on the HDD but instead configuring automatic garbage collection as you want the quick access of the NVME disk.
You could combine the 2 drives into one “virtual drive” with LVM ( so no space gets unused due to the fragmentation ), and then inside, use either normal ext4 or better yet, BTRFS for easy snapshots and its good sub-volume features. Make sure to allow LVM to passthru trim/discard ops so your sdd gets more lifetime.
Respectfully, RAID0 is insane - one drive failure/corruption = data loss.
If you want a solid basis, use ext4. Or use XFS (it’s slightly faster and often more reliable) but it does have the limitation of not being able to shrink the FS once it’s created (you can only grow it).
Ehhh. This is largely outdated caution. btrfs is even the default on various distros, including Fedora, now.
Rebalancing isn’t essential anymore (at least metadata balancing actually causes more harm than good). It used to be required to prevent disks becoming unwriteable over time, but that has been solved.
Setting up a periodic scrub is just as required and as much work as it is for zfs, and arguably pretty pointless if you’re not using RAID since you can’t do anything about corrupt data anyway.
Just avoid RAID5/6, but if you’re going to be using it on two disks with disparate size and performance, you probably shouldn’t use RAID at all, so there’s really no risk here. RAID setups are super uncommon on desktop use cases anyway, especially in this modern age of expensive flash storage.
All that said, average desktop users probably don’t make much use of btrfs’ (or zfs’) features. COW is neat, but hardly matters in day-to-day use. Compression will largely not work for desktop user’s files, anything large will already be in a compressed file format. Block-level duplication isn’t fast enough for general-purpose use.
Snapshots can be handy, but they’re not replacements for backups, and desktop users will not put the effort in to ensure backup integrity, let alone care about the downtime snapshots can help reduce - if they back up data at all. Plus, we lack the UI needed to make them ergonomic for people who don’t think too hard about their file systems.
Overall I think I agree that just ext4/xfs are fine if you don’t know why you’d choose something else.
Sure, the same way as using lvm or even single disk I just said about possibilities. Using anything but raid0 in a set up where one drive is 8 times larger is quite wastefull.
raid0 stripes the data, so if either disk fails then you are hosed, so you sum the probabilities rather than multiple them. That’s a bad outcome. Given most people are rocking nvme or at least ssd these days raid0 as a performance thing is basically dead at this point.