block sizes in filesystem


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users block sizes in filesystem
# 1  
Old 02-21-2008
block sizes in filesystem

I was reading this thread

https://www.unix.com/unix-dummies-que...isk-space.html

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
# 2  
Old 02-21-2008
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.
# 3  
Old 02-22-2008
thanks for your help
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Physical disk IO size smaller than fragment block filesystem size ?

Hello, in one default UFS filesystem we have 8K block size (bsize) and 1K fragmentsize (fsize). At this scenary I thought all "FileSytem IO" will be 8K (or greater) but never smaller than the fragment size (1K). If a UFS fragment/blocksize is allwasy several ADJACENTS sectors on disk (in a ... (4 Replies)
Discussion started by: rarino2
4 Replies

2. AIX

Mount Filesystem in AIX Unable to read /etc/filesystem

Dear all, We are facing prolem when we are going to mount AIX filesystem, the system returned the following error 0506-307The AFopen call failed : A file or directory in the path name does not exist. But when we ls filesystems in the /etc/ directory it show -rw-r--r-- 0 root ... (2 Replies)
Discussion started by: m_raheelahmed
2 Replies

3. Solaris

Solaris Filesystem vs. Windows FileSystem

Hi guys! Could you tell me what's the difference of filesystem of Solaris to filesystem of Windows? I need to compare both. I have read some over the net but it's so much technical. Could you explain it in a more simpler term? I am new to Solaris. Hope you help me guys. Thanks! (4 Replies)
Discussion started by: arah
4 Replies

4. UNIX for Advanced & Expert Users

df vs du for directory sizes

Is it better to use df or du to calculate directory sizes? I tried both and got different numbers with both. $ du -h /home 1.7G /home/bob1 1.7G /home $ df -h /home Filesystem Size Used Avail Use% Mounted on /dev/mapper/VG-lv_home 25G 1.9G 22G ... (2 Replies)
Discussion started by: cokedude
2 Replies

5. UNIX for Dummies Questions & Answers

hwo to find shared filesystem and local filesystem in AIX

Hi, I wanted to find out that in my database server which filesystems are shared storage and which filesystems are local. Like when I use df -k, it shows "filesystem" and "mounted on" but I want to know which one is shared and which one is local. Please tell me the commands which I can run... (2 Replies)
Discussion started by: kamranjalal
2 Replies

6. Shell Programming and Scripting

Help with file sizes

I have 2 big files in the size of gb. They are same with respect to content, both are , delimited. Now both of them are created by two different processes but has the same logic. The problem is they are differing only in few bytes for e.g one file is 202195751 bytes other is 202195773. So... (2 Replies)
Discussion started by: dsravan
2 Replies

7. Solaris

Filesystem - error when extend the filesystem

Hi all, currently , my root filesystem already reach 90 ++% I already add more cylinder in the root partition as below Part Tag Flag Cylinders Size Blocks 0 root wm 67 - 5086 38.46GB (5020/0/0) 80646300 1 swap wu 1 - ... (11 Replies)
Discussion started by: SmartAntz
11 Replies

8. UNIX Desktop Questions & Answers

block group size of a filesystem

How can I determine the block group size of my filesystem, in case I would like to determine where my backup superblocks are? Or how can I determine the location of my backup superblock? If usually, for the block group size of 1k, the alternate superblock will be at block 8193. Thanks, (2 Replies)
Discussion started by: Pouchie1
2 Replies

9. AIX

How can I find the filesystem block size?

How can I find the filesystem block size in AIX? I need to check if it is the same as my DB block size. (4 Replies)
Discussion started by: progressdll
4 Replies

10. UNIX for Dummies Questions & Answers

Directory sizes

Can someone tell me how to read these damn sizes. i mean, i prefer to see sizes in MB but that is not the case when you do an ls -l on directories. i have a had time converting these to MB just for verification purposes, what would a directory size like this = 3499990308 represent in MB or... (3 Replies)
Discussion started by: TRUEST
3 Replies
Login or Register to Ask a Question