2 .\" Copyright (c) 2008 Apple Inc. All rights reserved.
4 .\" @APPLE_LICENSE_HEADER_START@
6 .\" This file contains Original Code and/or Modifications of Original Code
7 .\" as defined in and that are subject to the Apple Public Source License
8 .\" Version 2.0 (the 'License'). You may not use this file except in
9 .\" compliance with the License. Please obtain a copy of the License at
10 .\" http://www.opensource.apple.com/apsl/ and read it before using this
13 .\" The Original Code and all software distributed under the License are
14 .\" distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 .\" EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 .\" INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 .\" FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 .\" Please see the License for the specific language governing rights and
19 .\" limitations under the License.
21 .\" @APPLE_LICENSE_HEADER_END@
24 .Dt libutil 3 \" Program name and manual section number
26 .Sh NAME \" Section Header - required - don't modify
27 .\" The following lines are read in generating the apropos(man -k) database. Use only key
28 .\" words here as the database is built based on the words here and in the .ND line.
30 .Nm wipefs_except_blocks ,
33 .\" Use .Nm macro to designate other names for the documented program.
34 .Nd wipes existing file systems on a volume
35 .Sh LIBRARY \" Section Header - required - don't modify
42 .Fa "size_t block_size"
43 .Fa "wipefs_ctx *handlep"
46 .Fo wipefs_except_blocks
47 .Fa "wipefs_ctx handle"
53 .Fa "wipefs_ctx handle"
57 .Fa "wipefs_ctx *handlep"
59 .Sh DESCRIPTION \" Section Header - required - don't modify
60 The wipefs family of functions wipe existing file systems on a volume. This is usually used by the newfs_* utilities before they create new file systems on the volume, so that the existing file system will not be mounted accidentally after the new file system is created.
64 function initializes a
66 object (which is an opaque data type).
68 is the file handle of the volume to be wiped, which can be a block device node, a character device node, or a file.
70 must be opened with write access. If
72 is 0, this function calls
74 to get the block size. A valid
78 is a regular file. This function does not write any data to the volume.
81 .Fn wipefs_except_blocks
82 function tells wipefs not to write anything in the block range provided. This function is used for performance
83 optimizations if the caller will write to these blocks. It is the caller's responsibility to write to these blocks.
84 Otherwise, some file systems may still be recognized on the volume. This function does not write any data to the
85 volume. If this function is called multiple times, the union of all the ranges provided will be excluded from being
91 function writes data to the volume to wipe out existing file systems on it.
93 this function destroys any file system or partition scheme on the volume represented by
97 represents the entire disk (e.g. /dev/diskX), the partition map of the disk will be destroyed. If
99 represents a partition (e.g., /dev/diskXsY), only the file system in that partition is destroyed. Although the partition scheme or file system on
101 may be beyond repair after
103 this function is not designed as a means to safely delete all data. It is possible that some user data (or intact file systems in some partitions) may still be recovered.
107 function frees the allocated
115 .Fn wipefs_except_blocks
118 functions return 0 on success, or will fail and return an error code.
119 Each function may return
121 if insufficient memory is available. In addition, if
132 .\" .Sh BUGS \" Document known, unremedied bugs
133 .\".Sh HISTORY \" Document history if command behaves in a unique manner
134 .\"The wipefs family of functions first appeared in Mac OS X Leopard (10.5.3).