Raspi-image-spec/rootfs/usr/sbin/rpi-resizerootfs

23 lines
277 B
Plaintext
Raw Normal View History

#!/bin/sh
2017-10-08 21:18:48 +01:00
rootpart="$(findmnt -n -o SOURCE /)"
rootdev="/dev/$(lsblk -no pkname "$rootpart")"
2017-10-08 21:18:48 +01:00
2018-07-14 23:03:02 +01:00
flock $rootdev sfdisk -f $rootdev -N 2 <<EOF
2018-07-14 20:57:03 +01:00
,+
EOF
2018-07-14 23:03:02 +01:00
sleep 5
udevadm settle
sleep 5
flock $rootdev partprobe $rootdev
mount -o remount,rw $rootpart
2017-10-08 21:18:48 +01:00
resize2fs $rootpart
2018-07-14 23:03:02 +01:00
exit 0