0

I have a 18TB HDD. (MG09ACA18TE)

$ df -TH
Filesystem              Type      Size  Used Avail Use% Mounted on    
/dev/dm-7               btrfs      19T   13T  5,8T  69% /mnt/point

$ df -Th
Filesystem              Type      Size  Used Avail Use% Mounted on
/dev/dm-7               btrfs      17T   12T  5,3T  69% /mnt/point

From the man page:

   -h, --human-readable
          print sizes in powers of 1024 (e.g., 1023M)

   -H, --si
          print sizes in powers of 1000 (e.g., 1.1G)

How is it possible to have an extra TB?


Requested commands:

$ df
Filesystem                1K-blocks        Used  Available Use% Mounted on
/dev/dm-5               17578311680 13643014304 3933951744  78% /mnt/point

$ lsblk -b
NAME                  MAJ:MIN RM           SIZE RO TYPE  MOUNTPOINT
sde                     8:64   0 18000207937536  0 disk  
└─luks-..             253:5    0 18000191160320  0 crypt /mnt/point
Giacomo1968
  • 53,069
  • 19
  • 162
  • 212
Ocean
  • 133
  • 6
  • Please be specific. What is the output of `df`? (without `-H`). What do you mean by "otherwise"? What is the output of `lsblk -b`? What is the output of `btrfs fi usage -b /the/mountpoint/`? [Edit] the question and add information. – Kamil Maciorowski Mar 10 '23 at 19:42
  • 2
    Is this perhaps a matter of metrics, for example K=1024 versus K=1000? What software are you using and can we see outputs? – harrymc Mar 10 '23 at 19:43
  • 2
    A quick diddling of my pocket calculator says that 18 * 1024 * 1024 * 1024 (18 tebibytes) is 19,327,352,832, which might be reported as 19 terabytes, if btrfs reports using thousand-kays instead of 1024-kays (terabytes instead of tebibytes). (This is essentially what @harrymc was saying.) – Jeff Zeitlin Mar 10 '23 at 19:51
  • @JeffZeitlin (1) It's not "btrfs reports using…". It's `df -H` (as opposed to `df -h`). (2) Either you silently used KiB as the unit, or you used not enough `* 1024`. (3) I expect a disk *advertised* as 18TB to use 1000-based arithmetic (see my comment under [this answer](https://superuser.com/a/1037393/432690)); but for now we don't know what this 18TB really means, so *maybe* it's 1024-based. – Kamil Maciorowski Mar 10 '23 at 20:08
  • @KamilMaciorowski - Point taken on both. The "not enough *1024" is indeed an error on my part; Tera/Tebi is indeed the fourth order, not the third (giga/gibi). It's been a looooooong day for me... – Jeff Zeitlin Mar 10 '23 at 20:17
  • @KamilMaciorowski I've updated the question with hopefully all the relevant info this time. – Ocean Mar 10 '23 at 20:20
  • [`/dev/dm-7` is not *directly* your hardware HDD](https://superuser.com/q/131519/432690). – Kamil Maciorowski Mar 10 '23 at 20:23
  • @KamilMaciorowski It's the result of using cryptsetup, probably. All my other data drives are also /dev/dm-X and their sizes match with what I bought. Only difference is those are ext4 and not btrfs. – Ocean Mar 10 '23 at 20:26
  • This is why `lsblk -b` is a better starting point. You have edited the question, but have not really responded to my first comment. – Kamil Maciorowski Mar 10 '23 at 20:28
  • @KamilMaciorowski both of those commands report 18000191160320, which is fine, but doesn't explain the 19T. – Ocean Mar 10 '23 at 21:19
  • What "both" commands? In my first comment there are *three* commands. You seem reluctant to give us firm information, as if you did not want help. New information should be clear and explicit: this exact command gives this exact output; and it should be in the question body, not in comments. – Kamil Maciorowski Mar 10 '23 at 21:32
  • @KamilMaciorowski The ones not included in the question, `lsblk..` and `usage..` Both of them report 18000191160320, but them reporting what I expect doesn't explain the 19T from `df -H`. – Ocean Mar 14 '23 at 16:57

1 Answers1

3

My tests indicate df -H rounds numbers up. The size in bytes is 18000191160320, it is more than 18000000000000 and therefore you see 19T.

Actually the number from lsblk -b describes the block device. What matters for df is the size of the filesystem. The size of your filesystem may be smaller than 18000191160320 bytes, but apparently it's still larger than 18000000000000, so rounding up results in 19 TB. Rounding up is responsible for what you see in the output of df -H.

For comparison, these are some of my partitions/filesystems:

device lsblk -bdevice size in bytes df -B 1filesysystem size in bytes df -Hfilesystem size my comment
sdc1 12000137413120 12000137412608 13T not 12T
sda1 5000980012544 5000980008960 5.1T not 5.0T

The same applies for df -h. 18000191160320 B is about 16.371 TiB which is closer to 16 TiB than to 17 TiB. Yet df -h shows you 17T, it also rounds up like df -H. 17T from df -h is almost as inflated as 19T from df -H and the reason is the same: the tool rounds numbers up.

Kamil Maciorowski
  • 69,815
  • 22
  • 136
  • 202