statvfs

Post questions regarding programming in C/C++ in Linux/Unix.

Moderators: Darobat, RecursiveS, Dante Shamest, Bugdude, Wizard

statvfs

Postby sepoto » Thu Oct 20, 2011 5:25 pm

Code: Select all
#include <sys/statvfs.h>
#include <iostream>
using namespace std;

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


Code: Select all
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:{...}


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!
sepoto
 
Posts: 1
Joined: Thu Oct 20, 2011 5:24 pm

Return to Unix/Linux

Who is online

Users browsing this forum: No registered users and 1 guest