private ValidationResult validateVolumePath(final FsVolume volume) {
        final Path absPath = getAbsVolumePath(volume);
        LOGGER.debug("path: {}", absPath);

        if (!Files.exists(absPath)) {
            try {
                Files.createDirectories(absPath);
            } catch (IOException e) {
                final String msg;
                if (absPath.toString().equals(e.getMessage())) {
                    // Some java IO exceptions just have the path as the message, helpful.
                    msg = e.getClass().getSimpleName();
                } else {
                    msg = e.getMessage();
                }
                return ValidationResult.error(LogUtil.message(
                        "Error creating index volume path '{}': {}",
                        absPath,
                        msg));
            }
        } else if (!Files.isDirectory(absPath)) {
            return ValidationResult.error(LogUtil.message(
                    "Error creating index volume path '{}': The path exists but is not a directory.",
                    absPath));
        }

        // Can't seem to find a good way of checking if we have write perms on the dir so create a file
        // then delete it, after a small delay
        Path tempFile = null;
        try {
            tempFile = Files.createTempFile(absPath, TEMP_FILE_PREFIX, null);


        } catch (IOException e) {
            return ValidationResult.error(LogUtil.message(
                    "Error creating test file in directory {}. " +
                    "Does Stroom have the right permissions on this directory? " +
                    "Error message: {} {}",
                    absPath,
                    e.getClass().getSimpleName(),
                    e.getMessage()));
        } finally {
            // Wait a few secs before we delete the file in case some file systems prevent deletion
            // immediately after creation
            if (tempFile != null) {
                final ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
                final Path finalTempFile = tempFile;
                executorService.schedule(() -> {
                    LOGGER.debug("About to delete file {}", finalTempFile);
                    try {
                        Files.deleteIfExists(finalTempFile);
                    } catch (IOException e) {
                        LOGGER.error("Unable to delete temporary file {}", finalTempFile, e);
                    }
                }, 5, TimeUnit.SECONDS);
            }
        }

        return ValidationResult.ok();
    }
Public for use in tests that tear down volumes
stroom-data/stroom-data-store-impl-fs/src/main/java/stroom/data/store/impl/fs/FsVolumeService.java