Okay, I love Linux. But I always surprised that I can love Linux ever more everyday. The possibility is basically endless!
I asked about raid0 last week and got a lot of helpful answers. However, this answer from d3Xter really helped me figures how I actually want to configure my system. I decided to buy 2x500GB HDD and 120GB NVME SSD. It's cheap, very cheap. Like $15 total. If there is anything wrong with them, I lost nothing. But boy did I get surprised. I tested BG3, a game that requires SSD to perform well and I see no difference between my old SSD and my new setup. It loads as fast (well, maybe 10-15s slower, but who cares?), and I do not need to wait for the textures to load, at all. Boot time is amazing. I notice no difference at all between this HDD and my last SSD setup. Which is insane!
But the installation is confusing as hell. I write this pseudo-guide for anyone intersted.
FIRST: DO NOT STORE ANY DATA IN THIS SETUP FOR ANYTHING REMOTE TO IMPORTANT!
I favor performance for the cheapest possible above all else. Unless you want to buy 4 HDD to get raid10, do not store anything other than games and your apps on it. Do not use raid5 in this setup, it sucks.
Second: Get yourself an Arch live USB stick with at least 8GB (4 might works, but smallest one I have is 8GB). I think you can use it on other distro, but Arch is the easiest if you want to install IT on the bcache drive. And make sure you booted into UEFI by typing:
ls /sys/firmware/efi/efivars/
Third: Installing bcache.
After you have internet on your live system, remount your live iso so we can use the AUR.
mount -o remount,size=8G /run/archiso/cowspace
Then, install base-devel and git
pacman -S base-devel git --ignore linux
If you have slow internet, you can go to 2nd tty by pressing ctrl + alt + f2 and login as root there to do the next step, otherwise wait for the process to finish.
We need to setup a user since makepkg wont run on root. So, type:
useradd -m -G wheel user && passwd user and set your password
Then we need the user to able to act as superuser. So, we edit visudo and add this line at the bottom: user ALL=(ALL:ALL)ALL save it and press ctrl + alt + f3, login as user you just set. Clone the bcache-tools AUR repo:
git clone https://aur.archlinux.org/bcache-tools.git && cd bcache-tools
If you want you can inspect the PKGBUILD, but we will proceed to make it, type:
makepkg -sri
Once it is done, it will throw error about vmliuz is not found, but the package itself is installed, you just need to tell the kernel to load it. We can achieve that by executing:
sudo modprobe bcache && sudo partprobe
Fouth: Configuring the bcache, btrfs, and raid0
List your drive with lsblk identify your HDD and your SSD. Let's say in this instance, we have /dev/sda and /dev/sdb as our HDD and /dev/nvme0n1 as our SSD.
I use cfdisk to partition my drive, but you can use whatever you want. I make one partition for both HDD, sda1 and sdb1, and make 3 partitions for my SSD. DO NOT FORMATI IT YET.
/dev/sda1 : 500 GB HDD with 500GB partition
/dev/sdb1 : same as before
/dev/nvme0n1p1 : 118G SSD partition as the cache
/dev/nvme0n1p2 : 1G partition as /boot. Even if you have one kernel, do not make a /boot partition less than 1G. I knew it in hard way.
/dev/nvme0n1p3 : 200M partition as /boot/efi. Same as before, better safe than sorry.
YOU NEED TO HAVE SEPARATE BOOT AND EFI PARTITION, OTHERWISE YOU WILL HAVE AN UNBOOTABLE SYSTEM!
Okay, now we configure our raid.
make-bcache -B /dev/sda1 /dev/sdb1
This command will make a partition (?) called bcache0 and bcache1 under both /dev/sdb and /dev/sda if you use
Then go back tty1 and install it on you arch-chroot.
pacman -U bcache-tools-1.1-1-x86_64.pkg.tar.zst
Now, we configure the mkinitcpio. Edit your mkinitcpio by using you editor of choice. And add bcache in in MODULES so it looks like this:
MODULES=(bcache)
And in HOOKS, add it after block and before filesystem. Example:
HOOKS=(base udev block bcache flesystem)
Make your initcpio by executing this command:
mkinitcpio -p linux
Grub is the last. Install it as usual. Just make sure you did the partition right, as mentioned before.
That's it. You just install Arch Linux on a bcache system. It's complicated, and headache inducing for sure, but I assure you it is totally worth that pain.
Note: If you have problem after you reboot, and want to arch-chroot, you need to install bcache-tools again.
If you want to reformat anything and it shows the device as busy after you did the partprobe, you need to tell the kernel to stop any activity to the drive. In this example the sda is the one you want to edit.
echo 1 > /sys/block/sda/sda1/bcache/stop
Now, if you accidentally execute the command, you can use partprobe again to show it up.