This post originated from an RSS feed registered with Ruby Buzz
by Daniel Berger.
Original Post: sys-filesystem, inodes, windows
Feed Title: Testing 1,2,3...
Feed URL: http://djberg96.livejournal.com/data/rss
Feed Description: A blog on Ruby and other stuff.
A while back a guy by the name of Mike Hall had a package out there called "filesystem" that was a pretty basic wrapper for statvfs and getmntent(). Unfortunately, Mike is now AWOL and so is the package.
So, I've been working on sys-filesystem, which will do what Mike's old package did and more. I'm spending more time working out a common interface for UNIX and Windows than anything else, which is more difficult than you might think.
One bit of incompatibility for a statvfs is that the Windows filesystem doesn't have the concept of an inode. I thought I could work around this and get a good approximation of the f_files struct member. My plan was to create a tiny partition, create as many small files as I could until Windows told me there was a problem, and calculate the number of files by dividing the total space of the partition by the number of files that were created.
Except, it doesn't work.
The first problem is that Windows reserves a fraction of the partition for, well, I don't know what. In my 8192512 byte partition, Windows reserved 13824 bytes for itself. That left 8178688 bytes. With a block size of 512 I should theoretically be able to create 15974 files. In reality I was only able to create 4174.
Lessee...8178688 divided by 4174 is...1959.43. So, either Windows is lying to me about the block size or my brilliant plan just doesn't work. I'm guessing the latter.
And this, boys and girls, is where I simply nod my head when the many, many experts I found online say you cannot reliably determine how many files a Windows partition can hold.