Say I have a 1TB SSD and I want to create a 400GB partition with ext4.
So I use fdisk and mkfs to achieve that:
#### fdisk ####
sudo fdisk /dev/sdb
# New primary partition, with partition 1 starts with 2048 sector:
n
p
1
2048
# The last sector
+400G
#### Configure the file system ####
sudo mkfs -t ext4 /dev/sdb1
sudo tune2f -m 0 /dev/sdb1
It turns out that the size I saw in df
is less than I expected:
# expected: 400 * 1024 * 1024 = 419430400
/dev/sdb1 411725224
So now I use +408G
instead of +400G
in fdisk to "achieve" what I want,
but obviously it was not the smartest solution.
I've also tried to use +419430400K
instead of +400G
in fdisk but the result is same.
Is there any formula to create a partition with the size I want?