Start Salix from Btrfs root
To start Salix from a Btrfs root partition you have to use Grub.
- Use the huge kernel
- Don’t create an initrd.gz and remove an existing /boot/initrd.gz
- Run
grub-mkconfig -o /boot/grub/grub.cfg
- Check the /boot/grub/grub.cfg file. The linux line should look like this:
linux /@/boot/vmlinuz-huge-4.4.13 root=/dev/sda1 ro rootflags=subvol=@ vt.default_utf8=1 quiet
- Run
grub-install /dev/sda
Install from scratch
Some useful informations beforehand:
- BTRFS actually does not need any partitions. You can create a filesystem and just use subvolumes for different mount points. But if you want to boot from the drive you have to create partitions!
- You can chose between MSDOS or GPT partition tables. GPT is the future save choice because AFAIK computers with UEFI firmware won’t boot from MSDOS partitions. Furthermore a GPT partition has a PARTUUID, which may be helpful.
- Both, Lilo and Grub, can boot from MSDOS and GPT partitions, but only Grub can load the kernel from a BTRFS formatted partition. If you want to use Lilo you have to create a /boot partition with a Lilo supported file system, e.g. ext4. Therefore I recommend to use Grub, even if I like the simple design of Lilo much more.
- For Grub you need some “empty” space at the beginning of the disk. 1 MiB should be enough, but something between 2 and 16 MiB is a save choice. With MSDOS partition table just leave the space unused, with GPT you have to create a small “BIOS boot” (EF02) partition.
Partitions
- Create a GPT partition table with
cgdisk
- Create a small partition (2 MiB) and set partition type to “BIOS boot” (EF02).
- Create the btrfs root partition
- Create other partitions (optional)
Installation
- Chose your packages and install as usual.
- On Minimal and Basic installation set up your network connection and access to the internet (this is important). On Full installation you bring up your network by hand after the installation.
Bootloader
- Skip LILO installation (LILO cannot boot from btrfs)
- Do not reboot, leave setup instead
Run the following commands:
chroot /mnt
/etc/rc.d/rc.inet1 start
slapt-get -u
slapt-get -i grub
grub-mkconfig -o /boot/grub/grub.cfg
grub-install /dev/sda
exit
reboot
Install on existing partition
If you are using subvolumes you even can install more distributions on a single btrfs filesystem. Your btrfs subvolumes could look like this:
- @14.1 (root fs of Salix 14.1)
- @14.2 (root fs of Salix 14.2)
- @opensuse (root fs of Opensuse)
- @home (home directory)
Installation
To install in an existing filesystem you have to do:
Boot the Salix install CD and leave the setup
Mount the top level of your btrfs filesystem, e.g. mount /dev/sda1 /mnt
Create a subvolume for your root file system, e.g.:
cd /mnt btrfs subvol create @14.2 cd umount /mnt
Mount the new subvolume, e.g.
mount -o subvol=@14.1 /dev/sda1 /mnt
Run setup again:
setup
Don’t touch partitions and don’t format anything. Just went straight to package installation.
Bootloader
- Skip LILO installation (LILO cannot boot from btrfs)
- Do not reboot, leave setup instead
Run the following commands
chroot /mnt
/etc/rc.d/rc.inet1 start
slapt-get -u
slapt-get -i grub
grub-mkconfig -o /boot/grub/grub.cfg
grub-install /dev/sda
exit
reboot
fstab
Edit your /etc/fstab and add the subvol=@14.1
mount option to the rootfs.