mkfs_hfs(1M) mkfs_hfs(1M)
NAME [Toc] [Back]
mkfs_hfs: mkfs - construct an HFS file system
SYNOPSIS [Toc] [Back]
/usr/sbin/mkfs [-F hfs] [-d] [-L|-S] [-V] [-o specific_options] special
[size [nsect ntrack blksize fragsize ncpg minfree rps nbpi]]
/usr/sbin/mkfs [-d] [-F hfs] [-L|-S] [-V] [-o specific_options]
special [proto [nsect ntrack blksize fragsize ncpg minfree rps
nbpi]]
/usr/sbin/mkfs [-F hfs] [-m] [-V] special
Remarks [Toc] [Back]
HFS file systems are normally created with the newfs command (see
newfs_hfs(1M)).
DESCRIPTION [Toc] [Back]
The mkfs command constructs an HFS file system by writing on the
special file special. The mkfs command builds the file system with a
root directory and a lost+found directory (see fsck_hfs(1M)). The
FS_CLEAN magic number for the file system is stored in the superblock.
The mkfs command creates the file system with a rotational delay value
of zero (see tunefs(1M)).
Options [Toc] [Back]
mkfs recognizes the following options:
-F hfs Specify the HFS file system type.
-d This option allows the mkfs command to make the
new file system in an ordinary file. In this
case, special is the name of an existing file in
which to create the file system. When this option
is used, the size of the new file system cannot be
defaulted. It must either be specified on the
command line following special, or if a prototype
file is being used, it must be the second token in
the prototype file as usual.
-L|-S There are two types of HFS file systems,
distinguished mainly by directory formats that
place different limits on the length of file
names.
If -L is specified, build a long-file-name file
system that allows directory entries (file names)
to be up to MAXNAMLEN (255) bytes long.
Hewlett-Packard Company - 1 - HP-UX 11i Version 2: August 2003
mkfs_hfs(1M) mkfs_hfs(1M)
If -S is specified, build a short-file-name file
system that allows directory entries (file names)
to be up to DIRSIZ (14) bytes long.
If neither -L nor -S is specified, build a file
system of the same type as the root file system.
-m Display the command line that was used to create
the file system. The file system must already
exist. This option provides a means to determine
the parameters used to construct the file system.
-V Echo the completed command line, but perform no
other action. The command line is generated by
incorporating the user-specified options and other
information derived from /etc/fstab. This option
allows the user to verify the command line.
-o specific_options
Specify a list of comma separated suboptions
and/or keyword/attribute pairs from the list
below.
largefiles|nolargefiles
Controls the largefile featurebit for the file system. The
default is nolargefiles. This means the bit is not set, and
files created on the file system will be limited to less
than 2 gigabytes in size. If largefiles is specified, the
bit is set and the maximum size for files created on the
file system is not limited to 2 gigabytes (see mount_hf
).
Arguments [Toc] [Back]
mkfs recognizes the following arguments:
special The file name of a special file.
One of the following arguments can be included after special:
size The number of DEV_BSIZE blocks in the file system.
DEV_BSIZE is defined in <sys/param.h>. The
default value is the size of the entire disk or
disk section minus any swap or boot space
requested.
The size of HFS file systems are limited to
256GB-1 or 268,435,455 blocks.
proto The name of a file that can be opened. The mkfs
command assumes it is a prototype file and takes
its directions from that file. See "Prototype
Hewlett-Packard Company - 2 - HP-UX 11i Version 2: August 2003
mkfs_hfs(1M) mkfs_hfs(1M)
File Structure" below.
The following optional arguments allow fine-tune control over file
system parameters:
nsect The number of sectors per track on the disk. The
default value is 32 sectors per track.
ntrack The number of tracks per cylinder on the disk.
The default value is 16 tracks per cylinder.
blksize The primary block size for files on the file
system. Valid values are: 4096, 8192, 16384,
32768, and 65536. The default value is 8192
bytes.
fragsize The fragment size for files on the file system.
fragsize represents the smallest amount of disk
space to be allocated to a file. It must be a
power of two no smaller than DEV_BSIZE and no
smaller than one-eighth of the file system block
size. The default value is 1024 bytes.
ncpg The number of disk cylinders per cylinder group.
This number must be in the range 1 to 32. The
default value is 16 cylinders per group.
minfree The minimum percentage of free disk space allowed.
The default value is 10 percent.
Once the file system capacity reaches this
threshold, only users with appropriate privileges
can allocate disk blocks.
rps The number of disk revolutions per second. The
default value is 60 revolutions per second.
nbpi The density of inodes in the file system specified
as the number of bytes per inode. The default
value is 6144 bytes per inode.
This number should reflect the expected average
size of files in the file system. If fewer inodes
are desired, a larger number should be used; if
more inodes are desired, a smaller number should
be used.
Note: The number of inodes that will be created in
each cylinder group of a file system is
approximately the size of the cylinder group
divided by the number of bytes per inode, up to a
Hewlett-Packard Company - 3 - HP-UX 11i Version 2: August 2003
mkfs_hfs(1M) mkfs_hfs(1M)
limit of 2048 inodes per cylinder group. If the
size of the cylinder group is large enough to
reach this limit, the default number of bytes per
inode will be increased.
Prototype File Structure [Toc] [Back]
A prototype file describes the initial file structure of a new file
system. The file contains tokens separated by spaces or newline
characters. It cannot contain comments.
The first token is the name of a file to be copied onto block zero as
the bootstrap program (usually /etc/BOOT). If the file name is "", no
bootstrap code is placed on the device. The second token is a number
specifying the number of DEV_BSIZE blocks in the file system.
The next three tokens specify the mode, user ID, and group ID of the
root directory of the new file system, followed by the initial
contents of the root directory in the format described for a directory
file below, and terminated with a $ token.
A file specification consists of four tokens giving the name, mode,
user ID, and group ID, and an initial contents field. The syntax of
the initial contents field depends on the mode.
A name token is a file name that is valid for the file system. The
root directory does not have a name token.
A mode token is a 6-character string. The first character specifies
the type of the file. It can be one of the following characters:
- Regular file
b Block special file
c Character special file
d Directory
l Symbolic link
L Hard link
The second character of a mode token is either u or - to specify setuser-ID
mode or not. The third character of a mode token is either g
or - to specify the set-group-ID mode or not. The rest of a mode
token is a three-digit octal number giving the owner, group, and other
read, write, and execute permissions (see chmod(1)).
The user-ID and group-ID tokens define the owner of the file. These
values can be specified numerically or with symbolic names that appear
in the current password and group databases.
Regular file. The initial contents field is the path name of an
existing file in the current file system whose contents and size are
copied to the new file.
Hewlett-Packard Company - 4 - HP-UX 11i Version 2: August 2003
mkfs_hfs(1M) mkfs_hfs(1M)
Block or character special file. The initial contents field is two
numeric tokens that specify the major and minor device numbers.
Directory file. The initial contents field is a list of file
specifications for the entries in the directory. The list is
terminated with a $ token. Directories can be nested. For each
directory, the mkfs command automatically makes the . and .. entries.
Symbolic link. The initial contents field is a path name that is used
as the path to which the symbolic link should point.
Hard link. The initial contents field is a path name that is used as
the name of a file within the new file system to which the entry
should be linked. The mode, user-ID and group-ID tokens of this entry
are ignored; they are taken from the target of the link. The target
of the link must be listed before the entry specifying the link. Hard
links to directories are not permitted.
With the exception of the permissions field of the mode token (which
is always an octal number), all numeric fields can be specified in
hexadecimal (using a leading 0x), octal (using a leading 0), or
decimal.
Here is a sample prototype specification. The indentation clarifies
the directory recursion.
/etc/BOOT
12288
d--555 bin bin
sbin d--755 bin bin
init ---555 bin bin /sbin/init
savecore ---555 bin bin /sbin/savecore
$
dev d--555 bin bin
b0 b--640 root sys 0 0x0e0000
c0 c--640 root sys 4 0x0e0000
$
etc d--755 bin bin
init l--777 bin bin /sbin/init
passwd ---444 bin bin /etc/passwd
group ---444 bin bin /etc/group
$
usr d--755 bin bin
bin d--755 bin bin
sh ---555 bin bin /usr/bin/sh
rsh L--555 bin bin /usr/bin/sh
su -u-555 root bin /usr/bin/su
mailq l--777 bin bin /usr/sbin/sendmail
$
sbin d--755 bin bin
sendmail -ug555 root mail /usr/sbin/sendmail
Hewlett-Packard Company - 5 - HP-UX 11i Version 2: August 2003
mkfs_hfs(1M) mkfs_hfs(1M)
$
$
$
Access Control Lists [Toc] [Back]
Every file with one or more optional ACL entries consumes an extra
(continuation) inode. If you anticipate significant use of ACLs on a
new file system, you can allocate more inodes by reducing the value of
nbpi appropriately. The small default value typically causes
allocation of many more inodes than are actually necessary, even with
ACLs. To evaluate your need for extra inodes, run the bdf -i command
on existing file systems. For more information on access control
lists, see acl(5).
EXAMPLES [Toc] [Back]
Execute the mkfs command to create a 32MB HFS file system on the nonLVM
disk /dev/dsk/c1t2d0:
mkfs -F hfs /dev/dsk/c1t2d0 32768
Display the command that was used to construct the file system on
/dev/dsk/c1t2d0:
mkfs -F hfs -m /dev/dsk/c1t2d0
Create an HFS file system within a logical volume /dev/vg01/my_lvol of
a size equal to the size of my_lvol:
mkfs -F hfs /dev/vg01/my_lvol
WARNINGS [Toc] [Back]
The old -F option, from prior releases of mkfs(1M), is no longer
supported.
mkfs_hfs(1M) cannot be executed specifying creation of a file system
on a whole disk if that disk was previously used as an LVM disk. If
you wish to do this, use mediainit(1) to reinitialize the disk first.
The -o largefile option should be used with care, since older
applications will not react correctly when confronted with large
files.
AUTHOR [Toc] [Back]
mkfs was developed by HP and the University of California, Berkeley.
FILES [Toc] [Back]
/var/adm/sbtab List of locations of the superblocks for the
created file system. The mkfs command
appends entries to this file.
Hewlett-Packard Company - 6 - HP-UX 11i Version 2: August 2003
mkfs_hfs(1M) mkfs_hfs(1M)
SEE ALSO [Toc] [Back]
chmod(1), bdf(1M), df(1M), fsadm_hfs(1M), fsck(1M), fsck_hfs(1M),
fsclean(1M), mkfs(1M), mount_hfs(1M), newfs(1M), newfs_hfs(1M),
dir(4), fstab(4), group(4), passwd(4), symlink(4), acl(5).
STANDARDS CONFORMANCE [Toc] [Back]
mkfs: SVID3
Hewlett-Packard Company - 7 - HP-UX 11i Version 2: August 2003 [ Back ] |