Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
Try this command: df -B1 – speakr Aug 30 '12 at 10:49
It's closer, but the result differs: parted /dev/sdd1 unit B print == 3221225472B == 3221225472, where df -B1 -a | grep /dev/sdd1 for Used + Available == 1152532480 + 1857056768 = 3009589248. And 3221225472 - 3009589248 = 211636224. In that case, where have those 201MiB's went? – joltmode Aug 30 '12 at 11:19
The space allocatable by a file system is not equal to the size of the underlying partition. df reports file system sizes, parted reports partition sizes. The difference is caused by file system overhead. – speakr Aug 30 '12 at 11:36
Oh, and these 201MiB's are OK for filesystem on 3.0GiB partition? – joltmode Aug 30 '12 at 11:46
No, I guess this is too much. But I don't know your setup, e.g. if your file system is using the maximum available size of your partition. So what is it that you actually want? – speakr Aug 30 '12 at 12:01
up vote 7 down vote accepted

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.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .