Adressing individual partitions from raw device path needs to check
for:
/dev/sd* -> ${DEV}1, ${DEV}2 ...
/dev/mmcblk* -> ${DEV}p1, ${DEV}p2 ...
We can't check [ -b "${DEV}p1" ] before creating a
partition table on a completely erased SD card. So we must match
patterns.
And "unmount all" should be done as
for partition in ${DEV}*; do umount $partition; done
before running fdisk.
Reported by Nikolaus Schaller, Jun 3, 2014