Check only namenode dir before namenode formatting.
Create tmp and staging dirs on hdfs.
Make "start hdfs <node>" idempotent.
Use jps to make "start hdfs <node>" idempotent.

Output of jps looks something like this:
#vagrant@precise64:~$ sudo jps
#9022 NameNode
#9436 Jps
#9121 SecondaryNameNode
#8935 DataNode