You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to automate installations of raspberry pis I'm writing an ansible playbook, which should also expand the rootfs if possible.
My idea was to use raspi-config nonint get_can_expand to check if the rootfs can be expanded (as the name indicates), but looking at the code it just checks if the rootfs partition is the second on drive and it is the last one. This would trigger the playbook to call raspi-config nonint do_expand_rootfs every time.
Actually it should also check if there is space left on the drive, e.g.
UNUSED_SECTORS=$(parted "$ROOT_DEV" -ms unit s p | awk -F: 'NR==2{ print $2, "-" } NR==4 { print $3 }' | tr -d 's' | xargs expr)
if [ $UNUSED_SECTORS -le 1 ]; then
echo 2
exit
fi
The text was updated successfully, but these errors were encountered:
For the sake of completeness - this is the output from parted on my DUT:
$ sudo parted /dev/mmcblk0 -ms unit s p
BYT;
/dev/mmcblk0:61046784s:sd/mmc:512:512:msdos:SD SD32G:;
1:8192s:532479s:524288s:fat32::lba;
2:532480s:61046783s:60514304s:ext4::;
In order to automate installations of raspberry pis I'm writing an ansible playbook, which should also expand the rootfs if possible.
My idea was to use
raspi-config nonint get_can_expand
to check if the rootfs can be expanded (as the name indicates), but looking at the code it just checks if the rootfs partition is the second on drive and it is the last one. This would trigger the playbook to callraspi-config nonint do_expand_rootfs
every time.Actually it should also check if there is space left on the drive, e.g.
The text was updated successfully, but these errors were encountered: