statfs returns wrong values for 250Gb FAT fs

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

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux