Re: find the blocksize of a FS
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 01/14/08 06:55, Martin Marcher wrote: > Ron Johnson wrote: >> On 01/13/08 06:37, Martin Marcher wrote: >>> On Saturday 12 January 2008 23:38 Jan C. Nordholz wrote: >>> hmm looks like a starting point, I'm trying to get to that info with >>> python, if all else fails I think the python ctypes module should be able >>> to get that info thru the C interface. >> Well heck, that's easy. >> >> http://docs.python.org/lib/module-statvfs.html >> http://docs.python.org/lib/os-file-dir.html#l2h-2700 >> >> $ python >> Python 2.4.4 (#2, Jan 3 2008, 13:36:28) >> [GCC 4.2.3 20071123 (prerelease) (Debian 4.2.2-4)] on linux2 >> Type "help", "copyright", "credits" or "license" for more information. >> >>> import statvfs >> >>> import os >> >>> os.statvfs('/')[statvfs.F_BSIZE] >> 4096 >> >>> os.statvfs('/')[statvfs.F_FRSIZE] >> 4096 > > I _really_ hate python for that. I was in the same situation with > shmutil.rmtree which I found after I finished writing my own function for > that. > > I think I'm gonna get an ebook that reads the python lib to me every > night :) Google is your friend. http://www.google.com/search?q=python+filesystem+blocksize The 2nd and 3rd entries tell you what you need to know. - -- Ron Johnson, Jr. Jefferson LA USA "I'm not a vegetarian because I love animals, I'm a vegetarian because I hate vegetables!" unknown -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFHi2tQS9HxQb37XmcRAm+nAJ4h600/93VxDSDCrAr26ABSWLtdNgCcCJ8d cd9EUaWr9f0ejmLVHPQL8u8= =nWnK -END PGP SIGNATURE- -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: find the blocksize of a FS
Ron Johnson wrote: > On 01/13/08 06:37, Martin Marcher wrote: >> On Saturday 12 January 2008 23:38 Jan C. Nordholz wrote: >> hmm looks like a starting point, I'm trying to get to that info with >> python, if all else fails I think the python ctypes module should be able >> to get that info thru the C interface. > > Well heck, that's easy. > > http://docs.python.org/lib/module-statvfs.html > http://docs.python.org/lib/os-file-dir.html#l2h-2700 > > $ python > Python 2.4.4 (#2, Jan 3 2008, 13:36:28) > [GCC 4.2.3 20071123 (prerelease) (Debian 4.2.2-4)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import statvfs > >>> import os > >>> os.statvfs('/')[statvfs.F_BSIZE] > 4096 > >>> os.statvfs('/')[statvfs.F_FRSIZE] > 4096 I _really_ hate python for that. I was in the same situation with shmutil.rmtree which I found after I finished writing my own function for that. I think I'm gonna get an ebook that reads the python lib to me every night :) martin -- http://noneisyours.marcher.name http://feeds.feedburner.com/NoneIsYours You are not free to read this message, by doing so, you have violated my licence and are required to urinate publicly. Thank you. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: find the blocksize of a FS
On 01/13/08 06:37, Martin Marcher wrote: On Saturday 12 January 2008 23:38 Jan C. Nordholz wrote: 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 ] #include ] 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 hmm looks like a starting point, I'm trying to get to that info with python, if all else fails I think the python ctypes module should be able to get that info thru the C interface. Well heck, that's easy. http://docs.python.org/lib/module-statvfs.html http://docs.python.org/lib/os-file-dir.html#l2h-2700 $ python Python 2.4.4 (#2, Jan 3 2008, 13:36:28) [GCC 4.2.3 20071123 (prerelease) (Debian 4.2.2-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import statvfs >>> import os >>> os.statvfs('/')[statvfs.F_BSIZE] 4096 >>> os.statvfs('/')[statvfs.F_FRSIZE] 4096 -- Ron Johnson, Jr. Jefferson LA USA "I'm not a vegetarian because I love animals, I'm a vegetarian because I hate vegetables!" unknown -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: find the blocksize of a FS
On Saturday 12 January 2008 23:38 Jan C. Nordholz wrote: > 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 > ] #include > ] 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 hmm looks like a starting point, I'm trying to get to that info with python, if all else fails I think the python ctypes module should be able to get that info thru the C interface. thanks -- http://noneisyours.marcher.name http://feeds.feedburner.com/NoneIsYours You are not free to read this message, by doing so, you have violated my licence and are required to urinate publicly. Thank you. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
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 ] #include ] 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 signature.asc Description: Digital signature
Re: find the blocksize of a FS
On 1/12/08, Martin Marcher <[EMAIL PROTECTED]> wrote: > 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. > martin -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
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? thanks martin -- http://noneisyours.marcher.name http://feeds.feedburner.com/NoneIsYours You are not free to read this message, by doing so, you have violated my licence and are required to urinate publicly. Thank you. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]