summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorChris Kuethe <ckuethe@cvs.openbsd.org>2008-11-28 00:15:55 +0000
committerChris Kuethe <ckuethe@cvs.openbsd.org>2008-11-28 00:15:55 +0000
commit37778efb0de37bd00e9269e32ac772f743cce430 (patch)
treebc63f5b035a1c0fb1d080def4fc4463ac1026b52 /sbin
parente7e7b361583995517a997814001f298054ce3d15 (diff)
Make growfs refuse to run on a dirty filesystem, and set the filesystem to
dirty on the way out so that users are forced to run fsck afterwards. The manpage politely suggested that the filesystem be checked after growing it; change it to say that fsck is required.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/growfs/growfs.89
-rw-r--r--sbin/growfs/growfs.c5
2 files changed, 8 insertions, 6 deletions
diff --git a/sbin/growfs/growfs.8 b/sbin/growfs/growfs.8
index 0fab66ef780..156eaf64a94 100644
--- a/sbin/growfs/growfs.8
+++ b/sbin/growfs/growfs.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: growfs.8,v 1.9 2007/07/07 08:22:55 millert Exp $
+.\" $OpenBSD: growfs.8,v 1.10 2008/11/28 00:15:54 ckuethe Exp $
.\" Copyright (c) 2000 Christoph Herrmann, Thomas-Henning von Kamptz
.\" Copyright (c) 1980, 1989, 1993 The Regents of the University of California.
.\" All rights reserved.
@@ -38,7 +38,7 @@
.\" $TSHeader: src/sbin/growfs/growfs.8,v 1.3 2000/12/12 19:31:00 tomsoft Exp $
.\" $FreeBSD: src/sbin/growfs/growfs.8,v 1.24 2005/01/18 10:09:34 ru Exp $
.\"
-.Dd $Mdocdate: July 7 2007 $
+.Dd $Mdocdate: November 28 2008 $
.Dt GROWFS 8
.Os
.Sh NAME
@@ -127,7 +127,6 @@ utility first appeared in
.An Thomas-Henning von Kamptz Aq tomsoft@FreeBSD.org
.An The GROWFS team Aq growfs@Tomsoft.COM
.Sh BUGS
-It is recommended to always use
+Filesystems must be checked with
.Xr fsck 8
-after enlarging
-.Pq just to be on the safe side .
+after enlarging.
diff --git a/sbin/growfs/growfs.c b/sbin/growfs/growfs.c
index f8db7f4c577..7c1e4d02f28 100644
--- a/sbin/growfs/growfs.c
+++ b/sbin/growfs/growfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: growfs.c,v 1.24 2008/06/24 08:33:04 sobrado Exp $ */
+/* $OpenBSD: growfs.c,v 1.25 2008/11/28 00:15:54 ckuethe Exp $ */
/*
* Copyright (c) 2000 Christoph Herrmann, Thomas-Henning von Kamptz
* Copyright (c) 1980, 1989, 1993 The Regents of the University of California.
@@ -303,6 +303,7 @@ growfs(int fsi, int fso, unsigned int Nflag)
* Now write the new superblock back to disk.
*/
sblock.fs_time = utime;
+ sblock.fs_clean = 0;
if (sblock.fs_magic == FS_UFS1_MAGIC) {
sblock.fs_ffs1_time = (int32_t)sblock.fs_time;
sblock.fs_ffs1_size = (int32_t)sblock.fs_size;
@@ -2009,6 +2010,8 @@ main(int argc, char **argv)
}
if (sblock_try[i] == -1)
errx(1, "superblock not recognized");
+ if (osblock.fs_clean == 0)
+ errx(1, "filesystem not clean - run fsck");
if (sblock.fs_magic == FS_UFS1_MAGIC &&
(sblock.fs_ffs1_flags & FS_FLAGS_UPDATED) == 0)
ffs1_sb_update(&sblock, sblock_try[i]);