Linux Format

Disk space

-

You’ve just bought a lovely new 1TB drive, partitione­d and formatted it in GParted, but your desktop’s tools are reporting that it has a size of around 900GB. Have you been robbed? Where is the 1TB you paid for? There are two main factors here. The first is overhead – space is needed for the partition tables, and any filesystem also needs space for its own purposes. Ext4 also reserves 5 per cent (a default that can be changed) of the filesystem for the root user only, to prevent lowly users like us from filling up the drive and causing problems.

The other factor is the way in which drive (and memory) capacity is measured. Memory works in powers of two, so the nearest to 1,000 is 1,024 – one kilobyte of RAM is actually 1,024 bytes. However, the SI standard specifies that a kilo is 1,000 units, mega is 1,000 kilos and giga is 1,000 mega. There is a “binary” version of this where 1KiB is 1,024 bytes, 1MiB is 1,024KiB and so on, but these terms are often used interchang­eably, and incorrectl­y. So your 1TB drive is actually 1,000,000,000,000 bytes, which is approximat­ely 0.91TiB, and there is the difference.

You can see this with the df command, which reports size and free space on filesystem­s: df -h will report in binary units while df -H uses SI units (multiples of 1,000). The latest fdisk and gdisk also use binary units. For example, the 3TB drive in my computer is reported as 2.7TiB in gdisk – that’s a 10 per cent difference just because of the method of counting bytes that is used.

 ??  ??

Newspapers in English

Newspapers from Australia