User:Eigrad/Sandbox

From ArchWiki
Jump to: navigation, search

Installing on Btrfs root

This article provides a tutorial how to install ArchLinux on a single Btrfs partition without separate boot using syslinux bootloader.

Warning: Btrfs is still experimental, this article provided only for academic use.

Preparation

System to use while installation

I recommend you to boot using Live ArchLinux image, or other ArchLinux system.

Btrfs-progs

To create Btrfs filesystem you will need a btrfs-progs package. There is the btrfs-progs-unstable in [extra], but I recommend you to install btrfs-progs-git from AUR.

Preparing hard drive

Make a partition for the installation.

Creating Btrfs filesystem

mkfs.btrfs /dev/sda1
mkdir /mnt/target
mount /dev/sda1 /mnt/target
btrfs subvolume create /mnt/target/archlinux
umount /mnt/target
mount -o subvol=archlinux /dev/sda1 /mnt/target
mkdir /mnt/target/boot
mount /dev/sda1 /mnt/target/boot

You now have a Btrfs formatted partition with subvolume named archlinux mounted on /mnt/target, and top-level volume mounted on /mnt/target/boot.

Note: /boot mount point is required to point to top-level Btrfs volume, because there is no subvolumes support in syslinux bootloader for now.

Installing the system

My favorite way of installing ArchLinux, the manual installation :-).

Base

cd /mnt/target/
mkdir -p dev proc sys var/lib/pacman
mount -o bind /dev dev
mount -t proc none proc
mount -t sysfs none sys
pacman -r . -Sy base syslinux

AUR Packages

You will need some additional packages - btrfs-progs-git and mkinitcpio-btrfs. Build them and install with:

pacman -r /mnt/target -U <pkg>

After installing the second, add "btrfs" hook in /etc/mkinitcpio.conf HOOKS and rebuild initrd:

mkinitcpio -p kernel26

/etc/fstab

Don't forget to add this into /etc/fstab:

/dev/sda1	       /             btrfs     subvol=archlinux    0      0
/dev/sda1	       /boot         btrfs     default             0      0
Note: Fully functional fsck.btrfs is not released yet, and ArchLinux works with its limited version in wrong way.

Installing the bootloader

chroot /mnt/target
mkdir /boot/syslinux
extlinux --install /boot/syslinux
cat /usr/lib/syslinux/mbr.bin >/dev/sda
vi /boot/syslinux/syslinux.cfg
exit

Some sample syslinux.cfg:

PROMPT 0
TIMEOUT 0
DEFAULT arch

LABEL arch
	LINUX /vmlinuz26
	APPEND root=/dev/sda1 rootflags=subvol=archlinux ro
	INITRD /kernel26.img

Final

We have almost done, don't forget to edit /etc/rc.conf, set root password, and other. Good luck with reboot!