Classic Shell Scripting - Arnold Robbins [238]
* * *
* * *
[11] DEC/Compaq/Hewlett-Packard OSF/1 (Tru64), IBM AIX, SGI IRIX, and Sun Solaris all do this. Apple Mac OS X, BSD systems, GNU/Linux, and Hewlett-Packard HP-UX do not.
[12] See John Lions' book, Lions' Commentary on UNIX 6th Edition, with Source Code, Peer-to-Peer Communications, 1996, ISBN 1-57398-013-7. The reduction happens at kernel line 7535 (sheet 75), with the commentary on p. 19-2. "Multiple slashes are acceptable." If the code had used if instead of while, this reduction would not happen!
[13] The protocol is called a scheme in standards documents, but both terms are in wide use.
[14] Available at ftp://vic.cc.purdue.edu/pub/tools/unix/lsof/. Alternative commands available in some Unix flavors are fstat and fuser.
[15] By Marshall Kirk McKusick, Keith Bostic, Michael J. Karels, and John S. Quarterman, Addison-Wesley, 1996, ISBN 0-201-54979-4.
[16] By Uresh Vahalia, Prentice-Hall, 1996, ISBN 0-13-101908-2.
[17] Some advanced filesystem designs permit that table to grow as needed.
[18] The file type in the inode records that the file is a symbolic link, and in most filesystem designs, the name of the file that it points to is stored in the symbolic link's data block.
How Big Can Unix Files Be?
The size of Unix files is normally constrained by two hard limits: the number of bits allocated in the inode entry to hold the file size in bytes, and the size of the filesystem itself. In addition, some Unix kernels have manager-settable limits on file sizes. The data structure used on most Unix filesystems to record the list of data blocks in a file imposes a limit of about 16.8 million blocks, where the block size is typically 1024 to 65,536 bytes, settable, and fixed at filesystem-creation time. Finally, the capacity of filesystem backup devices may impose further site-dependent limits.
Most current Unix filesystems use a 32-bit integer to hold the file size, and because the file-positioning system calls can move forward or backward in the file, that integer must be signed. Thus, the largest-possible file is 231 - 1 bytes, or about 2GB.[19] Until about the early 1990s, most disks were smaller than that size, but disks containing 100GB or more became available by about 2000, and by combining multiple physical disks into a single logical disk, much larger filesystems are now feasible.
Unix vendors are gradually migrating to filesystems with 64-bit size fields, potentially supporting about 8 billion gigabytes. Just in case you think that might not be enough in the near future, consider that writing such a file once at the currently reasonable rate of 10MB/s would take more than 27,800 years! This migration is decidedly nontrivial because all existing software that uses random-access file-positioning system calls must be updated. To avoid the need for massive upgrades, most vendors allow the old 32-bit sizes to be used in newer systems, which works as long as the 2GB limit is not reached.
When a Unix filesystem is created, for performance reasons a certain fraction of the space, often 10 percent or so, is reserved for use by processes running as root. The filesystem itself requires space for the inode table, and in addition there may be special low-level blocks that are accessible only by the disk-controller hardware. Thus, the effective capacity of a disk is often only about 80 percent of the size quoted by the disk vendor.
Commands exist on some systems to decrease the reserved space: doing so may be advisable on large disks.