Tugger the SLUGger!SLUG Mailing List Archives

[SLUG] Pocket Disk USB flash drive and Linux


I bought myself a 64MB "Pocket Disk" USB compact flash `disk drive'.
It says it's supported under Linux (2.4.0 or above), but doesn't give
details.

Executive summary:  works fine.

Geek summary:       mount /dev/sda1 -t vfat /mnt/tmp.  (And, don't play
                    with new geek toys on 2 hours of sleep.)

In section 3.3 in the installation manual, it says:

    "For Mac OS and Linux
    
    It is very easy and simple for these two operating systems.  Just plug
    in the Pocket Disk into the USB port and it will be automatically
    detected by the computer.  No driver is required."
    
Plugging it in, the device *is* automatically detected:

# cat /proc/scsi/usb-storage-0/1
   Host scsi1: usb-storage
       Vendor: JMTek
      Product: USBDrive
Serial Number: None
     Protocol: Transparent SCSI
    Transport: Bulk
         GUID: 0c7600030000000000000000
     Attached: Yes

And cdrecord -scanbus reports it as:

[...]
scsibus1:
        1,0,0   100) 'RiteLink' ' mass storage   ' '1.00' Removable Disk


At first I thought it might appear to be a CDRW drive for some reason,
so I wasted quite a while trying to work out what the mappings between
device names reported by cdrecord are as Linux device files.  (E.g.
dev=0,0,0 == /dev/scd0, dev=0,1,0 == /dev/scd1.)  But those devices
stop at scd7, and that only covers scsibus0.  I couldn't find out how
to map scsibus1 dev names to Linux device names.

Not that that matters, I guess, since it was a wild goose chase.

I could read raw data off it as /dev/sda, and did an fdisk (l) on
/dev/sda, which reported the partition type as FAT16. But when I try to
mount it as a FAT file system, mount failed:

# mount /dev/sda -t vfat /mnt/tmp
mount: wrong fs type, bad option, bad superblock on /dev/sda,
       or too many mounted file systems

(Alert readers will have already spotted my mistake.  My excuse is lack
of sleep after returning from Hong Kong, where I bought it for about
$75 dollars Australian, incidentally.)

/var/log/messages showed:

For -t vfat:

May 19 23:18:43 posh kernel: FAT: bogus logical sector size 20487
May 19 23:18:43 posh kernel: VFS: Can't find a valid FAT filesystem on dev 08:00.

And fdisk told me:

 Command (m for help): p

Disk /dev/sda: 3 heads, 42 sectors, 1010 cylinders
Units = cylinders of 126 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/sda1   *         1      1011     63632    6  FAT16
Partition 1 has different physical/logical beginnings (non-Linux?):
     phys=(0, 1, 1) logical=(0, 0, 33)
Partition 1 has different physical/logical endings:
     phys=(964, 17, 32) logical=(1010, 0, 36)
Partition 1 does not end on cylinder boundary:
     phys=(964, 17, 32) should be (964, 2, 42)

Eventually my other brain cell woke up, and I realised that I should
have been mounting partition 1, not the raw drive:

# mount /dev/sda1 -t vfat /mnt/tmp

So, it works fine as advertised.  I just added this to /etc/fstab for
extra convenience:

/dev/sda1       /mnt/cf         vfat    user,noauto,gid=52,umask=007    0 0

Though I note in passing that it's not obvious which of the many fdisk
partition types match which kernel modules or which mount file system
name types, either.

 0  Empty           1b  Hidden Win95 FA 64  Novell Netware  bb  Boot Wizard hid
 1  FAT12           1c  Hidden Win95 FA 65  Novell Netware  c1  DRDOS/sec (FAT-
 2  XENIX root      1e  Hidden Win95 FA 70  DiskSecure Mult c4  DRDOS/sec (FAT-
 3  XENIX usr       24  NEC DOS         75  PC/IX           c6  DRDOS/sec (FAT-
 4  FAT16 <32M      39  Plan 9          80  Old Minix       c7  Syrinx         
 5  Extended        3c  PartitionMagic  81  Minix / old Lin da  Non-FS data    
 6  FAT16           40  Venix 80286     82  Linux swap      db  CP/M / CTOS / .
 7  HPFS/NTFS       41  PPC PReP Boot   83  Linux           de  Dell Utility   
 8  AIX             42  SFS             84  OS/2 hidden C:  df  BootIt         
 9  AIX bootable    4d  QNX4.x          85  Linux extended  e1  DOS access     
 a  OS/2 Boot Manag 4e  QNX4.x 2nd part 86  NTFS volume set e3  DOS R/O        
 b  Win95 FAT32     4f  QNX4.x 3rd part 87  NTFS volume set e4  SpeedStor      
 c  Win95 FAT32 (LB 50  OnTrack DM      8e  Linux LVM       eb  BeOS fs        
 e  Win95 FAT16 (LB 51  OnTrack DM6 Aux 93  Amoeba          ee  EFI GPT        
 f  Win95 Ext'd (LB 52  CP/M            94  Amoeba BBT      ef  EFI (FAT-12/16/
10  OPUS            53  OnTrack DM6 Aux 9f  BSD/OS          f1  SpeedStor      
11  Hidden FAT12    54  OnTrackDM6      a0  IBM Thinkpad hi f4  SpeedStor      
12  Compaq diagnost 55  EZ-Drive        a5  BSD/386         f2  DOS secondary  
14  Hidden FAT16 <3 56  Golden Bow      a6  OpenBSD         fd  Linux raid auto
16  Hidden FAT16    5c  Priam Edisk     a7  NeXTSTEP        fe  LANstep        
17  Hidden HPFS/NTF 61  SpeedStor       b7  BSDI fs         ff  BBT            
18  AST SmartSleep  63  GNU HURD or Sys b8  BSDI swap      

luke