asb / raspi-config

Configuration tool for the Raspberry Pi. Now maintained at https://github.com/RPi-Distro/raspi-config
Other
263 stars 328 forks source link

Expand filesystem programmatically #40

Closed felixfischer closed 9 years ago

felixfischer commented 9 years ago

I want to automatize the bootstrapping of a fresh Raspbian installation using an Ansible playbook. Is it possible to expand the filesystem with a one-off command, instead of having to start this manually from the menu?

Stonie commented 9 years ago

It's not quite "one-off" with parted, but the code that does the work might be useful to you.

See the code here: https://github.com/asb/raspi-config/blob/master/raspi-config#L34 and the docs here http://www.gnu.org/software/parted/manual/html_node/parted_31.html

Note that resize2fs is used to finish the job before the partition is mounted during the next boot. https://github.com/asb/raspi-config/blob/master/raspi-config#L98

Good luck. ;)

felixfischer commented 9 years ago

Thanks for the hints in the right direction. I'll see what I can accomplish.

asb commented 9 years ago

This actually should already be implemented with the --expand-rootfs command line flag. https://github.com/asb/raspi-config/blob/master/raspi-config#L759

felixfischer commented 9 years ago

Oh, thank you very much @asb! That's exactly what I was looking for.