public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Horms <horms@debian.org>
To: Carlos Rodrigues <carlos.efr@mail.telepac.pt>, 308072@bugs.debian.org
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>,
	linux-kernel@vger.kernel.org
Subject: statfs returns wrong values for 250Gb FAT fs
Date: Tue, 10 May 2005 17:09:07 +0900	[thread overview]
Message-ID: <20050510080907.GR1998@verge.net.au> (raw)
In-Reply-To: <E1DUT2T-0000fm-Nx@localhost.localdomain>

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

       reply	other threads:[~2005-05-10  8:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1DUT2T-0000fm-Nx@localhost.localdomain>
2005-05-10  8:09 ` Horms [this message]
2005-05-10 12:00   ` statfs returns wrong values for 250Gb FAT fs OGAWA Hirofumi
2005-05-10 20:34     ` Carlos Rodrigues
2005-05-11 12:23       ` Paul Ionescu
2005-05-12 20:32         ` OGAWA Hirofumi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050510080907.GR1998@verge.net.au \
    --to=horms@debian.org \
    --cc=308072@bugs.debian.org \
    --cc=carlos.efr@mail.telepac.pt \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox