LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 01-05-2009, 01:45 PM   #1
moob8
Member
 
Registered: Sep 2006
Distribution: slackware
Posts: 132

Rep: Reputation: 15
thumb drive appears as CD Rom


Note: I used google already. I searched the web already. I searched these forums. I only post here when all the usual solutions don't work.

I know how to write udev rules. I have an external hard drive, a zip drive, a cheap camera that mounts as if it were a small hard drive. And they all mount nicely with custom dev names, etc.

The actual problem

I recently got a thumb drive aka key drive (aka little bitty thing you stick onto your computer and it's got memory and you can use it as a harddrive).

Running Slackware 12.1

Udev rule:
Code:
SUBSYSTEMS=="usb", ATTRS{product}=="U3 Cruzer Micro", ATTRS{manufacturer}=="SanDisk", KERNEL=="sr?",
 NAME="%k", SYMLINK="thumbdrive_4gig"
I created a mount point (named /mnt/4gig)

relavant entry in fstab:
Code:
/dev/thumbdrive_4gig /mnt/4gig     vfat      noauto,users    0   0
Code:
$ mount /mnt/4gig
mount: block device /dev/sr1 is write-protected, mounting read-only
mount: wrong fs type, bad option, bad superblock on /dev/sr1,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

$
Code:
$ dmesg | tail
end_request: I/O error, dev sr1, sector 196600
printk: 118 messages suppressed.
Buffer I/O error on device sr1, logical block 49150
sr 7:0:0:1: [sr1] Result: hostbyte=0x00 driverbyte=0x08
sr 7:0:0:1: [sr1] Sense Key : 0x0 [current] 
sr 7:0:0:1: [sr1] ASC=0x0 ASCQ=0x0
end_request: I/O error, dev sr1, sector 196600
Buffer I/O error on device sr1, logical block 49150
FAT: bogus number of reserved sectors
VFS: Can't find a valid FAT filesystem on dev sr1.
"Cat /dev/sr1 | xxd | less" does reveal a file system, so something is screwy in udev-land.

cfdisk indicates that sr1 is a read only device and won't show a partition table.

So, Trial and Error having failed, it seemed about time to get into some OverKill to fix matters:
Code:
 # mke2fs /dev/sr1
mke2fs 1.40.8 (13-Mar-2008)
/dev/sr1: Read-only file system while setting up superblock
 #
and then ...
Code:
cat /dev/urandom > /dev/sr1
That failed: the device is really read only.

Help! Panic! WTF? Should I just return the drive?

Last edited by moob8; 01-05-2009 at 01:46 PM. Reason: moon over moskow
 
Old 01-05-2009, 02:50 PM   #2
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
you have gotten hold of a very special class of device which identifies itself as more than one device. These USB sticks can be used on windows to allow autorun.inf files to be loaded on inserting the device. It uses some sort of software or firmware plus a special boot sector. What is happening is that the first partition of the drive identifies itself as a CD ROM -hence read-only. Read up by following a couple of links from below:
http://clusty.com/search?input-form=...s&query=USB+U3

You should be able to access the seconf partition normally unless I am mistaken, but you may not be able to access the first one -I'm not even sure if you can wipe it out with dd, but you could try that in the end. **But**, before you do, make a backup of the bootsector! In fact, I'd love it if you'd send me a copy of the bootsector.
The reason I know about these drives is that, when they first came out, I was approached by someone about creating a special kind of stick which would contain a small linux distro in the second partition. In the first partition it would have some windows-compatible programs and/or *.bat files which would be launched by the autorun.inf file whenever the stick was inserted in a Windows box. the point was to have the stick setup the windows box as a dual boot machine. well the project never materialized -I had most of the setup already working with my AmigoXP distro, but the well-heeled fellow(really) never wanted to part with any cash or even drop by to see the thing in action. Anyway, I never got my hands on one of the devices but always wanted to have alook at the bootsector code to see how it was passing itsef off as an optical device.
dd if=/dev/sr1 of=boot.sector bs=512 count=1 should get the first sector out of it.
I'd appreciate having a copy :-)

If you have access to a windows machine, you should be able to run some included software which will let you manage that feature -changing the soze of the frist partition etc. My would-be benefactor(?) really had a great idea and I really had the way to make it work -back then he was still waiting for the price to drop below $70-$80 to make it feasible. All he ever offered me was to pay my broadband connection so I could upload a ready-to-use image which the manufacturer would then simply *flash* onto the drives. I wanted a little more than what he offered, so we never went anywhere with it -sound familiar?
 
Old 01-05-2009, 05:47 PM   #3
rworkman
Slackware Contributor
 
Registered: Oct 2004
Location: Tuscaloosa, Alabama (USA)
Distribution: Slackware
Posts: 2,559

Rep: Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351
Quote:
Originally Posted by moob8 View Post
Udev rule:
Code:
SUBSYSTEMS=="usb", ATTRS{product}=="U3 Cruzer Micro", ATTRS{manufacturer}=="SanDisk", KERNEL=="sr?",
 NAME="%k", SYMLINK="thumbdrive_4gig"
...
Should I just return the drive?
Unless something's changed since I last checked, you *have* to disable the U3 stuff in a Windows machine before that thing's usable in linux.

I've got one here that I've been meaning to play with and find out if there's a good way to circumvent it, but I haven't gotten around to it yet.
 
Old 01-05-2009, 05:48 PM   #4
rworkman
Slackware Contributor
 
Registered: Oct 2004
Location: Tuscaloosa, Alabama (USA)
Distribution: Slackware
Posts: 2,559

Rep: Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351
Quote:
Originally Posted by gnashley View Post
You should be able to access the seconf partition normally unless I am mistaken, but you may not be able to access the first one -I'm not even sure if you can wipe it out with dd, but you could try that in the end. **But**, before you do, make a backup of the bootsector! In fact, I'd love it if you'd send me a copy of the bootsector.
I'll make a copy of the one I have and get it to you.
 
Old 01-05-2009, 07:15 PM   #5
drumz
Member
 
Registered: Apr 2005
Location: Oklahoma, USA
Distribution: Slackware
Posts: 905

Rep: Reputation: 694Reputation: 694Reputation: 694Reputation: 694Reputation: 694Reputation: 694
rworkman is right. In windows it shows up as both a CD drive and a USB drive. You can download an uninstaller from their website (which you have to run in windows). After that it appears as a normal USB drive.
 
Old 01-05-2009, 07:55 PM   #6
rworkman
Slackware Contributor
 
Registered: Oct 2004
Location: Tuscaloosa, Alabama (USA)
Distribution: Slackware
Posts: 2,559

Rep: Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351
gnashley, here you are: http://rlworkman.net/SDCZ6-4096RB/ (that's the model number of the drive). Just for clarity's sake, I have two of these - one of them has the U3 crap removed, and the one whose information is posted above was just unwrapped.
 
Old 01-06-2009, 02:36 AM   #7
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
Thanks, Robby. I just always had the idea to see what 'magic' was being done with the bootsector to make the thing appears as a CD. I think it's interesting -like what the maekbootfat tool does to create a bootsector which can appear as USB-FDD or USB-HDD.
I've downloaded the bootsectors you provided.
 
Old 01-06-2009, 08:38 PM   #8
moob8
Member
 
Registered: Sep 2006
Distribution: slackware
Posts: 132

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by gnashley View Post
If you have access to a windows machine, you should be able to run some included software which will let you manage that feature -changing the soze of the frist partition etc.
Yup: that was it. Managed to get to a machine in windows and it was as you described. Sorry, didn't get a dd of the "before" state.
 
Old 01-07-2009, 01:56 AM   #9
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
That's okay, rworkman made it(them) available from one of his drives.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using a usb thumb drive or flash drive as a swap partition. stevenjoseph Linux - Hardware 8 01-16-2012 12:09 PM
nothing appears in CDrom drive broom Linux - Hardware 8 01-18-2007 12:13 AM
Thumb Drive dudeman41465 Linux - Hardware 2 11-20-2005 01:02 AM
thumb drive iarebob Slackware 5 02-01-2005 03:33 PM
Cant get thumb drive to work sdat1333 Fedora 13 11-29-2004 01:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 08:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration