Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Installing root as bcache.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
holdengreen
n00b
n00b


Joined: 21 Sep 2021
Posts: 8

PostPosted: Tue Sep 21, 2021 6:59 am    Post subject: Installing root as bcache. Reply with quote

I'm going through the install guide but I'd like to install the / (root) partition as a bcache drive.

I can't figure out how to do this and everything online is non-gentoo.

I really just want to make this work and not go through more trouble.
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3872

PostPosted: Tue Sep 21, 2021 11:09 am    Post subject: Reply with quote

Hi
If you know how to create this bcache partition then you treat the bcache partition as a normal partition.
You make an fs on top of it, mount it and install Gentoo normally.
Try it with an arch VM and if it boots apply it to Gentoo.
Only caveat you need to have your kernel properly configured.
Also just an idea maybe a "rootwait" kernel parameter via grub would be helpful.
Welcome to Gentoo Forums!
_________________
:)
Back to top
View user's profile Send private message
holdengreen
n00b
n00b


Joined: 21 Sep 2021
Posts: 8

PostPosted: Tue Sep 21, 2021 6:56 pm    Post subject: Reply with quote

My PC:
- AMD Ryzen 1200
- 16GB 3200 RAM
- 256GB ADATA SSD
- 2TB Seagate HDD
- NVIDIA GTX 1060

I may spin up a QEMU VM and get testing.

Usually you need to install the root partition and chroot before using a package manager (I think). Otherwise it's a pain to scp binaries from my laptop.

I'm confused on the boot configuration. I think I need to patch the kernel in some way and change initramfs. Possibly create a new boot partition. I haven't needed to do this before.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21431

PostPosted: Tue Sep 21, 2021 7:56 pm    Post subject: Reply with quote

You need a working Linux environment from which to create the root partition. If that working environment can also create a bcache container into which the filesystem is placed, then you can use it to create the bcache wrapper first. If you don't have bcache tools in the live environment, you will need to find one that has them, or find a way to build them in the live environment.
Back to top
View user's profile Send private message
holdengreen
n00b
n00b


Joined: 21 Sep 2021
Posts: 8

PostPosted: Wed Sep 22, 2021 6:26 am    Post subject: Reply with quote

I've created a workable system by chroot'ing into a 16G partition on my SSD.

I'm at the kernel compilation stage and wondering how/if I compile bcache with the kernel.

I presume the kernel will need to have the capacity to run bcache if it wants to recognize and ultimately mount the root file system.

Also do I explicitly need to enable btrfs with compression support? Because I want to compress the root partition but I don't see any options to enable compression for btrfs in 'make menuconfig'.

thx
Back to top
View user's profile Send private message
holdengreen
n00b
n00b


Joined: 21 Sep 2021
Posts: 8

PostPosted: Thu Sep 23, 2021 4:20 am    Post subject: Reply with quote

So I've enabled bcache in menuconfig
Quote:

Device Drivers --->
Multiple devices driver support (RAID and LVM) --->
<*> Block device as cache


Trying to figure out how I can patch the kernel because I want to format using bcachefs.
Back to top
View user's profile Send private message
Etal
Veteran
Veteran


Joined: 15 Jul 2005
Posts: 1931

PostPosted: Thu Sep 23, 2021 2:38 pm    Post subject: Reply with quote

holdengreen wrote:
So I've enabled bcache in menuconfig
Quote:

Device Drivers --->
Multiple devices driver support (RAID and LVM) --->
<*> Block device as cache


Trying to figure out how I can patch the kernel because I want to format using bcachefs.


bcache and bcachefs are two different things.

bcache allows you to use a small fast disk as a cache for a large slow one, creating a /dev/bcache0 device, which you would then format with your favorite file system. It's part of the kernel, no patching required.

bcachefs is an experimental filesystem by the same author which uses some of the concepts as bcache. It hasn't been merged into the kernel.

If you want to use bcache as root, it's a bit tricky since you need to set it up first before you can boot from it. This will require an initramfs. You can find a very simplified init script to set up bcache here here. The only binary you'll need in it is busybox to execute the /init script.

If you're new to Gentoo, I suggest you don't try to to bite off more than you can chew. Try installing to a regular partition first - for example, create a smaller partition on you hard drive. When you have it running, you can then create a bcache from your SSD and the rest of the HDD and copy your install there. Then, create an initfamfs and try to boot it.

For setting up bcache, I suggest going through the official doc. The Arch Wiki is good too.
Back to top
View user's profile Send private message
holdengreen
n00b
n00b


Joined: 21 Sep 2021
Posts: 8

PostPosted: Sat Sep 25, 2021 8:59 pm    Post subject: Reply with quote

Quote:
bcache and bcachefs are two different things.

Yes I'm aware. I'd like the root filesystem to be compressed. (This is a pain to try and do later)

Installed a version of zen-sources (=sys-kernel-zen-sources-5.13.13) which is compatible with bcachefs.

For downloading a bcachefs patch to apply to that kernel I used: https://github.com/YellowOnion/bcachefs-patches

and patched 'patch -p1 (from kernel src dir) < fileigotfromabovegithub.patch'

bcachefs shows up in menuconfig but I'm not seeing any option to compress to filesystem for BtrFS or bcachefs. Only for F2FS.

I'll put ~96G of the SSD towards cache and I'll have a bunch left over to do something with :?:

Now I'm going to figure out the initramfs. thx.
Back to top
View user's profile Send private message
holdengreen
n00b
n00b


Joined: 21 Sep 2021
Posts: 8

PostPosted: Sat Sep 25, 2021 10:26 pm    Post subject: Reply with quote

I wonder is there any reasonable way for me to install my root filesystem on the bulk of the SSD minus 96GB cache then format the bulk partition using compressed F2FS (which is supported natively by the kernel) as my root partition. And necessarily symlink/virtual partition the heafty directories (/usr /home /var /opt ...) to be stored on the bcache drive?

My collaborator said this may not be reasonable as /usr for example may have contents that do not allow this.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum