I realize this pattern is copied from below, but this feels a little fragile. At least we should 

* add a comment here as to why there's two
* give them more similar names (find_free_dm_device_name)
* add a comment about what the dir[5, dir.length] magic does (or make it less magic).
* maybe not duplicate this? find_free_device_name?