The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Help on adding file sizes llsmr777 UNIX for Dummies Questions & Answers 1 09-18-2007 11:58 AM
BAD SUPER BLOCK - Run fsck with alternate super block number admin wanabee HP-UX 1 09-08-2006 10:57 AM
How can I find the filesystem block size? progressdll AIX 4 10-06-2005 06:55 AM
Distributing folders into set sizes redturbo Shell Programming and Scripting 3 04-15-2004 05:36 AM
Directory sizes TRUEST UNIX for Dummies Questions & Answers 3 09-24-2003 06:24 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 02-21-2008
Registered User
 

Join Date: Dec 2007
Posts: 106
block sizes in filesystem

I was reading this thread

SCO Unix - Disk Space

and it talks about
Quote:
if a file makes use of 2KB of 1 MB block
what I want to know is, how can I find out what sizes the blocks are on my system, or does the question not even make sense?

thanks
Reply With Quote
Forum Sponsor
  #2  
Old 02-21-2008
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,298
Yes, but on a single system there may be mutiple unix filesystems - look at /etc/fstab
and try man fstab for more information.

How to get blocksize differs from system to system.

The only way I know that works on different systems is a simple chunk of code like this:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/statvfs.h>
extern int errno;

int disp(const char *path)
{
    struct statvfs st;
    int retval=statvfs(path, &st);

    if(!retval)
        fprintf(stdout,"%s %u\n", st.f_fstr, st.f_bsize);
    else
    {
        fprintf(stderr, "%s %s\n", path, strerror(errno));
        retval=1;
    }
    return retval;
}


int main(int argc, char **argv)
{
    int i=0;
    char path[512]={0x0};
    int retval=0;

    if(argc==1)
        while(fgets(path, sizeof(path), stdin)!=NULL)       
            retval|=disp(path);
    else
        for(i=1; i<argc; i++)        
            retval|=disp(argv[i]);
        
    return retval;
}
If you post your OS someone will know a command specific to that system.
Reply With Quote
  #3  
Old 02-22-2008
Registered User
 

Join Date: Dec 2007
Posts: 106
thanks for your help
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 09:17 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0