|
|
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.
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).
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.
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:
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.