LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-16-2006, 09:50 AM   #1
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 7,569

Rep: Reputation: 696Reputation: 696Reputation: 696Reputation: 696Reputation: 696Reputation: 696
Unhappy Usb-storage device nodes?


I'm no noob, but this is a newbie type question.

I want to occasionally use a usb
drive. I can't mount the @$! thing. Can somebody fill in the gaps for me on

mount ________ -t ________ /mnt

Kernels are
2.6.9 in CentOS-4.2 (Just installed - but I can't find anything yet)
with, I presume, hotplug & udev running

2.6.12.1 in Linuxfromscratch-5.0. No Hotplug. No udev
cdrecording is set up here, with /dev/sg0 --> /dev/hdc
and /dev/sg1 -->/dev/hdd

2.6.14.3 in HLFS (beta) with hotplug, and udev.

Linuxfromscratch is a DIY system. If I can't find it, I get laughed at by my kids who are windoze nerds

Thanks
 
Old 02-16-2006, 10:22 AM   #2
cotton
LQ Newbie
 
Registered: Jun 2005
Posts: 12

Rep: Reputation: 0
Have you checked if it's being recognized as a scsi drive? Try:

mount /dev/sda1 -t auto /mnt/whatever
 
Old 02-16-2006, 11:46 AM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
Plug in the usb device when monitoring the logs and see what messages come up.
 
Old 02-17-2006, 10:16 AM   #4
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 7,569

Original Poster
Rep: Reputation: 696Reputation: 696Reputation: 696Reputation: 696Reputation: 696Reputation: 696
Unhappy

I actually found it in the centos as /dev/sda just after posting.
But nothing is set up there - it's a vanilla install.
Sorry for not getting back sooner.

Linuxfromscratch is a slightly different issue, because I have to boot it with acpi=off, hotplug does nothing, udev isn't installed and I have to do it by hand. I have tried

modprobe usb-storage
mount /dev/sda /mnt
mount /dev/sda1 /mnt
mount /dev/scd /mnt
mount /dev/scd0 /mnt
mount /dev/scd1 /mnt
ls /dev/usb - nothing there
ls /dev/input - keyboard & mouse

And I heard of some kernel mod which changed the locations of all these things around
I'm in 2.6.12.1 with one kernel, and 2.6.14.3 on another. And these heads never write anything except emails and programs in C, python, or perl.

But my jeering kids kids ("Crank up another kernel, Dad") running XP ran into trouble. One of them had to reinstall windows, and it wiped his disk :-P. THAT shut them up for a bit.
 
Old 02-17-2006, 11:15 AM   #5
cotton
LQ Newbie
 
Registered: Jun 2005
Posts: 12

Rep: Reputation: 0
what is mount telling you when you try to mount it? Some kind of error message, or is it just saying nothing? And this is a weird question, but is there a reason why you're mounting it stright in /mnt and not like /mnt/usb or something?
 
Old 02-18-2006, 03:34 AM   #6
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
What does "lsmod" | grep usbcore" reveal.

usbcore 140596 5 usbhid,ehci_hcd,ohci_hcd
You may need to modprobe ehci_hcd or ohci_hcd. It may depend on which USB is supported on that port and on the device.
You said that plugging in the device that a reference was made to "sda" but you didn't supply the pertanent log entries, so we don't know which module or service wrote the message.
If you aren't using udev and hotplug, then you will need to mount it yourself. You are not using the correct mount command, and you are trying to mount the device instead of a partition on the device.

If the usbdrive is formatted using fat32, then use the vfat filesystem in the mount command.
First check if vfat is supported by the kernel:
cat /proc/filesystems
If vfat isn't listed, then as root "modprobe vfat" to load the vfat.ko kernel module.

Now take a look at the filesystem on the device:
> sudo /sbin/fdisk -l /dev/sda

Disk /dev/sda: 128 MB, 128450048 bytes
8 heads, 32 sectors/track, 979 cylinders
Units = cylinders of 256 * 512 = 131072 bytes

Device Boot Start End Blocks Id System
/dev/sda1 1 979 125263+ 6 FAT16

The device to mount is /dev/sda1 in this example.
You will need a place to mount it. The standard location for mounting removable devices is under /media, so I will use that in this example:
sudo mkdir /media/usbdisk/
sudo mount -t vfat /dev/sda1 /media/usbdisk -o rw,users,defaults,umask=000,noatime

Since you are using this device, you can make yourself the exclusive owner. Suppose your username is 'bkid':
sudo mount -t vfat /dev/sda1 /media/usbdisk -o rw,users,defaults,umask=077,noatime

I umount'ed a pen drive I inserted and used the fdisk command and mount commands (using my own username in the last example) myself to double check for mistakes.

I did notice that files inside are being created with full permissions, so you may need to tweak the mount options a bit, to make it perfect. Since the directory permissions on the device are rwx------ and you are the owner, noone else will be able to enter it with the umask=077 settings. I'm using the hotplug system, so I'm not going to sweat it myself.

Last edited by jschiwal; 02-18-2006 at 03:35 AM.
 
Old 02-18-2006, 03:43 AM   #7
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
Another posting on this site suggested using this line in /etc/fstab
/dev/sda1 /mnt/usbkey vfat umask=0,user,iocharset=iso8859-1,codepage=850,noauto,quiet 0 0

I can never remember the "iocharset=iso8859-1,codepage=850" options, but they may be the defaults.

"3 penny nail, 4 penny nail, whatever it takes!"

The noauto option is used so that the system doesn't mount it when the computer boots. The noatime option, I would recommend for a pendrive. It prevents files being read from having their access times updated. A pen drive has a limited number of writes before the flash memory goes bad.

Last edited by jschiwal; 02-18-2006 at 03:44 AM.
 
Old 02-18-2006, 10:41 AM   #8
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 7,569

Original Poster
Rep: Reputation: 696Reputation: 696Reputation: 696Reputation: 696Reputation: 696Reputation: 696
Centos found it on /dev/sda. It's a vanilla install, and I had to remove the ehci module from the kernel tree to stop it being loaded in every distro here. I haven't tried to do anything in Centos yet, so I don't know how well it works.

I have 3 linux versions here, and can't find ramsticks in linuxfromscratch. After
'modprobe usb-storage' lsmod |grep usbcore shows uhci_hcd, usbmouse, usb_storage, usbhid.
Because of the noacpi, hotplug events are dead, and nothing happens automagically. If I load ehci_hcd, I get continuous overcurrent change warning on stdout, i.e whatever terminal I use :-(( . So the real problems are noacpi, and no ehci_hcd, which I have to live with, and use techniques from the last millenium. Hotplug sees nothing. udev is not installed. If I go that route (Using acpi & hotplug) I get weirdo IRQs set up, the nic vanishes, the disks crawl and everything generally goes awol. Via Chipset. This has had a lot of time on it, and the hardware won.

All efforts like 'mount /dev/sda /mnt' return the error /dev/whatever is not a valid block device, whereas I know it is. I'm doing this as root, and root has power to create & destroy, so locales & charsets don't matter much, they are fine points. As soon as I FIND the stupid thing, I'll put a line in /etc/fstab. Then I'll know what to write.

Fdisk returns 'unable to open /dev/sd<whatever> or /dev/hde<whatever>, which I tried for completeness. These usb ramsticks are seen as scsi devices whether they are formatted vfat or not. I have kernel support for vfat.

The motto in linuxfromscratch is "Your distro - Your rules". I'm mounting in /mnt because it's unused. 'ls /' on this system shows /cdrom /floppy. /cdos, /ddos, & /edos which will become /hlfs as soon as I get around to changing fstab. I don't use nested directories like /mnt/media/usb/ramstick because it's too $%@! long to type . There's a console jockey at this end .Besides, all you need is a directory to mount it on, the name doesn't matter. I've mounted cdroms on /floppy and nothing cares, except people.

Cat /proc/filesystems shows a huge pile of filesystems, and all except vfat, ext2, & ext3 have 'nodev' beside them
 
Old 02-19-2006, 09:03 AM   #9
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
You are still trying to mount the device. You should mount a partition on the device.

Use the "fdisk -l" command to determine which partitions are on the device. Probably, just /dev/sda1.
Then mount the partition. (probably /dev/sda1). Don't try to mount /dev/sda. That won't work!
 
Old 02-19-2006, 12:21 PM   #10
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 7,569

Original Poster
Rep: Reputation: 696Reputation: 696Reputation: 696Reputation: 696Reputation: 696Reputation: 696
Quote:
Originally Posted by jschiwal
Plug in the usb device when monitoring the logs and see what messages come up.
My machine is quite quiet when the usb disk gets plugged in. I tried

grep usb /var/log/sys.log |grep -C3 storage. It says

usbcore: registered new driver usb-storage
usb 1-1: New usb device using uhci_hcd and address 3
usb-storage: device found at 3
usb-storage Waiting for device to settle before scanning.
 
Old 02-19-2006, 12:53 PM   #11
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 7,569

Original Poster
Rep: Reputation: 696Reputation: 696Reputation: 696Reputation: 696Reputation: 696Reputation: 696
Quote:
Originally Posted by jschiwal
You are still trying to mount the device. You should mount a partition on the device.

Use the "fdisk -l" command to determine which partitions are on the device. Probably, just /dev/sda1.
Then mount the partition. (probably /dev/sda1). Don't try to mount /dev/sda. That won't work!
That's correct. I did try mounting /dev/sda1. I give it every device I can imagine. /dev/sda1 is major 8 minor 1.

mount /dev/sda actually _does_work in Centos, btw. I quickly agree I don't want to mount the partition table
 
Old 02-20-2006, 08:30 PM   #12
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
Maybe there is something wrong with the usb-drive.
compare:
Feb 19 03:11:50 hpamd64 kernel: usb-storage: device found at 2
Feb 19 03:11:50 hpamd64 kernel: usb-storage: waiting for device to settle before scanning
Feb 19 03:11:50 hpamd64 kernel: usb-storage: device found at 3
Feb 19 03:11:50 hpamd64 kernel: usb-storage: waiting for device to settle before scanning
Feb 19 03:11:50 hpamd64 kernel: usbcore: registered new driver usb-storage
Feb 19 03:11:54 hpamd64 kernel: usb-storage: device scan complete
Feb 19 03:11:54 hpamd64 kernel: usb-storage: device scan complete
 
Old 02-21-2006, 05:22 AM   #13
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 7,569

Original Poster
Rep: Reputation: 696Reputation: 696Reputation: 696Reputation: 696Reputation: 696Reputation: 696
We're getting close. The usb disk is fine, btw as it pops up in Centos, and windows, and there's actually 2 here and 3 pcs so they do get tried.
I do get one more line which says 'usb-storage: Device scan complete' in kern.log, but that's not a lot of help. the events are going awol
I grabbed hal last evening and mean to build it to see if it will pick up on events.

When I started this thread, I wanted to find my stupid mistake. I gather at this stage, I didn't make one. I've got to put this down to a lousy chipset and spartan system. I asked people to finish the mount command for me and they did that, but it doesn't sing.

Centos runs some extra daemons: haldaemon; acpid; It seems to happen the other way around, i.e. it finds the usb device and then loads the usb-storage driver for it.

Mind you, dri is a lousy 300 fps on centos, and you see the the gears in glxgears stopping & starting :-(. lfs spins up 620fps w2ith dri, and 345 fps without. The speeds are all low, but the card is only a radeon 7000 - the sort of thing they give away in breakfast cereal packets :-/.

Thanks to all you guys for your help. It's clear it should be on /dev/sda1 but isn't.
That really points me back at the kernel, or boot options, doesn't it?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
USB drive not working properly, read only device? (USB key storage device) Arodef Linux - Hardware 14 01-01-2010 08:32 AM
Assign one USB-storage device to one device file Misel Linux - Hardware 1 08-28-2004 04:52 AM
USB storage device TazLinux Linux - General 9 12-04-2003 01:36 AM
USB storage device TazLinux Linux - General 2 11-15-2003 10:52 PM
how can I mount this device: da0: <USB 2.0 Storage Device alkad_mzu *BSD 2 11-15-2003 07:15 PM


All times are GMT -5. The time now is 01:51 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration