statvfs - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

statvfs

[code]
#include
#include
using namespace std;

int main() {
int rv;
const char *path = "/dev/sdb";
struct statvfs fsdata;
rv = statvfs(path, &fsdata);
return 0;
return 0;
}
[/code]

[code]
Name : fsdata
Details:{f_bsize = 4096, f_frsize = 4096, f_blocks = 496330, f_bfree = 496329, f_bavail = 496329, f_files = 496330, f_ffree = 495725, f_favail = 495725, f_fsid = 0, f_flag = 4096, f_namemax = 255, __f_spare = {0, 0, 0, 0, 0, 0}}
Default:{...}
Decimal:{...}
Hex:{...}
Binary:{...}
Octal:{...}
[/code]

My block size is returning 4096 and I have calculated the total size of /dev/sdb to be 1.9GB +-. That is totally wrong. I have already verified that /dev/sdb is 32GB in size. I also question the block size. /dev/sdb in this case happens to be an SD card which has mounted to /dev/sdb by my OS which is Ubuntu 11.1. Does anyone know what can be done to obtain an accurate reading?

Thanks!
Sign In or Register to comment.