Date: Sun, 6 Dec 2009 13:55:47 +0100 From: Guido van Rooij <guido@gvr.org> To: freebsd-fs@freebsd.org Subject: Problem with ntfs and media sector size 1024 Message-ID: <20091206125547.GA24918@gvr.gvr.org>
next in thread | raw e-mail | index | archive | help
I am running 6-stable and cannot mount an NTFS on a disk with a 1024-byte sector size. The disk: beck# geom disk list da1 Geom name: da1 Providers: 1. Name: da1 Mediasize: 500107862016 (466G) Sectorsize: 1024 Mode: r0w0e0 fwsectors: 63 fwheads: 255 beck# fdisk /dev/da1 ******* Working on device /dev/da1 ******* parameters extracted from in-core disklabel are: cylinders=30400 heads=255 sectors/track=63 (16065 blks/cyl) Figures below won't work with BIOS for partitions not in cyl 1 parameters to be used for BIOS calculations are: cylinders=30400 heads=255 sectors/track=63 (16065 blks/cyl) Media sector size is 1024 Warning: BIOS sector numbering starts with sector 1 Information from DOS bootblock is: The data for partition 1 is: sysid 7 (0x07),(OS/2 HPFS, NTFS, QNX-2 (16 bit) or Advanced UNIX) start 63, size 488375937 (476929 Meg), flag 0 beg: cyl 0/ head 1/ sector 1; end: cyl 1023/ head 254/ sector 63 The data for partition 2 is: <UNUSED> The data for partition 3 is: <UNUSED> The data for partition 4 is: <UNUSED> When I try to mount the ntfs, I get: ntfs_mountfs(): bps: 1024, spc: 4, media: f8, mftrecsz: 246 (1 sects) ntfs_mountfs(): mftcn: 0xc0000|0x3a380d0 ntfs_mountfs(): case-sens., uid: 0, gid: 0, mode: 755 ntfs_vgetex: ino: 0, attr: 0x80:, lkf: 0x2, f: 0x0 ntfs_ntlookup: looking for ntnode 0 ntfs_ntget: get ntnode 0: 0xc7bdc500, usecount: 0 ntfs_ntlookup: ntnode 0: 0xc7bdc500, usecount: 1 ntfs_loadntnode: loading ino: 0 ntfs_loadntnode: read system node ntfs_loadntnode: bn: 3145728 ntfs_procfixups: magic doesn't match: 421f128f != 454c4946 ntfs_loadntnode: BAD MFT RECORD 0 ntfs_vget: CAN'T LOAD ATTRIBUTES FOR INO: 0 ntfs_ntput: rele ntnode 0: 0xc7bdc500, usecount: 1 ntfs_ntput: deallocating ntnode: 0 Note: bn: 3145728 is an additional debug printf I inserted just before the first bread in ntfs_loadntnode(). When I dd this block (using a bs=1k), I get a block with the correct ntfs magic: > dd if=/dev/da1s1 bs=1k skip=3145728 count=1 of=/tmp/1 1+0 records in 1+0 records out 1024 bytes transferred in 0.000735 secs (1393113 bytes/sec) > hexdump /tmp/1 | head -2 0000000 4946 454c 0030 0003 0ef9 0200 0000 0000 0000010 0001 0001 0038 0001 0198 0000 0400 0000 However: > dd if=/dev/da1s1 bs=1k skip=1572864 count=1 of=/tmp/2 1+0 records in 1+0 records out 1024 bytes transferred in 0.000732 secs (1399012 bytes/sec) > hexdump /tmp/2 | head -2 0000000 128f 421f 0b99 36e7 5e54 4062 cb2c ddd0 0000010 bdba 6c0e d690 aa5a d22e 2a30 cea2 b08e Note that this is exactly the wrong magic reported in the line: ntfs_procfixups: magic doesn't match: 421f128f != 454c4946 Note also the 1572864 * 2 = 3145728 I have tried to understand what is going on, and it seems that something is wrong in the following lines: bn = ntfs_cntobn(ntmp->ntm_mftcn) + ntmp->ntm_bpmftrec * ip->i_number; error = bread(ntmp->ntm_devvp, bn, ntfs_bntob(ntmp->ntm_bpmftrec), NOCRED, &bp); In bread, we see that the blocknumber passed is mulitplie by the statfs f_iosize value. I this case that is 4K, however, I think that blocknumbers are 1K in size. That gives a factor 4 though... Anyone with some fs internal clues on what might be wrong? -Guido
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091206125547.GA24918>