[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: find the blocksize of a FS



Hi,

> > is there a way to get the blocksize of an FS thru /proc or something else
> > that doesn't rely on the utils (dumpe2fs, xfs_info) to be installed?
> 
> Not that I can see. You can query the disk geometry, but proc is too
> low level to know about what filesystems are on the devices.
> /proc/filesystems only gives what filesystems the kernel supports.

you could code up a C snippet:

] echo -e '#define PATH_TO_MOUNTED_FS "..."
]   #include <sys/statvfs.h>
]   #include <stdio.h>
]   int main() { struct statvfs V; statvfs(PATH_TO_MOUNTED_FS, &V);
]                printf("%u\\n", V.f_bsize); return 0; }' |
] gcc -x c - -o /tmp/fsbsq && /tmp/fsbsq


Regards,

Jan

Attachment: signature.asc
Description: Digital signature


Reply to: