A
A
Anton Pashchenko2021-09-17 14:41:18
Debian
Anton Pashchenko, 2021-09-17 14:41:18

Why is there only 435Gb available in a Debian 500Gb HDD?

On a 500GB Debian 9 HDD, only 435Gb is available.
Partitions are created in parted as follows

1. unit s
2. mklabel gtp
3. mkpart primary ext4 0% 100%

Then the HDD is formatted with the command:
mkfs -t ext4 /dev/sdb
Mounted like this:
/dev/sdb /home/cams/183 ext4 defaults 0 0
As a result, df -h shows:
/dev/sdb           458G          73M  435G            1% /home/cams/183

parted:
Model: ATA WDC WD5000AAKX-6 (scsi)
Disk /dev/sdb: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:

Number  Start  End    Size   File system  Flags
 1      0,00B  500GB  500GB  ext4

In units:
Model: ATA WDC WD5000AAKX-6 (scsi)
Disk /dev/sda: 976773168s
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:

Number  Start  End         Size        File system  Flags
 1      0s     976773167s  976773168s  ext4


The question is why df -h shows 458Gb volume (when converted to 1024, it turns out to be about 465GB) and only 435GB is available?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Z
Zettabyte, 2021-09-17
@sevnet

Since you took into account kilobytes per 1000/1024 bytes, just in case, start by checking for deleted files: lsof | grep deleted.
Then look tune2fs -l- these are the file system options.
In Linux, ext* is allocated 5% for reservations in each partition for the needs of root. No one but him can write there. Displayed in the line Reserved block count .
You can change it with the command tune2fs -m №, where # is the new percentage (2, 3, etc.), but it's better to understand why you are doing this.
Well, usually the most noticeable overhead occurs due to inode tables. It depends on their number. The default is 2 MB inodes (8192 x 256 bytes each) for every 128 MB. about 1.5-1.6%, which is similar to the numbers you mentioned.

S
SagePtr, 2021-09-17
@SagePtr

And not only in Debian, but in general - hard disk manufacturers indicate the volume with the calculation of 1 KB = 1000 bytes, and most programs accept 1 KB as 1024 bytes.
500 * 1000³ / 1024³ = 465.66128730773926

V
ValdikSS, 2021-09-17
@ValdikSS

First, as already mentioned, Debian shows the size in gibibytes , and your disk is in gigabytes. 500 gigabytes = 465 gibibytes.
Space is spent on inodes - quite a lot of them are created by default. You can use the profile (option -T for mkfs.ext4) huge or largefile.
In addition, a significant amount of space is reserved for inodes when the file system is resized. You can disable this option and get even more free space:-O '^resize_inode'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question