Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
show 3 more comments

1 Answer

up vote 1 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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.