xref: /netbsd-src/sbin/resize_ffs/resize_ffs.8 (revision c2f76ff004a2cb67efe5b12d97bd3ef7fe89e18d)
1.\"     $NetBSD: resize_ffs.8,v 1.10 2011/01/05 02:18:15 riz Exp $
2.\"
3.\" As its sole author, I explicitly place this man page in the public
4.\" domain.  Anyone may use it in any way for any purpose (though I would
5.\" appreciate credit where it is due).
6.\"
7.\" /~\ The ASCII                           der Mouse
8.\" \ / Ribbon Campaign
9.\"  X  Against HTML               mouse@rodents.montreal.qc.ca
10.\" / \ Email!           7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B
11.\"
12.Dd January 4, 2011
13.Dt RESIZE_FFS 8
14.Os
15.Sh NAME
16.Nm resize_ffs
17.Nd resize a file system on disk or in a file
18.Sh SYNOPSIS
19.Nm
20.Op Fl y
21.Op Fl s Ar size
22.Ar special
23.Sh DESCRIPTION
24.Nm
25resizes a file system.
26.Ar special
27is the name of the raw disk device or file where the file system resides;
28(Sectors are almost always 512 bytes, and
29.Nm
30can both grow and shrink file systems.
31When growing, the disk device
32must of course be large enough to contain the new file system;
33.Nm
34simply extends the file system data structures into the new space.
35When shrinking,
36.Nm
37assumes this.
38It will not work correctly for file systems with other sector sizes.)
39.Nm
40has to copy anything that currently resides in the space being shrunk
41away; there must be enough space free on the file system for this to
42succeed.
43If there isn't,
44.Nm
45will complain and exit; when this happens, it attempts to always leave
46the file system in a consistent state, but it is probably a good idea to
47check the file system with
48.Xr fsck 8 .
49.Pp
50If no
51.Fl s
52option is provided,
53.Nm
54will grow the file system to the underlying device size which is
55determined from
56.Ar special .
57.Pp
58The options are as follows:
59.Bl -tag -width indent
60.It Fl s
61Specify the file system size to which the file system should be
62resized.
63Mostly used to shrink file systems.
64.It Fl y
65Disable sanity questions made by
66.Nm .
67.El
68.Sh WARNING
69.Em Interrupting
70.Nm
71.Em "may leave your file system in an inconsistent state and require a"
72.Em "restore from backup."
73It attempts to write in the proper order to avoid problems, but as it is
74still considered experimental, you should take great care when using it.
75.Pp
76When
77.Nm
78is applied to a consistent file system, it should always produce a
79consistent file system; if the file system is not consistent to start
80with,
81.Nm
82may misbehave, anything from dumping core to completely curdling the
83data.
84It's probably wise to
85.Xr fsck 8
86the file system before and after, just to be safe.
87You should be aware that just because
88.Xr fsck 8
89is happy with the file system does not mean it is intact.
90.Sh EXIT STATUS
91.Nm
92exits with 0 on success.
93Any major problems will cause
94.Nm
95to exit with the non-zero
96.Xr exit 3
97codes, so as to alert any invoking program or script that human
98intervention is required.
99.Sh EXAMPLES
100.Dl resize_ffs Cm /dev/vg00/rlv1
101.Pp
102will enlarge the file system on the Logical Volume
103.Pa /dev/vg00/lv1
104from Volume Group vg00 to the current device size.
105.Sh SEE ALSO
106.Xr fs 5 ,
107.Xr fsck 8 ,
108.Xr newfs 8
109.Sh HISTORY
110The
111.Nm
112command first appeared in
113.Nx 2.0 .
114.Sh AUTHORS
115.An der Mouse
116.Aq mouse@rodents.montreal.qc.ca
117(primary author)
118.An Jeff Rizzo
119.Aq riz@NetBSD.org
120(Byteswapped file system and UFS2 support)
121.Pp
122A big bug-finding kudos goes to John Kohl for finding the rotational
123layout bug referred to in the
124.Sx WARNING
125section above.
126.Sh BUGS
127Can fail to shrink a file system when there actually is enough space,
128because it does not distinguish between a block allocated as a block
129and a block fully occupied by two or more frags.
130This is unlikely to
131occur in practice; except for pathological cases, it can happen only
132when the new size is extremely close to the minimum possible.
133.Pp
134Has no intelligence whatever when it comes to allocating blocks to copy
135data into when shrinking.
136.Pp
137Doesn't currently support shrinking FFSv2 file systems.
138