btrfs compression!

This commit is contained in:
xfnw 2022-01-04 18:33:11 -05:00
parent 1aea862534
commit fed2cb9ebc
3 changed files with 22 additions and 2 deletions

View file

@ -271,6 +271,10 @@ setup_extlinux() {
-e "s|^[# ]*(serial_port)=.*|\1=$serial_port|" \
"$mnt"/etc/update-extlinux.conf
sed -Ei \
-e "s|remount,rw|&,noatime$COMPRESSFLAGS|" \
"$mnt"/etc/init.d/root
chroot "$mnt" extlinux --install /boot
chroot "$mnt" update-extlinux --warn-only # 2>&1 \
# | grep -Fv 'extlinux: cannot open device /dev' >&2
@ -351,10 +355,12 @@ done
: ${KEYS_DIR:="/etc/apk/keys"}
: ${PACKAGES:=}
: ${REPOS_FILE:="/etc/apk/repositories"}
: ${ROOTFS:="ext4"}
: ${ROOTFS:="btrfs"}
: ${SCRIPT_CHROOT:="no"}
: ${SERIAL_CONSOLE:="no"}
export ROOTFS
case "$ALPINE_BRANCH" in
[0-9]*) ALPINE_BRANCH="v$ALPINE_BRANCH";;
esac
@ -475,12 +481,18 @@ fi
#-----------------------------------------------------------------------
einfo 'Setting up extlinux bootloader'
COMPRESSFLAGS=
if [ "$ROOTFS" = 'btrfs' ]; then
COMPRESSFLAGS=',compress=zstd'
fi
export COMPRESSFLAGS
_apk add --root . --no-scripts syslinux
setup_extlinux . "UUID=$root_uuid" "$ROOTFS" "$KERNEL_FLAVOR" "$SERIAL_PORT"
cat > etc/fstab <<-EOF
# <fs> <mountpoint> <type> <opts> <dump/pass>
UUID=$root_uuid / $ROOTFS noatime 0 1
UUID=$root_uuid / $ROOTFS noatime$COMPRESSFLAGS 0 1
EOF
#-----------------------------------------------------------------------

View file

@ -45,3 +45,10 @@ rc-update add sshd default
step 'Creating authorized_keys for root'
mkdir -p /root/.ssh/
echo "$SSHPUBKEY" >> /root/.ssh/authorized_keys
if [ "$ROOTFS" = 'btrfs' ]; then
step 'Compressing btrfs'
btrfs filesystem defragment -r -czstd /
fi

View file

@ -1,6 +1,7 @@
alpine-base
busybox
btrfs-progs
btrfs-compsize
chrony
network-extras
openssl