Score:1

Why is my disk size reduced after creating an ext4 partition?

cn flag

I attached a new 200 GB volume to my machine and created a ext4 file system.

But now I'm only getting ~185GB as usable space. Why can't I use all 200 GB ?

Here is the output of lsblk

NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0         7:0    0 55.5M  1 loop /snap/core18/1997
loop1         7:1    0 33.3M  1 loop /snap/amazon-ssm-agent/3552
loop2         7:2    0 32.3M  1 loop /snap/snapd/11588
loop3         7:3    0 70.4M  1 loop /snap/lxd/19647
nvme1n1     259:0    0  200G  0 disk 
└─nvme1n1p1 259:1    0  200G  0 part /media/Data
nvme0n1     259:2    0   20G  0 disk 
└─nvme0n1p1 259:3    0   20G  0 part /

And here is the output of df -h

Filesystem      Size  Used Avail Use% Mounted on
/dev/root        20G  1.3G   19G   7% /
devtmpfs        7.8G     0  7.8G   0% /dev
tmpfs           7.8G     0  7.8G   0% /dev/shm
tmpfs           1.6G  788K  1.6G   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/loop1       34M   34M     0 100% /snap/amazon-ssm-agent/3552
/dev/loop2       33M   33M     0 100% /snap/snapd/11588
/dev/loop0       56M   56M     0 100% /snap/core18/1997
/dev/loop3       71M   71M     0 100% /snap/lxd/19647
tmpfs           1.6G     0  1.6G   0% /run/user/1000
/dev/nvme1n1p1  196G  1.4G  185G   1% /media/Data

As you can see only 1% of drive has been used but still I'm only getting 185 GB as usable. Why is that so ?

Thank you in advance!

Score:4
es flag

Your SSD has 200 GiB (1024-based units!) of disk space total. After formatting with ext4, you have 196 GiB left; ext4 needs some disk space for its own meta data such as i-nodes and reserve blocks.

Those 196 GiB are the net capacity of that partition /dev/nvme1n1p1 mounted at /media/Data. As usual, some of that is reserved for the root user, leaving 185 GiB for normal users.

Reserving some percent for the root user makes sense if it's a vital system partition such as the root filesystem; but for a pure data disk like this it does not. Yet mkfs.ext4 does it because it cannot know what you intend to do with that filesystem.

The reason for reserving some disk space for root is to give the system administrator a fighting chance to work with filesystem tools if the disk fills up; if there are zero blocks left because some user filled a system partition completely, it's getting hard to do anything about it because some tools also need some disk space for normal operation.

But you can make those reserved percent available for normal users with the tune2fs command:

sudo tune2fs -r 0 /dev/nvme1n1p1

See also man tune2fs.

Dipanshu Chaubey avatar
cn flag
Thank you so much. I didn't know that the system reserves storage for root user. Also, using ```tune2fs``` command I was able to recover the reserved storage.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.