Guide Manjaro-ARM on BTRFS root

Post Reply
exceeder
Posts: 6
Joined: Fri Oct 14, 2022 6:29 am
languages_spoken: english
ODROIDs: C1, M1
Has thanked: 1 time
Been thanked: 6 times
Contact:

Guide Manjaro-ARM on BTRFS root

Post by exceeder »

Draft is for new installation on Odroid-M1 with petitboot enabled, but also possible to adapt or migrate current os.
Pros: snapshots, testing, rollbacks, docker btrfs storage engine, possibility to have more roots with different distributions...
Using sata ssd (/dev/sda) as final drive in this guide.
Thanks pillow for building 6.2 kernel with sata support https://archlinuxarm.org/forum/viewtopi ... 7&start=10
The main idea is write full image to drive, convert ext4 to btrfs and add root subvolume to bootargs.
There is a lot of options how to do that, I do not have experiences with btrfs-convert, using cp for migration.
It can be slow, but if u familiar with fdisk and loop devices, write only boot part with dd and mount root from img as loop, than copy files directly to btrfs.



Boot temporary arch / manjaro-arm, btrfs-progs installed

Get manjaro image (personally tested minimal and sway 23.02)

Code: Select all

wget https://github.com/manjaro-arm/om1-images/releases/download/23.02/Manjaro-ARM-sway-om1-23.02.img.xz
Write image to drive

Code: Select all

xz -dc Manjaro-ARM-sway-om1-23.02.img.xz | dd of=/dev/sda status=progress bs=32M
Mount drive

Code: Select all

mkdir sda2 root_ext4
mount /dev/sda2 sda2
Export ext4 root fs to temporary location (also possible with tar).

Code: Select all

cp -rp sda2/* root_ext4/
Expand ext4 root disk (sda2)

Code: Select all

umount /dev/sda2
fdisk /dev/sda
d
2
n
2
1000001
default
y
w


Format root as btrfs

Code: Select all

mkfs.btrfs /dev/sda2 -f
Create some subvolumes (@root others up to you, someone prefers to create symlink @ -> @root for os switching)

Code: Select all

mount /dev/sda2 sda2
btrfs sub create sda2/@root
btrfs sub create sda2/@snapshots
btrfs sub create sda2/@docker
btrfs sub create sda2/@download
btrfs sub create sda2/@zigbee
umount /dev/sda2
Mount btrfs root with compression, if u like lzo will be fastest

Code: Select all

mount -o noatime,compress=zstd,ssd,subvol=@root /dev/sda2 sda2
Move root filesystem back to the drive

Code: Select all

cp -rp root_ext4/* sda2/
Chroot (optionally just extract files from zst, kernel and headers)

Code: Select all

pacman -Sy arch-install-scripts
arch-chroot sda2
Update kernel, headers

Code: Select all

mount /dev/sda1 /boot
wget https://overviewer.org/~pillow/up/217071e4c7/linux-aarch64-pillow-6.2.0-1-aarch64.pkg.tar.zst
wget https://overviewer.org/~pillow/up/5131df7401/linux-aarch64-pillow-headers-6.2.0-1-aarch64.pkg.tar.zst
pacman -U linux-aarch64-pillow-headers-6.2.0-1-aarch64.pkg.tar.zst
tar --use-compress-program=unzstd -xvf linux-aarch64-pillow-6.2.0-1-aarch64.pkg.tar.zst
Obtain PARTUUID of new root, add subvolumes

Code: Select all

ls -la /dev/disk/by-partuuid | grep sda2
nano /boot/boot.cmd
Modifi the line with bootargs, add PARTUUID and your root subvolume

Code: Select all

setenv bootargs root=PARTUUID=8a881f56-bac7-224a-9e0e-fb5278f02397 rw rootwait rootflags=subvol=@root
Make new boot, compatible with pet

Code: Select all

mkimage -T script -A arm64 -C none -d /boot/boot.cmd /boot/boot.scr
Add subvolumes to fstab

Code: Select all

nano /etc/fstab

Code: Select all

PARTUUID=88314e46-676b-416b-ac60-3e812b6853b8  /boot            vfat   defaults,noexec,nodev,showexec              0   0
PARTUUID=8a881f56-bac7-224a-9e0e-fb5278f02397  /                btrfs  noatime,compress=zstd,ssd,subvol=@root      0   0
PARTUUID=8a881f56-bac7-224a-9e0e-fb5278f02397  /var/lib/docker  btrfs  noatime,compress=zstd,ssd,subvol=@docker    0   0
PARTUUID=8a881f56-bac7-224a-9e0e-fb5278f02397  /mnt/zigbee      btrfs  noatime,compress=zstd,ssd,subvol=@zigbee    0   0
PARTUUID=8a881f56-bac7-224a-9e0e-fb5278f02397  /mnt/download    btrfs  noatime,ssd,subvol=@download                0   0
Detach from chroot

Code: Select all

exit
reboot
Done :geek:
These users thanked the author exceeder for the post (total 2):
tobetter (Thu Mar 16, 2023 10:33 pm) • odroid (Fri Mar 17, 2023 9:42 am)

Post Reply

Return to “Other OS”

Who is online

Users browsing this forum: No registered users and 1 guest