Bug 121198

Summary: writing to vfat bug in kernel OR fsck.vfat broken?
Product: [Fedora] Fedora Reporter: Kevin Range <range006>
Component: dosfstoolsAssignee: Peter Vrabec <pvrabec>
Status: CLOSED NOTABUG QA Contact: Ben Levenson <benl>
Severity: low Docs Contact:
Priority: medium    
Version: 1CC: tmraz
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-12-10 08:25:31 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Kevin Range 2004-04-18 21:07:15 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5)
Gecko/20031007 Firebird/0.7

Description of problem:
I a usb-storage device with a 40GB FAT32 formated disk in it.  When
ever I write to it and then run fsck.vfat on it I get:

FATs differ but appear to be intact. Use which FAT ?

Woe unto you if you choose the second FAT.  You will usually lose all
of the files you just added.  If you choose the first FAT everything
is fine.  All of my files seem to be there... 

Version-Release number of selected component (if applicable):
dosfstools-2.8-11

How reproducible:
Always

Steps to Reproduce:
1. Copy a bunch of files to USB device
2. unmount it
3. run fsck.vfat on the device
    

Actual Results:  [root@cheddar root]# fsck.vfat -vr /dev/sda1
dosfsck 2.8 (28 Feb 2001)
dosfsck 2.8, 28 Feb 2001, FAT32, LFN
Warning: FAT32 support is still ALPHA.
Boot sector contents:
System ID "DIVER100"
Media byte 0xf8 (hard disk)
       512 bytes per logical sector
      8192 bytes per cluster
        32 reserved sectors
First FAT starts at byte 16384 (sector 32)
         2 FATs, 32 bit entries
  19534848 bytes per FAT (= 38154 sectors)
Root directory start at cluster 2 (arbitrary size)
Data area starts at byte 39086080 (sector 76340)
   4878986 data clusters (1313947648 bytes)
63 sectors/track, 255 heads
        32 hidden sectors
  78140128 sectors total
FATs differ but appear to be intact. Use which FAT ?
1) Use first FAT
2) Use second FAT
? 1
Checking for unused clusters.
Checking free cluster summary.
Perform changes ? (y/n) y
/dev/sda1: 3339 files, 576498/4878986 clusters


Expected Results:  fsck.vfat would tell me all is well.

Additional info:

Comment 2 Karel Zak 2004-12-09 16:18:37 UTC
# fdisk -l /dev/sda

Disk /dev/sda: 3253 MB, 3253469184 bytes
128 heads, 63 sectors/track, 788 cylinders
Units = cylinders of 8064 * 512 = 4128768 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         533     2149024+  83  Linux
/dev/sda2             534         788     1028160    b  W95 FAT32

#fsck.vfat -vr /dev/sda2
dosfsck 2.8 (28 Feb 2001)
dosfsck 2.8, 28 Feb 2001, FAT32, LFN
Warning: FAT32 support is still ALPHA.
There are differences between boot sector and its backup.
Differences: (offset:original/backup)
  65:01/00
1) Copy original to backup
2) Copy backup to original
3) No action
?
^^^^^^^^^^^^
problem

# mkfs.vfat /dev/sda2
mkfs.vfat 2.8 (28 Feb 2001)

# fsck.vfat /dev/sda2
dosfsck 2.8, 28 Feb 2001, FAT32, LFN
Warning: FAT32 support is still ALPHA.
/dev/sda2: 0 files, 1/256534 clusters

# mount -t vfat /dev/sda2 /mnt/usb
# cp -fR /usr/share/doc/rpm-devel-4.3.2 /mnt/usb
# umount /mnt/usb
# fsck.vfat /dev/sda2
dosfsck 2.8, 28 Feb 2001, FAT32, LFN
Warning: FAT32 support is still ALPHA.
/dev/sda2: 674 files, 5343/256534 clusters

It looks a problem fix rebuild filesystem on your device. The current
fcsk.vfat is probably not compatible with older version(s).