Linux – Partition used and available size in bytes

hard drivelinuxpartitioning

I'm not a linux pro, and maybe I have overlooked something in the docs, but:

df -ah, for instance, returns automatically largest unit: M / G / T.

simply df with no options, returns, what I assume are sectors not bytes.

parted /dev/sda1 unit B print

It displays in bytes, but it does not return the used / available bytes.

I have heard about converting sectors to actual sizes, but I have no idea how would I do that.

How could I return the actual bytes of partition?

Best Answer

If you need the partition size, you should be fine with the command you already mentioned:

parted /dev/sdd1 unit B print

If you need the total file system size, you can use the total numbers given by df:

df -B1 /dev/sdd1

Note that if you sum up used and available space given by df, it will be less than the given total space. This is due to file system overhead, e.g. the journal.

If you want to modify or just have a look on your file system setup consider the tune2fs and dumpe2fs manpages.

Related Question