diff --git a/src/test/unittest/ut.c b/src/test/unittest/ut.c
index 2db010e74d89ec7a6778b92a16706184ed56c6dc..6b4355c8a76121a0d94470a03b1f4bada3a15f4d 100644
--- a/src/test/unittest/ut.c
+++ b/src/test/unittest/ut.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014-2018, Intel Corporation
+ * Copyright 2014-2019, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -194,6 +194,10 @@ static FILE *Tracefp;
 static int LogLevel;		/* set by UNITTEST_LOG_LEVEL env variable */
 static int Force_quiet;		/* set by UNITTEST_FORCE_QUIET env variable */
 static char *Testname;		/* set by UNITTEST_NAME env variable */
+
+/* set by UNITTEST_CHECK_OPEN_FILES_IGNORE_BADBLOCKS env variable */
+static const char *Ignore_bb;
+
 unsigned long Ut_pagesize;
 unsigned long long Ut_mmap_align;
 os_mutex_t Sigactions_lock;
@@ -342,8 +346,11 @@ static void
 open_file_remove(struct fd_lut *root, int fdnum, const char *fdfile)
 {
 	if (root == NULL) {
-		UT_ERR("unexpected open file: fd %d => \"%s\"", fdnum, fdfile);
-		Fd_errcount++;
+		if (!Ignore_bb || strstr(fdfile, "badblocks") == NULL) {
+			UT_ERR("unexpected open file: fd %d => \"%s\"",
+				fdnum, fdfile);
+			Fd_errcount++;
+		}
 	} else if (root->fdnum == fdnum) {
 		if (root->fdfile == NULL) {
 			UT_ERR("open file dup: fd %d => \"%s\"", fdnum, fdfile);
@@ -752,6 +759,7 @@ ut_start_common(const char *file, int line, const char *func,
 	os_mutex_init(&Sigactions_lock);
 #else
 	Ut_mmap_align = Ut_pagesize;
+	Ignore_bb = os_getenv("UNITTEST_CHECK_OPEN_FILES_IGNORE_BADBLOCKS");
 #endif
 	if (os_getenv("UNITTEST_NO_SIGHANDLERS") == NULL)
 		ut_register_sighandlers();