View Full Version : mounting a usb drive to linux
pistonie
29-07-2004, 07:59 AM
ok, ill wait for mbotrells answer to this:P
how do i mount a usb flash drive in linux (redhat 8)
thanks:D maybe put this in the sticky too..
and lets get a petition goin for a respected user to be able to moderate this section of the forum:D
JasonM
29-07-2004, 10:43 AM
try this....works in slackware.
mount /dev/sda1 /dir/mountpoint
That is asuming you dont already have any SCSI devices in your PC.
Regards,
Jason M
rbirdman
29-07-2004, 01:48 PM
I put up a page on this that might be handy.
http://home.swiftdsl.com.au/~rbirdman/fedora/usbkey.html
lets me no if it helps or could be improved
mbottrell
29-07-2004, 08:01 PM
Originally posted by pistonie
ok, ill wait for mbotrells answer to this :p
hehehe...
Rbirdman's response is right on the money.
This also works with Flash memory cards many ppl use with Digital cameras, MP3 players, etc. as well (same theory to set it up).
rbirdman, you're more than welcome to post the info in the tutorial area (http://home.swiftdsl.com.au/~mbottrell/modules/tutorials/) of the Swiftel-Users (http://swiftel-users.tk/) site if you wish. :)
This will make it easy for people to locate.
BTW - Nicely designed site.
mbottrell
29-07-2004, 08:02 PM
Originally posted by pistonie
and lets get a petition goin for a respected user to be able to moderate this section of the forum:D
That was one of the main reasons we started the Swiftel-Users website (http://swiftel-users.tk/).
CloSeR
29-07-2004, 11:03 PM
while we're all in here..
How do you mount a USB 2.0 HDD with Mandrake 10.0?
Cheers
CLoSeR
mbottrell
30-07-2004, 12:14 AM
Should be along similar lines...
All USB 'storage devices' are seen as a SCSI device.
You can even use fdisk and mke2fs on them. :D
As mentioned... attach prior to booting...
Then after booting... take a look at the bootup messages via:
dmesg |less
You can also take a look at your system messages if you attach it after booting.
tail /var/log/messages
This will help you identify it.
Cheers,
Matt.
CloSeR
30-07-2004, 12:16 AM
Thanks Boss..
500 Posts for me! Its been a long journey!
CLoSeR
axcairns
30-07-2004, 12:34 AM
While we're on the topic. Have a go at this one. I've got an old old old usb key (Agate 16MB). Never been able to get it working on Linux. Here's the messages dump -
Jul 29 22:18:00 fedora kernel: system-config-n: Using deprecated /dev/sg mechanism instead of SG_IO on the actual device
Jul 29 22:18:21 fedora system-config-network[2583]: -+ //etc/modprobe.conf ^Ieth0 alias e100
Jul 29 22:18:21 fedora system-config-network[2583]: chmod 0644 //etc/sysconfig/networking/devices/ifcfg-eth0
Jul 29 22:18:27 fedora gconfd (root-2597): GConf server is not in use, shutting down.
Jul 29 22:18:27 fedora gconfd (root-2597): Exiting
Jul 29 22:26:47 fedora kernel: ohci_hcd 0000:00:0f.2: remote wakeup
Jul 29 22:26:47 fedora kernel: usb 1-1: new full speed USB device using address 2
Jul 29 22:26:48 fedora kernel: usb 1-1: device not accepting address 2, error -110
Jul 29 22:26:49 fedora kernel: hub 1-0:1.0: Cannot enable port 1. Maybe the USB cable is bad?
Jul 29 22:26:49 fedora kernel: usb 1-1: new full speed USB device using address 3
Jul 29 22:26:50 fedora kernel: Initializing USB Mass Storage driver...
Jul 29 22:26:50 fedora kernel: scsi3 : SCSI emulation for USB Mass Storage devices
Jul 29 22:26:50 fedora kernel: Vendor: Agate Model: Q v 0.64 Rev: 00.0
Jul 29 22:26:50 fedora kernel: Type: Direct-Access ANSI SCSI revision: 02
Jul 29 22:26:50 fedora kernel: SCSI device sdb: 32384 512-byte hdwr sectors (17 MB)
Jul 29 22:26:50 fedora kernel: sdb: assuming Write Enabled
Jul 29 22:26:50 fedora kernel: sdb: assuming drive cache: write through
Jul 29 22:26:50 fedora kernel: sdb: unknown partition table
Jul 29 22:26:50 fedora kernel: Attached scsi removable disk sdb at scsi3, channel 0, id 0, lun 0
Jul 29 22:26:50 fedora kernel: Attached scsi generic sg2 at scsi3, channel 0, id 0, lun 0, type 0
Jul 29 22:26:50 fedora kernel: usbcore: registered new driver usb-storage
Jul 29 22:26:50 fedora kernel: USB Mass Storage support registered.
Jul 29 22:26:50 fedora kernel: updfstab: Using deprecated /dev/sg mechanism instead of SG_IO on the actual device
Jul 29 22:26:50 fedora last message repeated 2 times
Jul 29 22:26:51 fedora scsi.agent[2720]: disk at /devices/pci0000:00/0000:00:0f.2/usb1/1-1/1-1:1.0/host3/3:0:0:0
Getting a 'not valid block device' error trying to mount sdb1.
Any ideas?
Thanks,
Allan
mbottrell
30-07-2004, 01:06 AM
This is the answer:
Jul 29 22:26:50 fedora kernel: sdb: unknown partition table
Is it formatted? Do you support MS-DOS partitions on your machine?
Also some of the real old ones are a little 'non-standard' thus the issues... :(
I may also not be the 1st partition, (hard to tell... u can't read the partition table).
If you have nothing valuable on the disk, try fdiskin' it, and recreating a valid partition. :D
If that fails, just format it under Windows and leave it as a Win-only device.
axcairns
30-07-2004, 01:08 AM
Originally posted by mbottrell
This is the answer:
Jul 29 22:26:50 fedora kernel: sdb: unknown partition table
Is it formatted? Do you support MS-DOS partitions on your machine?
Yes it is formatted. Don't remember what FS though.
Does my machine support MS-DOS partitions? You tell me - it's the new FC2 box!
Cheers,
Allan
mbottrell
30-07-2004, 01:11 AM
Use fdisk then..
Yeah... FC2 does. :D
axcairns
30-07-2004, 01:20 AM
Originally posted by mbottrell
Use fdisk then..
Yeah... FC2 does. :D
fdisk partition table for /dev/sdb -
Command (m for help): p
Disk /dev/sdb: 16 MB, 16580608 bytes
1 heads, 32 sectors/track, 1012 cylinders
Units = cylinders of 32 * 512 = 16384 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 ? 58430356 63701903 84344761 69 Unknown
Partition 1 has different physical/logical beginnings (non-Linux?):
phys=(68, 13, 10) logical=(58430355, 0, 6)
Partition 1 has different physical/logical endings:
phys=(288, 115, 43) logical=(63701902, 0, 23)
Partition 1 does not end on cylinder boundary.
/dev/sdb2 ? 53172484 111606280 934940732+ 73 Unknown
Partition 2 has different physical/logical beginnings (non-Linux?):
phys=(371, 114, 37) logical=(53172483, 0, 26)
Partition 2 has different physical/logical endings:
phys=(366, 32, 33) logical=(111606279, 0, 18)
Partition 2 does not end on cylinder boundary.
/dev/sdb3 ? 81 81 0 74 Unknown
Partition 3 has different physical/logical beginnings (non-Linux?):
phys=(371, 114, 37) logical=(80, 0, 14)
Partition 3 has different physical/logical endings:
phys=(372, 97, 50) logical=(80, 0, 13)
Partition 3 does not end on cylinder boundary.
/dev/sdb4 1 107347296 1717556736 0 Empty
Partition 4 has different physical/logical beginnings (non-Linux?):
phys=(0, 0, 0) logical=(0, 0, 1)
Partition 4 has different physical/logical endings:
phys=(0, 0, 0) logical=(107347295, 0, 32)
Partition 4 does not end on cylinder boundary.
Partition table entries are not in disk order
I'd rather not blow it away though as there's some stuff on it I want and it works fine under XP.
Allan
mbottrell
30-07-2004, 01:43 AM
don't then. :p
I would fire up windows, copy to the HDD, then see about formatting it under FC2.
You might find you can then get it working under both. :D
Cheers,
Matt.
mbottrell
30-07-2004, 01:43 AM
Also... try mounting /dev/sdb3 -- that looks like the real partition... the others are screwed!
Fraser
30-07-2004, 09:54 AM
Originally posted by mbottrell
hehehe...
Rbirdman's response is right on the money.
rbirdman, you're more than welcome to post the info in the tutorial area (http://home.swiftdsl.com.au/~mbottrell/modules/tutorials/) of the Swiftel-Users (http://swiftel-users.tk/) site if you wish. :)
This will make it easy for people to locate.
rbirdman, With your permission, can I add it to the Linux FAQ's both here and there? :D
rbirdman
30-07-2004, 10:53 AM
no problem Fraser, help yourself :)
rbirdman
30-07-2004, 11:07 AM
Jul 29 22:26:50 fedora kernel: Attached scsi generic sg2 at scsi3, channel 0, id 0, lun 0, type 0
Jul 29 22:26:50 fedora kernel: usbcore: registered new driver usb-storage
Jul 29 22:26:50 fedora kernel: USB Mass Storage support registered.
Jul 29 22:26:50 fedora kernel: updfstab: Using deprecated /dev/sg mechanism instead of SG_IO on the actual device
axcairns
it looks like it falls back to a generic scsi driver, possibly due to the odd partitioning. have a look for /proc/scsi/sg when you put the key in.
Originally posted by axcairns
fdisk partition table for /dev/sdb -
[code]
Command (m for help): p
Disk /dev/sdb: 16 MB, 16580608 bytes
1 heads, 32 sectors/track, 1012 cylinders
Units = cylinders of 32 * 512 = 16384 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 ? 58430356 63701903 84344761 69 Unknown
Partition 1 has different physical/logical beginnings (non-Linux?):
phys=(68, 13, 10) logical=(58430355, 0, 6)
Allan
I've just tried doing an fdisk 'p' on the DOS partition of my own USB drive, and got a similar output. In other words, the file system might be the whole disk rather than a partition of it. Try mounting /dev/sdb rather than /dev/sdb1.
simonb
10-08-2004, 01:11 AM
... almost definitely the device is not partitioned at all - you're just seeing a rubbish partition table (i.e. bunch of random data where the table would normally be).
I wrote a long post once about what we've done to figure out what to mount with flash drives, so if you're interested in some experience/detail, check it out here (http://lists.slug.org.au/archives/slug/2004/07/msg00393.html) .
The rest of the thread may also be interesting.
One little comment - being a basic single-user system, you can fairly easily determine that it is /dev/sdb that you want. Doing this reliably, programatically, and without relying on syslog formats, is why the second half of the above-referenced mail is interesting (to me).
Cheers,
- Simon
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.