path: root/sbin/fsck_ffs/fsck_ffs.8
diff options
authorDag-Erling Smørgrav <des@FreeBSD.org>2011-04-29 23:00:23 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2011-04-29 23:00:23 +0000
commit8d3dfc2691ee934dfd7c17235c0f10a395525eed (patch)
treee58bb5eb7293c08ac870dd7b462cbf76cdde8ec2 /sbin/fsck_ffs/fsck_ffs.8
parent6c49c6cff2f51045e7c3878f6a88a1c8ce50db17 (diff)
Add an -E option to mirror newfs's. The idea is that if you have a system
that was built before ffs grew support for TRIM, your filesystem will have plenty of free blocks that the flash chip doesn't know are free, so it can't take advantage of them for wear leveling. Once you've upgraded your kernel, you enable TRIM on the filesystem (tunefs -t enable), then run fsck_ffs -E on it before mounting it. I tested this patch by half-filling an mdconfig'ed filesystem image, running fsck_ffs -E on it, then verifying that the contents were not damaged by comparing them to a pristine copy using rsync's checksum functionality. There is no reliable way to test it on real hardware. Many thanks to mckusick@, who provided the tricky parts of this patch and reviewed the final version. Reviewed by: mckusick@ MFC after: 3 weeks
Notes: svn path=/head/; revision=221233
Diffstat (limited to 'sbin/fsck_ffs/fsck_ffs.8')
1 files changed, 20 insertions, 2 deletions
diff --git a/sbin/fsck_ffs/fsck_ffs.8 b/sbin/fsck_ffs/fsck_ffs.8
index 2834149f97c8..523cb6543ed8 100644
--- a/sbin/fsck_ffs/fsck_ffs.8
+++ b/sbin/fsck_ffs/fsck_ffs.8
@@ -29,7 +29,7 @@
.\" @(#)fsck.8 8.4 (Berkeley) 5/9/95
.\" $FreeBSD$
-.Dd January 25, 2009
+.Dd April 27, 2011
@@ -38,7 +38,7 @@
.Nd file system consistency check and interactive repair
-.Op Fl BFfnpry
+.Op Fl BEFfnpry
.Op Fl b Ar block
.Op Fl c Ar level
.Op Fl m Ar mode
@@ -149,6 +149,24 @@ If unexpected errors are found,
the file system is marked as needing a foreground check and
exits without attempting any further cleaning.
+.It Fl E
+Clear unallocated blocks, notifying the underlying device that they
+are not used and that their contents may be discarded.
+This is useful for filesystems which have been mounted on systems
+without TRIM support, or with TRIM support disabled, as well as
+filesystems which have been copied from one device to another.
+See the
+.Fl E
+.Fl t
+flags of
+.Xr newfs 8 ,
+.Fl t
+flag of
+.Xr tunefs 8 .
.It Fl F
Determine whether the file system needs to be cleaned immediately
in foreground, or if its cleaning can be deferred to background.