Some time ago I
described a method to format the /data partition on the HTC One (M7) - How to: Fix a corrupted DATA partition
on the HTC One. This method is suitable for more HTC devices (all
with EXT4 support) and with the mkfs.ext4 tool you can format
system and cache partitions as well. All you need to know is the proper /dev/block/mmcblk0pXY number of
the partition you want to format.