lkml.org 
[lkml]   [2005]   [May]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectstatfs returns wrong values for 250Gb FAT fs
On Sat, May 07, 2005 at 06:24:29PM +0100, Carlos Rodrigues wrote:
> Package: kernel-image-2.6.8-2-386
> Version: 2.6.8-13
> Severity: important
>
>
> I have a 250Gb external USB 2.0 hard-drive formatted with FAT32 and "df"
> always reports 64Kb of used space on it, although it contains a couple of
> gigabytes.
>
> At first I thought the problem might be in "df" itself, but the following
> test code proves the statfs function is to blame. The values returned are
> incorrect.
>
> However, it does report correct values for another FAT32 partition I have
> (70Gb).
>
>
> ----------- statfs.c -----------
>
> #include <sys/vfs.h>
>
>
> int main(int argc, char *argv[])
> {
> struct statfs stats;
> long used;
> int kib;
>
> if (argc < 2) {
> printf("USAGE: %s <mountpoint>\n", argv[0]);
>
> return 1;
> }
>
> statfs(argv[1], &stats);
> used = stats.f_blocks - stats.f_bfree;
>
> printf("f_bsize = %ld blocks\nf_blocks = %ld blocks\nf_bfree = %ld blocks\nused = %ld blocks\n",
> stats.f_bsize, stats.f_blocks, stats.f_bfree, used);
>
> kib = stats.f_bsize / 1024;
> printf("total = %ld KiB\nfree = %ld KiB\nused = %ld KiB\n",
> kib * stats.f_blocks,
> kib * stats.f_bfree,
> kib * used);
>
> return 0;
> }
>
> ----------- eof - statfs.c -----------

Carlos,

this looks like it could be an issue with the fat file system
handling a somewhat large filesystem. I have CCed the maintainer
for comment. I have looked through most of the changes made
to fat and vfat since 2.6.8.1 and I wasn't able to see anything
there that looked like it would help your cause.

--
Horms
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-05-10 10:44    [W:0.501 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site