How can I get the dev name associated to a Volume name?

Solution 1:

mount | grep /Volumes/foo | cut -d ' ' -f1

or

mount | awk '/Volumes\/foo/ { print $1 }'

Solution 2:

You can just use the volume name with diskutil though, there's no need to get the identifier:

$ diskutil unmount VolumeName
Volume VolumeName on disk1s1 unmounted