amd64/140134: msdosfs write and fsck destroy filesystem integrity

Dominic Fandrey kamikaze at bsdforen.de
Sat Oct 31 09:10:02 UTC 2009


>Number:         140134
>Category:       amd64
>Synopsis:       msdosfs write and fsck destroy filesystem integrity
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    freebsd-amd64
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct 31 09:10:01 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Dominic Fandrey
>Release:        RELENG_8
>Organization:
private
>Environment:
FreeBSD mobileKamikaze.norad 8.0-RC2 FreeBSD 8.0-RC2 #0: Sat Oct 31 02:49:30 CET 2009     root at mobileKamikaze.norad:/usr/obj/HP6510b-8/amd64/usr/src/sys/HP6510b-8  amd64
>Description:
Write operations on msdosfs causes all kinds of brokenness (e.g.: http://docs.freebsd.org/cgi/mid.cgi?4AE95C94.4040000 ). Lost clusters and the like.

fsck_msdosfs causes cross-linked files (at least according to Windows Vista chkdsk).

I can provide you with a broken image that was created as described in the following section.

Note that even a freshly created msdosfs file system is already broken.
>How-To-Repeat:
kamikaze at mobileKamikaze> dd bs=1m count=1024 < /dev/zero > test.msdosfs
1024+0 records in
1024+0 records out
1073741824 bytes transferred in 39.292063 secs (27327194 bytes/sec)
kamikaze at mobileKamikaze> mdconfig -f test.msdosfs
md0
kamikaze at mobileKamikaze> newfs_msdos -F32 md0
newfs_msdos: Cannot get number of sectors per track, Operation not supported
newfs_msdos: Cannot get number of heads, Operation not supported
newfs_msdos: trim 8 sectors to adjust to a multiple of 63
/dev/md0: 2096064 sectors in 65502 FAT32 clusters (16384 bytes/cluster)
bps=512 spc=32 res=32 nft=2 mid=0xf0 spt=63 hds=255 hid=0 bsec=2097144 bspf=512 rdcl=2 infs=1 bkbs=2
kamikaze at mobileKamikaze> fsck_msdosfs -y /dev/md0
** /dev/md0
** Phase 1 - Read and Compare FATs
** Phase 2 - Check Cluster Chains
** Phase 3 - Checking Directories
** Phase 4 - Checking for Lost Files
Free space in FSInfo block (-1) not correct (65501)
Fix? yes
Next free cluster in FSInfo block (2) not free
Fix? yes
1 files, 1048016 free (65501 clusters)
kamikaze at mobileKamikaze> mount_msdosfs /dev/md0 tmp/
kamikaze at mobileKamikaze> cd tmp/
kamikaze at mobileKamikaze> cp -rv ~/music/ogg/Kamikaze/Dio\ -\ 1983\ -\ Holy\ Diver ./
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver -> ./Dio - 1983 - Holy Diver
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/cover.jpg -> ./Dio - 1983 - Holy Diver/cover.jpg
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/02 - Dio - Holy Diver.ogg -> ./Dio - 1983 - Holy Diver/02 - Dio - Holy Diver.ogg
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/03 - Dio - Gypsy.ogg -> ./Dio - 1983 - Holy Diver/03 - Dio - Gypsy.ogg
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/04 - Dio - Caught In The Middle.ogg -> ./Dio - 1983 - Holy Diver/04 - Dio - Caught In The Middle.ogg
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/05 - Dio - Don't Talk To Strangers.ogg -> ./Dio - 1983 - Holy Diver/05 - Dio - Don't Talk To Strangers.ogg
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/06 - Dio - Straight Through The Heart.ogg -> ./Dio - 1983 - Holy Diver/06 - Dio - Straight Through The Heart.ogg
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/07 - Dio - Invisible.ogg -> ./Dio - 1983 - Holy Diver/07 - Dio - Invisible.ogg
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/08 - Dio - Rainbow In The Dark.ogg -> ./Dio - 1983 - Holy Diver/08 - Dio - Rainbow In The Dark.ogg
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/09 - Dio - Shame On The Night.ogg -> ./Dio - 1983 - Holy Diver/09 - Dio - Shame On The Night.ogg
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/10 - Dio - Interview Forming Own Band (Bonus Track).ogg -> ./Dio - 1983 - Holy Diver/10 - Dio - Interview Forming Own Band (Bonus Track).ogg
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/11 - Dio - Interview Vinnie Appice Leaving Sabbath (Bonus Track).ogg -> ./Dio - 1983 - Holy Diver/11 - Dio - Interview Vinnie Appice Leaving Sabbath (Bonus Track).ogg
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/12 - Dio - Interview Seeking Out A Guitarist (Bonus Track).ogg -> ./Dio - 1983 - Holy Diver/12 - Dio - Interview Seeking Out A Guitarist (Bonus Track).ogg
cp: ./Dio - 1983 - Holy Diver/13 - Dio - Interview Working In London (Bonus Track).ogg: Invalid argument
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/14 - Dio - Interview Release Timing Of Holy Diver (Bonus Track).ogg -> ./Dio - 1983 - Holy Diver/14 - Dio - Interview Release Timing Of Holy Diver (Bonus Track).ogg
cp: ./Dio - 1983 - Holy Diver/15 - Dio - Interview Writing While With Sabbath (Bonus Track).ogg: No space left on device
cp: ./Dio - 1983 - Holy Diver/16 - Dio - Interview Album Concept (Bonus Track).ogg: No space left on device
cp: ./Dio - 1983 - Holy Diver/17 - Dio - Interview Producing The Album Himself (Bonus Track).ogg: No space left on device
cp: ./Dio - 1983 - Holy Diver/18 - Dio - Interview Remembering The Tracks (Bonus Track).ogg: No space left on device
cp: ./Dio - 1983 - Holy Diver/19 - Dio - Interview Artwork.ogg: No space left on device
cp: ./Dio - 1983 - Holy Diver/01 - Dio - Stand Up And Shout.ogg: No space left on device
kamikaze at mobileKamikaze> ls
Dio - 1983 - Holy Diver
kamikaze at mobileKamikaze> df -h                             0 /home/kamikaze/tmp
Filesystem                                             Size    Used   Avail Capacity  Mounted on
/dev/ufs/2root                                         496M    287M    169M    63%    /
devfs                                                  1.0K    1.0K      0B   100%    /dev
/dev/ufs/2tmp                                          1.9G     14K    1.8G     0%    /tmp
/dev/ufs/2usr                                           38G     25G     10G    71%    /usr
/dev/ufs/2var                                          3.9G    2.4G    1.2G    67%    /var
/usr/home/root                                          38G     25G     10G    71%    /root
/dev/fuse0                                              49G     43G    6.5G    87%    /var/run/automounter.mnt/ntfs/2vault
/dev/md0                                               1.0G    1.0G   -160K   100%    /usr/home/kamikaze/tmp
kamikaze at mobileKamikaze> du -hd 0 Dio\ -\ 1983\ -\ Holy\ Diver/*
  0B	Dio - 1983 - Holy Diver/01 - Dio - Stand Up And Shout.ogg
6.8M	Dio - 1983 - Holy Diver/02 - Dio - Holy Diver.ogg
4.5M	Dio - 1983 - Holy Diver/03 - Dio - Gypsy.ogg
5.3M	Dio - 1983 - Holy Diver/04 - Dio - Caught In The Middle.ogg
6.3M	Dio - 1983 - Holy Diver/05 - Dio - Don't Talk To Strangers.ogg
5.6M	Dio - 1983 - Holy Diver/06 - Dio - Straight Through The Heart.ogg
6.5M	Dio - 1983 - Holy Diver/07 - Dio - Invisible.ogg
5.2M	Dio - 1983 - Holy Diver/08 - Dio - Rainbow In The Dark.ogg
6.5M	Dio - 1983 - Holy Diver/09 - Dio - Shame On The Night.ogg
4.8M	Dio - 1983 - Holy Diver/10 - Dio - Interview Forming Own Band (Bonus Track).ogg
2.5M	Dio - 1983 - Holy Diver/11 - Dio - Interview Vinnie Appice Leaving Sabbath (Bonus Track).ogg
3.5M	Dio - 1983 - Holy Diver/12 - Dio - Interview Seeking Out A Guitarist (Bonus Track).ogg
965M	Dio - 1983 - Holy Diver/13 - Dio - Interview Working In London (Bonus Track).ogg
864K	Dio - 1983 - Holy Diver/14 - Dio - Interview Release Timing Of Holy Diver (Bonus Track).ogg
  0B	Dio - 1983 - Holy Diver/15 - Dio - Interview Writing While With Sabbath (Bonus Track).ogg
  0B	Dio - 1983 - Holy Diver/16 - Dio - Interview Album Concept (Bonus Track).ogg
  0B	Dio - 1983 - Holy Diver/17 - Dio - Interview Producing The Album Himself (Bonus Track).ogg
  0B	Dio - 1983 - Holy Diver/18 - Dio - Interview Remembering The Tracks (Bonus Track).ogg
  0B	Dio - 1983 - Holy Diver/19 - Dio - Interview Artwork.ogg
128K	Dio - 1983 - Holy Diver/cover.jpg


Just for comparison on an ufs2 file system:
kamikaze at mobileKamikaze> cp -rv ~/music/ogg/Kamikaze/Dio\ -\ 1983\ -\ Holy\ Diver ./
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver -> ./Dio - 1983 - Holy Diver
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/cover.jpg -> ./Dio - 1983 - Holy Diver/cover.jpg
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/02 - Dio - Holy Diver.ogg -> ./Dio - 1983 - Holy Diver/02 - Dio - Holy Diver.ogg
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/03 - Dio - Gypsy.ogg -> ./Dio - 1983 - Holy Diver/03 - Dio - Gypsy.ogg
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/04 - Dio - Caught In The Middle.ogg -> ./Dio - 1983 - Holy Diver/04 - Dio - Caught In The Middle.ogg
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/05 - Dio - Don't Talk To Strangers.ogg -> ./Dio - 1983 - Holy Diver/05 - Dio - Don't Talk To Strangers.ogg
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/06 - Dio - Straight Through The Heart.ogg -> ./Dio - 1983 - Holy Diver/06 - Dio - Straight Through The Heart.ogg
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/07 - Dio - Invisible.ogg -> ./Dio - 1983 - Holy Diver/07 - Dio - Invisible.ogg
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/08 - Dio - Rainbow In The Dark.ogg -> ./Dio - 1983 - Holy Diver/08 - Dio - Rainbow In The Dark.ogg
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/09 - Dio - Shame On The Night.ogg -> ./Dio - 1983 - Holy Diver/09 - Dio - Shame On The Night.ogg
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/10 - Dio - Interview Forming Own Band (Bonus Track).ogg -> ./Dio - 1983 - Holy Diver/10 - Dio - Interview Forming Own Band (Bonus Track).ogg
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/11 - Dio - Interview Vinnie Appice Leaving Sabbath (Bonus Track).ogg -> ./Dio - 1983 - Holy Diver/11 - Dio - Interview Vinnie Appice Leaving Sabbath (Bonus Track).ogg
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/12 - Dio - Interview Seeking Out A Guitarist (Bonus Track).ogg -> ./Dio - 1983 - Holy Diver/12 - Dio - Interview Seeking Out A Guitarist (Bonus Track).ogg
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/13 - Dio - Interview Working In London (Bonus Track).ogg -> ./Dio - 1983 - Holy Diver/13 - Dio - Interview Working In London (Bonus Track).ogg
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/14 - Dio - Interview Release Timing Of Holy Diver (Bonus Track).ogg -> ./Dio - 1983 - Holy Diver/14 - Dio - Interview Release Timing Of Holy Diver (Bonus Track).ogg
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/15 - Dio - Interview Writing While With Sabbath (Bonus Track).ogg -> ./Dio - 1983 - Holy Diver/15 - Dio - Interview Writing While With Sabbath (Bonus Track).ogg
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/16 - Dio - Interview Album Concept (Bonus Track).ogg -> ./Dio - 1983 - Holy Diver/16 - Dio - Interview Album Concept (Bonus Track).ogg
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/17 - Dio - Interview Producing The Album Himself (Bonus Track).ogg -> ./Dio - 1983 - Holy Diver/17 - Dio - Interview Producing The Album Himself (Bonus Track).ogg
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/18 - Dio - Interview Remembering The Tracks (Bonus Track).ogg -> ./Dio - 1983 - Holy Diver/18 - Dio - Interview Remembering The Tracks (Bonus Track).ogg
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/19 - Dio - Interview Artwork.ogg -> ./Dio - 1983 - Holy Diver/19 - Dio - Interview Artwork.ogg
/home/kamikaze/music/ogg/Kamikaze/Dio - 1983 - Holy Diver/01 - Dio - Stand Up And Shout.ogg -> ./Dio - 1983 - Holy Diver/01 - Dio - Stand Up And Shout.ogg
kamikaze at mobileKamikaze> du -hd0 Dio\ -\ 1983\ -\ Holy\ Diver/*
4.1M	Dio - 1983 - Holy Diver/01 - Dio - Stand Up And Shout.ogg
6.8M	Dio - 1983 - Holy Diver/02 - Dio - Holy Diver.ogg
4.5M	Dio - 1983 - Holy Diver/03 - Dio - Gypsy.ogg
5.3M	Dio - 1983 - Holy Diver/04 - Dio - Caught In The Middle.ogg
6.3M	Dio - 1983 - Holy Diver/05 - Dio - Don't Talk To Strangers.ogg
5.6M	Dio - 1983 - Holy Diver/06 - Dio - Straight Through The Heart.ogg
6.5M	Dio - 1983 - Holy Diver/07 - Dio - Invisible.ogg
5.2M	Dio - 1983 - Holy Diver/08 - Dio - Rainbow In The Dark.ogg
6.6M	Dio - 1983 - Holy Diver/09 - Dio - Shame On The Night.ogg
4.8M	Dio - 1983 - Holy Diver/10 - Dio - Interview Forming Own Band (Bonus Track).ogg
2.5M	Dio - 1983 - Holy Diver/11 - Dio - Interview Vinnie Appice Leaving Sabbath (Bonus Track).ogg
3.5M	Dio - 1983 - Holy Diver/12 - Dio - Interview Seeking Out A Guitarist (Bonus Track).ogg
528K	Dio - 1983 - Holy Diver/13 - Dio - Interview Working In London (Bonus Track).ogg
880K	Dio - 1983 - Holy Diver/14 - Dio - Interview Release Timing Of Holy Diver (Bonus Track).ogg
992K	Dio - 1983 - Holy Diver/15 - Dio - Interview Writing While With Sabbath (Bonus Track).ogg
2.3M	Dio - 1983 - Holy Diver/16 - Dio - Interview Album Concept (Bonus Track).ogg
2.9M	Dio - 1983 - Holy Diver/17 - Dio - Interview Producing The Album Himself (Bonus Track).ogg
 17M	Dio - 1983 - Holy Diver/18 - Dio - Interview Remembering The Tracks (Bonus Track).ogg
1.6M	Dio - 1983 - Holy Diver/19 - Dio - Interview Artwork.ogg
124K	Dio - 1983 - Holy Diver/cover.jpg

>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-amd64 mailing list