Binary sizes in system tools

Operating systems and file systems count in powers of two. A memory page is 4 KiB, a common file system block is 4 KiB, and many Linux tools print usage in 1K-blocks that are really 1,024 bytes. A drive is sold in decimal terabytes, so matching a tool report to the label needs a conversion. This page multiplies terabytes by 976,562,500. The default of 10 TB gives 9,765,625,000 KiB. Because the target is the binary kibibyte, a reader sees right away that the number is smaller than the decimal kilobyte count of 10,000,000,000 kB.

How 976,562,500 is derived

One terabyte is 1,000,000,000,000 bytes. One kibibyte is 1,024 bytes. Dividing gives 976,562,500, so KiB = TB × 976,562,500. A 0.5 TB drive is 488,281,250 KiB, and 2 TB is 1,953,125,000 KiB. The factor is a clean integer because 10^12 / 2^10 equals 5^12 × 2^2, hence 976,562,500. To go back to terabytes, divide by that number: 1,000,000 KiB is 0.001024 TB, which is 1.024 GB. The result has no rounding error, and the kibibyte unit makes it clear that a binary count was used. Splitting the work this way, 10 TB as 10 times 976,562,500, keeps the large number readable.

Allocation units and block counts

A file system with 4 KiB blocks counts storage in blocks, so a volume of 1 TB holds 976,562,500 / 4 = 244,140,625 blocks. A file of 10 KiB takes three blocks, or 12 KiB. For a rough count of how many small files a volume can hold, divide the block count by the blocks per file. Inode tables, journals and metadata reduce the usable block count, and some file systems fix the number of inodes at format time. The page does not model any of that. It gives the raw number of kibibytes, which you can divide by your block size for a first estimate. Divide 976,562,500 by 4 for 4 KiB blocks, or by 16 for 64 KiB blocks, and the result is the block count for a full 1 TB volume.

Reading du and df output

The du and df commands report in 1K-blocks by default on many systems, where one block is 1,024 bytes. A report listing 976,562,500 blocks for a 1 TB volume matches the figure on this page. Some tools, such as df -H, switch to decimal units, and in that case 1 TB reads as 1,000G. If you read a report in 1K-blocks and want terabytes, divide by 976,562,500 rather than a round billion, since a billion would overstate capacity by about 2.4 percent. Checking the first few digits of the converted number against the label tells you which convention a tool followed. A 1 TB volume that lists 976,000,000 or so blocks is using the binary convention, while one listing close to 1,000,000,000 blocks has used decimal kilobytes.

Memory pages and kernel parameters

Memory is managed in pages of 4 KiB on most desktop and server systems. A server with 512 GiB of RAM has 134,217,728 pages. Documentation for kernel settings, such as huge page counts, uses KiB for sizes and page counts for quantity. Disks and memory are different things, but both appear in capacity planning for swap and for large caches. A swap file of 8 GiB is 8,388,608 KiB. When you size a swap area against a 1 TB disk, the kibibyte count shows what share of the 976,562,500 KiB the swap takes: about 0.86 percent.

Firmware images and embedded storage

Embedded developers often work with flash sizes in KiB: a bootloader of 64 KiB, a firmware image of 512 KiB and a data partition of 4,096 KiB. Compare those with a storage budget in terabytes only when many devices log to a central store. Suppose 100,000 devices each upload a 2,048 KiB log daily. That is 204,800,000 KiB a day, or about 0.21 TB, using 976,562,500 KiB per TB. A month of retention needs about 6.3 TB. Converting to KiB first keeps the arithmetic consistent with the binary sizes in device specifications, and then a single division converts the total to terabytes. If the devices keep thirty days of history locally and upload only on request, the central figure drops sharply, so state the retention model next to the estimate.

Page cache, databases and 8 KiB pages

Database engines read and write in fixed pages: 8 KiB in PostgreSQL by default, 16 KiB in InnoDB, 4 KiB in many file systems. A table of 2,500,000,000 KiB holds 312,500,000 pages of 8 KiB. Dividing a volume in KiB by the page size gives the count of pages the storage can hold, which helps in sizing buffer pools and estimating I/O. A 1 TB volume has 976,562,500 KiB, or 122,070,312 pages of 8 KiB when rounded down. Table bloat, indexes and free space maps add overhead, so treat the number as an upper bound. The kibibyte keeps the arithmetic in the same binary units as the page size.

KiB, kB and KB

Use kB for 1,000 bytes and KiB for 1,024 bytes. Many tools print KB for either. On a Windows file property dialog, KB means 1,024 bytes, so a file listed as 250 KB is 256,000 bytes. A file of 250 kB in the SI sense is 250,000 bytes, or about 244.14 KiB. The page outputs KiB, so the number is unambiguous. The difference is 2.4 percent at the kilo level, which seems minor but compounds at higher prefixes, reaching about 10 percent at the tera level. State which one you mean in documents that other people will check. A short note under a table, such as sizes in KiB (1,024 bytes), removes the question for later readers.

Working in the other direction

To convert a block count back to terabytes, choose KiB as the source and TB as the target. A report that lists 3,906,250,000 KiB means 4 TB, since 3,906,250,000 / 976,562,500 is 4. A volume of 500,000,000 KiB is 0.512 TB. Rounding to a few digits is fine for planning, but keep the full number in scripts. Because the factor is exact, a conversion in one direction followed by the other returns the starting value. If it does not, a spreadsheet likely rounded an intermediate result. The page reduces that risk by working from the full-precision factor. A two-way check is simple: 10 TB gives 9,765,625,000 KiB, and dividing that by 976,562,500 returns 10.