aboutsummaryrefslogtreecommitdiff
path: root/sbin/fsirand/fsirand.c
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/fsirand/fsirand.c')
-rw-r--r--sbin/fsirand/fsirand.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sbin/fsirand/fsirand.c b/sbin/fsirand/fsirand.c
index 48ffcbaf0665..c4db8848f18b 100644
--- a/sbin/fsirand/fsirand.c
+++ b/sbin/fsirand/fsirand.c
@@ -134,6 +134,12 @@ fsirand(char *device)
return (1);
}
}
+ /*
+ * Check for unclean filesystem.
+ */
+ if (sblock->fs_clean == 0 ||
+ (sblock->fs_flags & (FS_UNCLEAN | FS_NEEDSFSCK)) != 0)
+ errx(1, "%s is not clean - run fsck.\n", device);
if (sblock->fs_magic == FS_UFS1_MAGIC &&
sblock->fs_old_inodefmt < FS_44INODEFMT) {