xref: /netbsd-src/sbin/resize_ffs/resize_ffs.8 (revision 7ebfc10b9ad9ce9b74646c3e651b392e5f0bbe27)
1.\"     $NetBSD: resize_ffs.8,v 1.18 2017/10/01 22:59:19 christos 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 October 1, 2017
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 cpvy
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.Nm
29can both grow and shrink file systems.
30When growing, the disk device
31must of course be large enough to contain the new file system;
32.Nm
33simply extends the file system data structures into the new space.
34When shrinking,
35.Nm
36assumes this.
37.Nm
38has to copy anything that currently resides in the space being shrunk
39away; there must be enough space free on the file system for this to
40succeed.
41If there is not,
42.Nm
43will complain and exit; when this happens, it attempts to always leave
44the file system in a consistent state, but it is probably a good idea to
45check the file system with
46.Xr fsck 8 .
47.Pp
48If no
49.Fl s
50option is provided,
51.Nm
52will grow the file system to the underlying device size which is
53determined from
54.Ar special .
55.Pp
56The options are as follows:
57.Bl -tag -width indent
58.It Fl c
59Check to see if the new size would change the file system.
60No changes will be made to the file system.
61.It Fl p
62Display a progress meter during the resize process.
63.It Fl s
64Specify the file system size to which the file system should be
65resized.
66The size is given as the count of disk sectors, usually 512 bytes.
67It will not work correctly for file systems with other sector sizes.
68To see the
69exact value, have a look at the disk specification or the disklabel.
70Mostly used to shrink file systems.
71.It Fl v
72Be more verbose.
73.It Fl y
74Disable sanity questions made by
75.Nm .
76.El
77.Sh WARNING
78.Em Interrupting
79.Nm
80.Em "may leave your file system in an inconsistent state and require a"
81.Em "restore from backup."
82It attempts to write in the proper order to avoid problems, but as it is
83still considered experimental, you should take great care when using it.
84.Pp
85When
86.Nm
87is applied to a consistent file system, it should always produce a
88consistent file system; if the file system is not consistent to start
89with,
90.Nm
91may misbehave, anything from dumping core to completely curdling the
92data.
93It is probably wise to
94.Xr fsck 8
95the file system before and after, just to be safe.
96You should be aware that just because
97.Xr fsck 8
98is happy with the file system does not mean it is intact.
99.Sh EXIT STATUS
100.Nm
101exits with 0 on success.
102Any major problems will cause
103.Nm
104to exit with the non-zero
105.Xr exit 3
106codes, so as to alert any invoking program or script that human
107intervention is required.
108.Sh EXAMPLES
109.Dl resize_ffs Cm /dev/vg00/rlv1
110.Pp
111will enlarge the file system on the Logical Volume
112.Pa /dev/vg00/lv1
113from Volume Group vg00 to the current device size.
114.Sh SEE ALSO
115.Xr fs 5 ,
116.Xr fsck 8 ,
117.Xr newfs 8
118.Sh HISTORY
119The
120.Nm
121command first appeared in
122.Nx 2.0 .
123.Sh AUTHORS
124.An der Mouse
125.Aq mouse@rodents.montreal.qc.ca
126(primary author)
127.An Jeff Rizzo
128.Aq riz@NetBSD.org
129(Byteswapped file system and UFS2 support)
130.Pp
131A big bug-finding kudos goes to John Kohl for finding a significant
132rotational layout bug.
133.Sh BUGS
134Can fail to shrink a file system when there actually is enough space,
135because it does not distinguish between a block allocated as a block
136and a block fully occupied by two or more frags.
137This is unlikely to
138occur in practice; except for pathological cases, it can happen only
139when the new size is extremely close to the minimum possible.
140.Pp
141Has no intelligence whatever when it comes to allocating blocks to copy
142data into when shrinking.
143.Pp
144Does not currently support shrinking FFSv2 file systems.
145