DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Managing filesystem types

Formatting the storage device

Before a disk can be used it must be formatted into addressable sectors. A ``disk sector'' is a 512-byte portion of the storage medium that can be addressed by the disk controller. The number of sectors is a function of the size and number of surfaces of the disk device. Sectors are numbered from zero up.


NOTE: Hard disk units on many computers are formatted when installed. The only time they might have to be reformatted would be after a catastrophic hardware failure. Contact your service representative if such an event occurs.

Diskettes are made to be usable in more than one kind of computer. Manufacturers produce diskettes unformatted, leaving it to customers to format them for the particular computer on which they are to be used. The command that formats a diskette is format(1M).

Partitions on the storage device

A ``partition'' consists of one or more sectors. Up to 16 partitions can be defined on a hard disk, up to 8 on a floppy diskette. On a hard disk, the diskadd(1M) command is used to add a secondary disk. (See ``Formatting the storage device'' for information about partitions on a floppy diskette.) Use prtvtoc(1M) to see the partitions assigned. prtvtoc shows the starting sector and number of sectors allocated to a partition, as well as a tag that tells how the partition is used. Partition tags 0-8 are reserved.

Size limitations on a filesystem

The maximum number of physical blocks that can be allocated to a filesystem is close to the total number of sectors on the disk device. This maximum may be reduced by space set aside for swapping or paging. The total number of sectors addressable on a device is 2[31] - 1. This limits filesystems to being smaller than 1 terabyte in size. The vxfs filesystem type supports device sizes up to the limit.

Some filesystem types have a maximum number of inodes that can be specified:


s5
For the s5 filesystem type the maximum is 65,500.

ufs
The ufs filesystem type does not have a rigid upper limit; roughly one inode is created automatically for each 4K of data space, although this default can be overridden at the time the filesystem is created.

vxfs
The vxfs filesystem type's Version 1 disk layout follows the same guidelines as ufs for inode limits. vxfs disk layout Versions 2 and 4 allocate inodes dynamically, so the number of inodes is not fixed at the time the filesystem is created. Some pre-Release 4 applications, however, cannot be run on systems with more than 65,536 inodes; therefore, the vxfs specific version of mkfs provides an option to artificially limit the number of inodes. If you plan to run any such applications see mkfs(1M) for details.

The size of a block on a disk is 512 bytes, the same as a disk sector. However, internal file I/O works with logical blocks rather than with 512-byte physical blocks. The size of a logical block is set with the mkfs command. s5 uses logical block sizes of 512, 1024, and 2048 bytes; the default is 1024-byte blocks. ufs uses logical block sizes of 4096 and 8192 bytes; for most filesystems, the default is 4096-byte blocks. vxfs uses logical block sizes of 1024, 2048, 4096, or 8192 bytes; the default is 1024-byte blocks.

Because of the large block size used by ufs, small files could waste a lot of space. To deal with this, ufs has a subdivision of a block called a ``fragment''. When a ufs filesystem is created using mkfs, the fragment size can be set to 512, 1024, 2048, or 4096 bytes. When a block must be fragmented, the remaining fragments are made available to other files to use for storage. The information on which fragments are in use and which are available is kept in the cylinder group summary information block.

There are no fragments with vxfs, because storage is allocated in extents that consist of one or more blocks. For the most efficient space utilization, the smallest block size should be used. The smallest block size available is 1KB (a 1024-byte block), which is the default block size for vxfs filesystems created on the system. Unless there are special concerns, you should never need to specify a block size when creating a vxfs filesystem.


© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 22 April 2004