diff --git a/config.h.cmake b/config.h.cmake
index 124694c8fc1..3511264418b 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -72,6 +72,7 @@
 #cmakedefine HAVE_SYS_IOCTL_H 1
 #cmakedefine HAVE_SYS_MALLOC_H 1
 #cmakedefine HAVE_SYS_MMAN_H 1
+#cmakedefine HAVE_SYS_MNTENT_H 1
 #cmakedefine HAVE_SYS_NDIR_H 1
 #cmakedefine HAVE_SYS_PTE_H 1
 #cmakedefine HAVE_SYS_PTEM_H 1
diff --git a/plugin/disks/CMakeLists.txt b/plugin/disks/CMakeLists.txt
index e4cf0dc1de3..408a4324d1b 100644
--- a/plugin/disks/CMakeLists.txt
+++ b/plugin/disks/CMakeLists.txt
@@ -5,6 +5,8 @@ CHECK_SYMBOL_EXISTS (getmntent "sys/mnttab.h" HAVE_GETMNTENT_IN_SYS_MNTAB)
 CHECK_SYMBOL_EXISTS (setmntent "mntent.h" HAVE_SETMNTENT)
 CHECK_SYMBOL_EXISTS (getmntinfo "sys/types.h;sys/mount.h" HAVE_GETMNTINFO)
 
+CHECK_INCLUDE_FILES (sys/mntent.h HAVE_SYS_MNTENT_H)
+
 IF (HAVE_GETMNTINFO)
 CHECK_CXX_SOURCE_COMPILES("
 #include <sys/types.h>
diff --git a/plugin/disks/information_schema_disks.cc b/plugin/disks/information_schema_disks.cc
index 18195b91044..01df32590eb 100644
--- a/plugin/disks/information_schema_disks.cc
+++ b/plugin/disks/information_schema_disks.cc
@@ -19,7 +19,7 @@
 #include <sys/types.h>
 #if defined(HAVE_GETMNTENT)
 #include <mntent.h>
-#elif !defined(HAVE_GETMNTINFO_TAKES_statvfs)
+#elif defined(HAVE_GETMNTINFO) && !defined(HAVE_GETMNTINFO_TAKES_statvfs)
 /* getmntinfo (the not NetBSD variants) */
 #include <sys/param.h>
 #include <sys/ucred.h>
@@ -28,6 +28,9 @@
 #if defined(HAVE_GETMNTENT_IN_SYS_MNTAB)
 #include <sys/mnttab.h>
 #define HAVE_GETMNTENT
+#if defined(HAVE_SYS_MNTENT_H)
+#include <sys/mntent.h>
+#endif
 #endif
 #include <sql_class.h>
 #include <sql_i_s.h>
