1.\" $NetBSD: resize_ffs.8,v 1.13 2011/08/28 21:25:11 wiz 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.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 isn't, 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 s 59Specify the file system size to which the file system should be 60resized. 61The size is given as the count of disk sectors, usually 512 bytes. 62It will not work correctly for file systems with other sector sizes. 63To see the 64exact value, have a look at the disk specification or the disklabel. 65Mostly used to shrink file systems. 66.It Fl y 67Disable sanity questions made by 68.Nm . 69.El 70.Sh WARNING 71.Em Interrupting 72.Nm 73.Em "may leave your file system in an inconsistent state and require a" 74.Em "restore from backup." 75It attempts to write in the proper order to avoid problems, but as it is 76still considered experimental, you should take great care when using it. 77.Pp 78When 79.Nm 80is applied to a consistent file system, it should always produce a 81consistent file system; if the file system is not consistent to start 82with, 83.Nm 84may misbehave, anything from dumping core to completely curdling the 85data. 86It's probably wise to 87.Xr fsck 8 88the file system before and after, just to be safe. 89You should be aware that just because 90.Xr fsck 8 91is happy with the file system does not mean it is intact. 92.Sh EXIT STATUS 93.Nm 94exits with 0 on success. 95Any major problems will cause 96.Nm 97to exit with the non-zero 98.Xr exit 3 99codes, so as to alert any invoking program or script that human 100intervention is required. 101.Sh EXAMPLES 102.Dl resize_ffs Cm /dev/vg00/rlv1 103.Pp 104will enlarge the file system on the Logical Volume 105.Pa /dev/vg00/lv1 106from Volume Group vg00 to the current device size. 107.Sh SEE ALSO 108.Xr fs 5 , 109.Xr fsck 8 , 110.Xr newfs 8 111.Sh HISTORY 112The 113.Nm 114command first appeared in 115.Nx 2.0 . 116.Sh AUTHORS 117.An der Mouse 118.Aq mouse@rodents.montreal.qc.ca 119(primary author) 120.An Jeff Rizzo 121.Aq riz@NetBSD.org 122(Byteswapped file system and UFS2 support) 123.Pp 124A big bug-finding kudos goes to John Kohl for finding the rotational 125layout bug referred to in the 126.Sx WARNING 127section above. 128.Sh BUGS 129Can fail to shrink a file system when there actually is enough space, 130because it does not distinguish between a block allocated as a block 131and a block fully occupied by two or more frags. 132This is unlikely to 133occur in practice; except for pathological cases, it can happen only 134when the new size is extremely close to the minimum possible. 135.Pp 136Has no intelligence whatever when it comes to allocating blocks to copy 137data into when shrinking. 138.Pp 139Doesn't currently support shrinking FFSv2 file systems. 140