For anyone else getting the error along these lines:
Invalid erase-block-size 512: must be a power of 2 and at least 4096. Invalid logical-block-size 512: must be a power of 2 and at least 4096. /usr/lib/android-sdk/platform-tools/mke2fs failed with status 1 mke2fs failed: 1 error: Cannot generate image for userdata
I found that this was not a problem with the phone but with the fastboot program - I switched from Ubuntu (18.04) to Windows 10 and I found I could run
fastboot -w with no problem. The problem seems to have been that I installed the Android SDK platform tools through
apt-get rather than downloading them from developer.android.com. Hope that helps someone.