#!/bin/sh
rootfs="$$(mount |grep -w / |cut -d' ' -f1)"
+roottype="$$(mount |grep -w / |cut -d' ' -f5)"
case $$rootfs in
/dev/mmcblk?p2) rootdev="$${rootfs%p2}";;
if [ "$$before" = "$$after" ]; then
# second stage
- resize2fs "$$rootfs"
+ case $$roottype in
+ ext[234]) resize2fs "$$rootfs";;
+ btrfs) btrfs filesystem resize max /;;
+ nilfs2) nilfs-resize "$$rootfs";;
+ esac
systemctl disable autoresize
else
# finish first stage
define autoresize_unit :=
[Unit]
-Description=Resize root filesystem at boot
+Description=Resize root filesystem during first boot
[Service]
ExecStart=/opt/autoresize.sh