xref: /netbsd-src/sbin/resize_ffs/resize_ffs.8 (revision 7ebfc10b9ad9ce9b74646c3e651b392e5f0bbe27)
1*7ebfc10bSchristos.\"     $NetBSD: resize_ffs.8,v 1.18 2017/10/01 22:59:19 christos Exp $
282aaf000Slukem.\"
3ec57cc7eSjtk.\" As its sole author, I explicitly place this man page in the public
4ec57cc7eSjtk.\" domain.  Anyone may use it in any way for any purpose (though I would
5ec57cc7eSjtk.\" appreciate credit where it is due).
6ec57cc7eSjtk.\"
7ec57cc7eSjtk.\" /~\ The ASCII                           der Mouse
8ec57cc7eSjtk.\" \ / Ribbon Campaign
9ec57cc7eSjtk.\"  X  Against HTML               mouse@rodents.montreal.qc.ca
10ec57cc7eSjtk.\" / \ Email!           7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B
1182aaf000Slukem.\"
12*7ebfc10bSchristos.Dd October 1, 2017
13ec57cc7eSjtk.Dt RESIZE_FFS 8
14e7c4f98bSnjoly.Os
15ec57cc7eSjtk.Sh NAME
16ec57cc7eSjtk.Nm resize_ffs
17d765f2d2Sriz.Nd resize a file system on disk or in a file
18ec57cc7eSjtk.Sh SYNOPSIS
19ec57cc7eSjtk.Nm
20d0b93bc8Sjmcneill.Op Fl cpvy
211e891081Shaad.Op Fl s Ar size
22d765f2d2Sriz.Ar special
23ec57cc7eSjtk.Sh DESCRIPTION
24ec57cc7eSjtk.Nm
25d765f2d2Srizresizes a file system.
26d765f2d2Sriz.Ar special
2717187885Schristosis the name of the raw disk device or file where the file system resides.
28ec57cc7eSjtk.Nm
29d686d862Swizcan both grow and shrink file systems.
30d686d862SwizWhen growing, the disk device
31ec57cc7eSjtkmust of course be large enough to contain the new file system;
32ec57cc7eSjtk.Nm
33d686d862Swizsimply extends the file system data structures into the new space.
34d686d862SwizWhen shrinking,
35ec57cc7eSjtk.Nm
36d686d862Swizassumes this.
37ec57cc7eSjtk.Nm
38ec57cc7eSjtkhas to copy anything that currently resides in the space being shrunk
39ec57cc7eSjtkaway; there must be enough space free on the file system for this to
40d686d862Swizsucceed.
4108e27e97SsevanIf there is not,
42ec57cc7eSjtk.Nm
43ec57cc7eSjtkwill complain and exit; when this happens, it attempts to always leave
44ec57cc7eSjtkthe file system in a consistent state, but it is probably a good idea to
45ec57cc7eSjtkcheck the file system with
46ec57cc7eSjtk.Xr fsck 8 .
471e891081Shaad.Pp
484958aa2cSwizIf no
491e891081Shaad.Fl s
504958aa2cSwizoption is provided,
514958aa2cSwiz.Nm
524958aa2cSwizwill grow the file system to the underlying device size which is
534958aa2cSwizdetermined from
54d765f2d2Sriz.Ar special .
551e891081Shaad.Pp
564958aa2cSwizThe options are as follows:
571e891081Shaad.Bl -tag -width indent
58ae3fcf09Schopps.It Fl c
595a1645e4SwizCheck to see if the new size would change the file system.
605a1645e4SwizNo changes will be made to the file system.
61d0b93bc8Sjmcneill.It Fl p
62d0b93bc8SjmcneillDisplay a progress meter during the resize process.
631e891081Shaad.It Fl s
644958aa2cSwizSpecify the file system size to which the file system should be
654958aa2cSwizresized.
666964284fSwizThe size is given as the count of disk sectors, usually 512 bytes.
67f91d202fSwizIt will not work correctly for file systems with other sector sizes.
686964284fSwizTo see the
6917187885Schristosexact value, have a look at the disk specification or the disklabel.
704958aa2cSwizMostly used to shrink file systems.
715a1645e4Swiz.It Fl v
725a1645e4SwizBe more verbose.
734958aa2cSwiz.It Fl y
744958aa2cSwizDisable sanity questions made by
754958aa2cSwiz.Nm .
761e891081Shaad.El
77ec57cc7eSjtk.Sh WARNING
78ec57cc7eSjtk.Em Interrupting
79ec57cc7eSjtk.Nm
80ec57cc7eSjtk.Em "may leave your file system in an inconsistent state and require a"
81ec57cc7eSjtk.Em "restore from backup."
82ec57cc7eSjtkIt attempts to write in the proper order to avoid problems, but as it is
83ec57cc7eSjtkstill considered experimental, you should take great care when using it.
84ec57cc7eSjtk.Pp
85ec57cc7eSjtkWhen
86ec57cc7eSjtk.Nm
87ec57cc7eSjtkis applied to a consistent file system, it should always produce a
88ec57cc7eSjtkconsistent file system; if the file system is not consistent to start
89ec57cc7eSjtkwith,
90ec57cc7eSjtk.Nm
91ec57cc7eSjtkmay misbehave, anything from dumping core to completely curdling the
92d686d862Swizdata.
9308e27e97SsevanIt is probably wise to
94ec57cc7eSjtk.Xr fsck 8
95ec57cc7eSjtkthe file system before and after, just to be safe.
96d765f2d2SrizYou should be aware that just because
974958aa2cSwiz.Xr fsck 8
984958aa2cSwizis happy with the file system does not mean it is intact.
991e891081Shaad.Sh EXIT STATUS
1001e891081Shaad.Nm
1014958aa2cSwizexits with 0 on success.
1021e891081ShaadAny major problems will cause
1031e891081Shaad.Nm
1041e891081Shaadto exit with the non-zero
1051e891081Shaad.Xr exit 3
1061e891081Shaadcodes, so as to alert any invoking program or script that human
1071e891081Shaadintervention is required.
108ec57cc7eSjtk.Sh EXAMPLES
1091e891081Shaad.Dl resize_ffs Cm /dev/vg00/rlv1
1101e891081Shaad.Pp
1114958aa2cSwizwill enlarge the file system on the Logical Volume
1121e891081Shaad.Pa /dev/vg00/lv1
1134958aa2cSwizfrom Volume Group vg00 to the current device size.
114ec57cc7eSjtk.Sh SEE ALSO
115ec57cc7eSjtk.Xr fs 5 ,
116d686d862Swiz.Xr fsck 8 ,
117d686d862Swiz.Xr newfs 8
118d686d862Swiz.Sh HISTORY
119d686d862SwizThe
120d686d862Swiz.Nm
121d686d862Swizcommand first appeared in
122d686d862Swiz.Nx 2.0 .
123d686d862Swiz.Sh AUTHORS
124d686d862Swiz.An der Mouse
125d686d862Swiz.Aq mouse@rodents.montreal.qc.ca
126d765f2d2Sriz(primary author)
127d765f2d2Sriz.An Jeff Rizzo
128d765f2d2Sriz.Aq riz@NetBSD.org
129d765f2d2Sriz(Byteswapped file system and UFS2 support)
130ec57cc7eSjtk.Pp
131*7ebfc10bSchristosA big bug-finding kudos goes to John Kohl for finding a significant
132*7ebfc10bSchristosrotational layout bug.
133ec57cc7eSjtk.Sh BUGS
134ec57cc7eSjtkCan fail to shrink a file system when there actually is enough space,
135ec57cc7eSjtkbecause it does not distinguish between a block allocated as a block
136d686d862Swizand a block fully occupied by two or more frags.
137d686d862SwizThis is unlikely to
138ec57cc7eSjtkoccur in practice; except for pathological cases, it can happen only
139ec57cc7eSjtkwhen the new size is extremely close to the minimum possible.
140ec57cc7eSjtk.Pp
141ec57cc7eSjtkHas no intelligence whatever when it comes to allocating blocks to copy
142ec57cc7eSjtkdata into when shrinking.
1431e891081Shaad.Pp
14408e27e97SsevanDoes not currently support shrinking FFSv2 file systems.
145