Get the partition of the current directory

Based on <http://stackoverflow.com/a/2167594/96588> and <http://serverfault.com/a/110596/11292>.