Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
installing on btrfs
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
aloha.gentoo
n00b
n00b


Joined: 06 Jan 2015
Posts: 2

PostPosted: Tue Jan 06, 2015 3:22 am    Post subject: installing on btrfs Reply with quote

Hi all,
I'd love to install Gentoo but I'd like to install on a btrfs fs (raw drive).
Is that possible?
The installation hand book doesn't cover that, and I'm not sure if it's easy to configure grub2 to boot it without a /boot partition (I'd like to "donate" the entire disk to btrfs).

Many thanks!
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Tue Jan 06, 2015 3:45 am    Post subject: Reply with quote

The /boot partition is not required. However, you cannot boot a raw drive without having a bootloader on an external device. In other words, you can have Gentoo on a raw device, but you need to boot it from USB or whatnot. There were times when Linux kernel was able to boot by itself but these times are long over ... wait a minute, it is possible again with UEFI (kind of) ...
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
aloha.gentoo
n00b
n00b


Joined: 06 Jan 2015
Posts: 2

PostPosted: Tue Jan 06, 2015 3:57 am    Post subject: Reply with quote

Jaglover wrote:
... wait a minute, it is possible again with UEFI (kind of) ...


Do they say that UEFI need a small part of the drive for the bootloader files?
Just saying... otherwise what about storing the loader on a SD/USB?

Probably for a newbie like me that sounds a bit too difficult to set up :)
Back to top
View user's profile Send private message
ct85711
Veteran
Veteran


Joined: 27 Sep 2005
Posts: 1791

PostPosted: Tue Jan 06, 2015 4:48 am    Post subject: Reply with quote

From what I've heard and read some, there's an option for a EFI stub in the kernel to load the kernel directly without a boot loader/manager. Sadly I can't say how to set it up or how well it works. Personally, I'm old fashion and stuck with just using grub2 to boot in EFI mode.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Tue Jan 06, 2015 4:58 am    Post subject: Reply with quote

aloha.gentoo wrote:
Jaglover wrote:
... wait a minute, it is possible again with UEFI (kind of) ...


Do they say that UEFI need a small part of the drive for the bootloader files?
Just saying... otherwise what about storing the loader on a SD/USB?

Probably for a newbie like me that sounds a bit too difficult to set up :)


With UEFI you still need to partition your drive.

Booting from SD or USB or whatnot is OK if your hardware supports it. No difficulties to set it up, just modify your bootloader settings to fit your setup.
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
davidm
Guru
Guru


Joined: 26 Apr 2009
Posts: 557
Location: US

PostPosted: Wed Jan 07, 2015 1:58 am    Post subject: Reply with quote

Hi, I transitioned from another distro on a multi-device btrfs on root system all on one subvolume (no separate /boot or /home). It worked for me. Here's the thread: https://forums.gentoo.org/viewtopic-t-1006790.html

Basically I manually compiled the kernel (didn't use genkernel) and made sure to compile in btrfs support as suggested in the wiki. I emerged 'genkernel-next' (it's wasn't in the normal genkernel package) so that I could use the --btrfs option available to generate an initrd image (see 'man genkernel' for the btrfs option and the handbook for general help). Also I made use of 'device=' in my /etc/fstab to specify all devices used by the btrfs volume. It worked for me but I noted that I seem to have to make sure my /etc/fstab is correct prior to generating the initrd image or it hung on reboot for some reason.

Also grub2 just worked for me. There really wasn't much to it at all. It knows to search for /boot. Basically just follow the handbook for that portion. Note that I installed on a bios system though.
Back to top
View user's profile Send private message
davidm
Guru
Guru


Joined: 26 Apr 2009
Posts: 557
Location: US

PostPosted: Wed Jan 07, 2015 2:35 am    Post subject: Reply with quote

Here are some better instructions since I see that thread is probably hard to follow. This should work when combined with the handbook in the appropriate section.

1. Setup your btrfs volume by creating the volume. [see http://wiki.gentoo.org/wiki/Btrfs ]
2. Create the appropriate /etc/fstab. For example here is what I am using with my gentoo install on a separate 'gentoo' subvolume and a four disk raid1 btrfs volume all in one on root:

Code:

/dev/cdrom      /mnt/cdrom      auto            noauto,ro       0 0
/dev/sda        /       btrfs   device=/dev/sda,device=/dev/sdb,device=/dev/sdc,device=/dev/sdd,rw,autodefrag,compress=lzo,noatime,thread_pool=16,subvol=gentoo       0       0
/dev/sde2       /mnt/backupdisk         ext4    defaults,noatime,auto   0 2
/dev/sde1       none    swap    defaults        0       0


Note that the line with all the devices might get wrapped by the forum software but it is all really one line. Also I have another backup disk which houses a swap partition as well as an ext4 fs for backup. I left those there in case they help you.

It seems the "device=/dev/sda,device=/dev/sdb,device=/dev/sdc,device=/dev/sdd" is necessary for things to go well by the method I used.

Then make sure to compile in support for btrfs into the kernel (as well as your disks, etc). See http://wiki.gentoo.org/wiki/Btrfs

emerge 'genkernel-next' as I don't think the regular 'genkernel' provides the '--btrfs' option at this time.

When you generate the initramfs image you can then do something like this to generate the image:

Code:

genkernel --lvm --mdadm --btrfs --install initramfs


(see http://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Kernel#Optional:_Building_an_initramfs and/or 'man genkernel')

Run grub2 basically as in the handbook ( http://wiki.gentoo.org/wiki/GRUB2_Quick_Start ) . For example in a nutshell:

Code:

1. 'grub2-install /dev/sda' (this is where my BIOS looks to boot the first disk)
2. 'grub2-mkconfig -o /boot/grub/grub.cfg'


Believe it or not but it should work and is that simple. :) There may be other ways to do it which are better but this worked for me.
Back to top
View user's profile Send private message
BlueFusion
Guru
Guru


Joined: 08 Mar 2006
Posts: 371

PostPosted: Wed Jan 07, 2015 4:49 am    Post subject: Reply with quote

davidm,

Based on no science at all, I recommend multiple subvolumes instead of a single one. Reason being, you can then create a snapshot of just rootfs and not of /home so you can roll back after a package upgrade. That way you don't snap shot "everything" when you really only wanted a chunk. I.e. I have /music, /home, /videos, / (rootfs), and /usr/portage.

Quote:
It seems the "device=/dev/sda,device=/dev/sdb,device=/dev/sdc,device=/dev/sdd" is necessary for things to go well by the method I used.

I found that I need this in my Grub kernel command line but not in /etc/fstab. IIRC, it should no longer be required even in the kernel command line (but I have not tested this yet).
_________________
i7-940 2.93Ghz | ASUS P6T Deluxe (v.1) | 24GB Triple Channel RAM | nVidia GTX660
4x 4TB Seagate NAS HDD (Btrfs raid5) | 2x 120GB Samsung 850 EVO SSD (Btrfs raid1)
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Wed Jan 07, 2015 5:31 am    Post subject: Reply with quote

I tried raw btrfs and grub2 on a server, but it felt fragile to me. In the end I went back to my usual "MBR + LILO + small /boot + everything else" setup (where everything else, here, is a single btrfs). It's not "pure" but I won't miss 100MB.
Back to top
View user's profile Send private message
davidm
Guru
Guru


Joined: 26 Apr 2009
Posts: 557
Location: US

PostPosted: Wed Jan 07, 2015 3:18 pm    Post subject: Reply with quote

BlueFusion wrote:
davidm,

Based on no science at all, I recommend multiple subvolumes instead of a single one. Reason being, you can then create a snapshot of just rootfs and not of /home so you can roll back after a package upgrade. That way you don't snap shot "everything" when you really only wanted a chunk. I.e. I have /music, /home, /videos, / (rootfs), and /usr/portage.

Quote:
It seems the "device=/dev/sda,device=/dev/sdb,device=/dev/sdc,device=/dev/sdd" is necessary for things to go well by the method I used.

I found that I need this in my Grub kernel command line but not in /etc/fstab. IIRC, it should no longer be required even in the kernel command line (but I have not tested this yet).


Hi BlueFusion,

Right now I'm not using the snapshots at all. I'm considering it but the problems with the early 3.17.x kernel versions which sometimes resulted in data loss kind of scared me as that only hit systems with snapshots. Had I used them at the time I probably would have been hit too. So I'll probably wait a little bit longer until things mature more before I start using snapshots. I'd also like to replace some disks in the array to get more free capacity first before I start utilizing it.

Would you mind sharing your grub kernel line? I'm curious to know exactly what you are using because it doesn't seem very well documented with examples elsewhere. Initially I was going to try to use the grub kernel line and do things without an initramfs but I gave up on that and had to use the initramfs plus having devices specified in /etc/fstab. I'd love to know exactly how to do it another way (maybe I could even do it without an initramfs after all?) and experiment with that but I'm not so fond of having to chroot when I mess it up so I prefer to get it right the first time.. :) The information might help the OP and others too by showing other ways which work.
Back to top
View user's profile Send private message
BlueFusion
Guru
Guru


Joined: 08 Mar 2006
Posts: 371

PostPosted: Wed Jan 07, 2015 3:40 pm    Post subject: Reply with quote

davidm wrote:
Would you mind sharing your grub kernel line? I'm curious to know exactly what you are using because it doesn't seem very well documented with examples elsewhere. Initially I was going to try to use the grub kernel line and do things without an initramfs but I gave up on that and had to use the initramfs plus having devices specified in /etc/fstab. I'd love to know exactly how to do it another way (maybe I could even do it without an initramfs after all?) and experiment with that but I'm not so fond of having to chroot when I mess it up so I prefer to get it right the first time.. :) The information might help the OP and others too by showing other ways which work.


Sure thing:
Code:
kernel /kernel-genkernel-x86_64-3.18.1-gentoo root=/dev/ram0 init=/linuxrc crypt_root=/dev/sdb2 real_rootflags=nodiscard,compress,noatime,device=/dev/mapper/root2,device=/dev/mapper/root3,device=/dev/mapper/root4,subvol=@rootfs vga=775 scandelay=0


This is what I used prior to using a single SSD for rootfs and /home (also using Btrfs) and the remaining disks as a seperate Btrfs pool. But this worked for me. Also, this is using dm-crypt, hence all the /dev/mapper devices. I build my kernels with genkernel with the --luks option. IIRC there is a --btrfs option which would automatically scan for Btrfs devices so the device=* stuff is not required. It would require the initramfs though.

davidm wrote:
Right now I'm not using the snapshots at all. I'm considering it but the problems with the early 3.17.x kernel versions which sometimes resulted in data loss kind of scared me as that only hit systems with snapshots.

I don't either (yet) but I like having a neat and organized system so when I do have to do snapshots, they're a little more efficient. Now that I am on my desktop, here's the full list of various subvolumes I have:

On SSD using Btrfs: (d=single m=dup)
/
/home

On 2x 4TB drives using Btrfs: (d=raid1 m=raid1)
/usr/portage
/usr/src
/usr/local/games
/var/log
/music
/videos
/vm
/torrents (only one with CoW disabled by use of chattr +C on the directory so all new files inherit this attribute)

On multiple smaller drives using Btrfs: (d=single m=raid1)
/mnt/backup

/mnt/4tb, /mnt/bpool, and /mnt/ssd are the root filesystems (subvol=0) of each of the Btrfs filesystems. They contain:
Quote:
area51 mnt # ls 4tb bpool ssd
4tb:
@games @log @music @portage @rootfs @src @tmp @torrents @videos @vm

bpool:
@backup

ssd:
@home @rootfs


aloha.gentoo wrote:
Hi all,
I'd love to install Gentoo but I'd like to install on a btrfs fs (raw drive).
Is that possible?
The installation hand book doesn't cover that, and I'm not sure if it's easy to configure grub2 to boot it without a /boot partition (I'd like to "donate" the entire disk to btrfs).

Many thanks!


To really answer the OPs question, it's no different than what the handbook says to do to install Gentoo. But instead of using ext4 or <insert-fs-here>, use Btrfs. Use subvoumes if you choose, but it's not required. I believe they should be used and the root volume (subvol=0) should ONLY contain subvolumes, but that's just me.

I have been using kernel 3.18.1 with no issues with single drive, JBOD, and RAID1 Btrfs filesystems. I have been running a sever with 3.19-rc2 for a week now with Btrfs in RAID5 (4 drive setup) and so far no issues.

I recommend using kernel 3.18 or newer and the latest btrfs-progs (3.18 is current). Both would require you to unmask them at this time.
_________________
i7-940 2.93Ghz | ASUS P6T Deluxe (v.1) | 24GB Triple Channel RAM | nVidia GTX660
4x 4TB Seagate NAS HDD (Btrfs raid5) | 2x 120GB Samsung 850 EVO SSD (Btrfs raid1)
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