Subject: msdosfs size limitations
To: None <tech-kern@netbsd.org>
From: Darrin B. Jewell <dbj@netbsd.org>
List: tech-kern
Date: 04/07/2003 01:32:09
I have a 250gb maxtor usb/firewire hard drive.  It came
preformatted with a msdos FAT32 filesystem.  Attempting to mount
it returns EINVAL.  Is anyone working on removing this limitation?
Is there a good reason why this is hard?

A quick search for EINVAL in msdosfs_mountfs reveals a comment
which may (or may not) be related:

  if (pmp->pm_HugeSectors > 0xffffffff / dirsperblk + 1) {
     /*
      * We cannot deal currently with this size of disk
      * due to fileid limitations (see msdosfs_getattr and
      * msdosfs_readdir)
      */
     error = EINVAL;
     goto error_exit;
  }

If anyone is interested in looking at this, i'm happy to provide
an image of the start of the filesystem or other information
useful for debugging.

Thanks,
Darrin

The following is selected output from dmesg:

  umass0 at uhub0 port 1 configuration 1 interface 0
  umass0: Maxtor 5000XT v01.00.00, rev 2.00/1.00, addr 2
  umass0: using SCSI over Bulk-Only
  scsibus0 at umass0: 2 targets, 1 lun per target
  scsibus0: waiting 2 seconds for devices to settle...
  scsipi_inqmatch: 2/0/0 <, , >
  sd0 at scsibus0 target 1 lun 0: <Maxtor, 5000XT v01.00.00, 0100> disk fixed
  sd0: mode sense (5) returned nonsense; using fictitious geometry
  sd0: 233 GB, 239371 cyl, 64 head, 32 sec, 512 bytes/sect x 490232832 sectors

The following is output from disklabel:

# disklabel sd0
  # /dev/rsd0c:
  type: SCSI
  disk: 5000XT v01.00.0
  label: fictitious
  flags:
  bytes/sector: 512
  sectors/track: 32
  tracks/cylinder: 64
  sectors/cylinder: 2048
  cylinders: 239371
  total sectors: 490232832
  rpm: 3600
  interleave: 1
  trackskew: 0
  cylinderskew: 0
  headswitch: 0           # microseconds
  track-to-track seek: 0  # microseconds
  drivedata: 0 
  
  3 partitions:
  #        size    offset     fstype  [fsize bsize cpg/sgs]
   a: 490223412        63      MSDOS                      # (Cyl.    0*- 239366*)
   c: 490232832         0     unused      0     0         # (Cyl.    0 - 239371*)
  disklabel: boot block size 0
  disklabel: super block size 0
  
The following is output from fdisk:

# fdisk sd0c
  Disk: /dev/rsd0c
  NetBSD disklabel disk geometry:
  cylinders: 239371 heads: 64 sectors/track: 32 (2048 sectors/cylinder)
  
  BIOS disk geometry:
  cylinders: 239371 heads: 64 sectors/track: 32 (2048 sectors/cylinder)
  
  Partition table:
  0: sysid 12 (Primary DOS with 32 bit FAT - LBA)
      start 63, size 490223412 (239366 MB), flag 0x80
          beg: cylinder    0, head   1, sector  1
          end: cylinder  818, head 254, sector 63
  1: <UNUSED>
  2: <UNUSED>
  3: <UNUSED>

The following is output from fsck:

# fsck -n /dev/rsd0a
  ** /dev/rsd0a
  ** Phase 1 - Read and Compare FATs
  No space for FAT (Cannot allocate memory)

The following is output from mount:

# mount -v /dev/sd0a /mnt
  exec: mount_msdos /dev/sd0a /mnt
  mount_msdos: /dev/sd0a on /mnt: Invalid argument