public void diskHealthTest() {
      //ensures disk healthchecks are enabled
      if (!enabled) {
        return;
      }

      logger.trace("Performing the disk healthcheck test");

      //Creates the directory and opens the file
      AsynchronousFileChannel fileChannel = createFileChannel();
      if (fileChannel == null) {
        return;
      }

      //Finds today's date and stores it
      String todayDate = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss").format(Calendar.getInstance().getTime());
      ByteBuffer buffer = ByteBuffer.allocate(todayDate.getBytes().length);
      buffer.put(todayDate.getBytes());
      buffer.flip();

      boolean successful = false; //success indicator for write and read operation

      //Write to file in operationTimeoutSeconds seconds
      successful =
          performOperation(fileChannel, buffer, DiskHealthStatus.WRITE_TIMEOUT, DiskHealthStatus.WRITE_EXCEPTION, true);

      //Reads from the file in operationTimeoutSeconds seconds
      if (successful) {
        buffer.clear();
        successful =
            performOperation(fileChannel, buffer, DiskHealthStatus.READ_TIMEOUT, DiskHealthStatus.READ_EXCEPTION,
                false);
      }

      //Checks if the content matches what was written
      if (successful) {
        String fileContent = new String(buffer.array()).trim();
        successful = fileContent.equals(todayDate);
        if (!successful) {
          diskHealthStatus = DiskHealthStatus.READ_DIFFERENT;
        }
      }

      //Deletes this test file and only specifies healthy if everything successful
      if (deleteFile(fileChannel, successful) && successful) {
        diskHealthStatus = DiskHealthStatus.HEALTHY;
      }
    }
Performing Disk HealthCheck Test in 5 steps
1. Checks if there is sufficient space on disk
2. Creates the file on the filepath
3. Writes today's date to disk
4. Read and compares what was written to disk
5. Deletes the file
ambry-store/src/main/java/com/github/ambry/store/DiskManager.java