Ubuntu: different partition size in parted and in df



Question:

Can anyone explain the difference between partition size in parted and in df?

root@HOME:~# parted /dev/sda  GNU Parted 2.3  Using /dev/sda  Welcome to GNU Parted! Type 'help' to view a list of commands.  (parted) u s                                                                (parted) p                                                                  Model: ATA Samsung SSD 850 (scsi)  Disk /dev/sda: 488397168s  Sector size (logical/physical): 512B/512B  Partition Table: gpt    Number  Start       End         Size        File system  Name                  Flags   1      2048s       206847s     204800s     fat32        EFI                   boot   2      206848s     468991s     262144s                                        msftres   3      468992s     134686719s  134217728s  ntfs         Win10                 msftdata   4      134686720s  268904447s  134217728s  ext4         ubuntu   5      268904448s  436676942s  167772495s  ntfs         Basic data partition  msftdata    (parted) q                                                                  root@HOME:~# df -BG  Filesystem     1G-blocks  Used Available Use% Mounted on  /dev/sda4            63G    7G       53G  12% /  none                  1G    0G        1G   0% /sys/fs/cgroup  udev                  4G    1G        4G   1% /dev  tmpfs                 1G    1G        1G   1% /run  none                  1G    0G        1G   0% /run/lock  none                  4G    1G        4G   1% /run/shm  none                  1G    1G        1G   1% /run/user  /dev/sda1             1G    1G        1G  30% /boot/efi  root@HOME:~#   

Size of /dev/sda4 is 134.217.728 sectors, which is 134.217.728*512 = 68.719.476.736 bytes.

It is EXACTLY 64GiB, as 64*1024*1024*1024 = 68.719.476.736

Why df shows "63G" ?


Solution:1

I assume that df shows the space available in the file system (without structures needed for the file system itself maybe?), whereas parted probably reports the outer size of the partition.

Other than that, the output of df -BG seems to be rounded down to full GigaBytes. I think that the sizes would differ less if you let df output smaller (optimally the same as parted i.e. 512 bytes) units.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »