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 09-25-2008, 12:59 PM   #1
rcrummett
LQ Newbie
 
Registered: Aug 2005
Location: The Desert
Distribution: Ubuntu
Posts: 29

Rep: Reputation: 15
Mount USB drive from command line


Okay, first of all I need to do this by the command line as GNOME is not starting right now. This is because a file is missing...which happens to be on my USB thumb drive.

When GNOME was starting the thumb drive would automatically mount, but I have no idea if it is mounting when GNOME is not running. I plug the drive in and get the following message:

[ 100.446637] sd 6:0:0:0: [sdf] Assuming drive cache: write through
[ 100.449383] sd 6:0:0:0: [sdf] Assuming drive cache: write through

The fact that the message comes up after I plug in my drive leads me to believe that the drive is still being mounted. It also makes sense that a graphical environment wouldn't affect automounting.

If the USB drive is automatically mounted, I don't know what it is called and haven't been able to find it. Help?!
 
Old 09-25-2008, 01:02 PM   #2
david1941
Member
 
Registered: May 2005
Location: St. Louis, MO
Distribution: CentOS7
Posts: 267

Rep: Reputation: 58
See output of cat /etc/mtab to find mounted devices.

Dave
 
Old 09-25-2008, 01:10 PM   #3
rcrummett
LQ Newbie
 
Registered: Aug 2005
Location: The Desert
Distribution: Ubuntu
Posts: 29

Original Poster
Rep: Reputation: 15
The computer in question is not connected to a network and I have no way to connect it to a network, so I can't copy and paste the results. But I have run

cat /etc/mtab

and I didn't see anything that looked like it pertained to the USB drive (in particular I was looking for anything with the sdf prefix).

So in my opinion it looks as though the USB drive is not mounted. How would I go about finding it and mounting it?
 
Old 09-25-2008, 01:25 PM   #4
david1941
Member
 
Registered: May 2005
Location: St. Louis, MO
Distribution: CentOS7
Posts: 267

Rep: Reputation: 58
Try a quick df to see if it's there. Your first note kind of suggested it is /dev/sdf and you may find it there. You may try mounting it via the mount command assuming it is /dev/sdf and see if is.

Dave
 
Old 09-25-2008, 01:31 PM   #5
rcrummett
LQ Newbie
 
Registered: Aug 2005
Location: The Desert
Distribution: Ubuntu
Posts: 29

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by david1941 View Post
Try a quick df to see if it's there. Your first note kind of suggested it is /dev/sdf and you may find it there. You may try mounting it via the mount command assuming it is /dev/sdf and see if is.

Dave
First of all, what do you mean by a quick df? Typing a command 'df'? Sorry for the questions but it's been a long time since I worked with Linux in any form.

EDIT: Okay, I tried 'df' as you suggested but I didn't see anything listed that looked like it would be the USB drive.

I have tried to mount /dev/sdf with the following command:

sudo mount -t usbfs /dev/sdf /media/usb

When I do, after I cd to /media/usb, I don't see my files. I do, however, see the following:

001 002 003 004 005 devices

EDIT: Sorry, I should mention that all the numbers were colored blue and 'devices' was the same color as the prompt.

I don't know if that might be relevant or not but I'll include it here in hopes it could help.

Last edited by rcrummett; 09-25-2008 at 01:38 PM. Reason: clarification
 
Old 09-25-2008, 01:48 PM   #6
rob.rice
Senior Member
 
Registered: Apr 2004
Distribution: slack what ever
Posts: 1,076

Rep: Reputation: 205Reputation: 205Reputation: 205
the command would be mount /dev/sd?1 /somedirectory
the sd?1 will depend on what the other drives are
the /somedirectory will depend on where you want to mount it
try "mkdir /flash ^M" "mount /dev/sda1 /flash ^M" if you don't get an already mounted error do a ls /flash (^M is enter)
if you do get an error try sdb1,sdc1 etc etc it will be an sdsomething1
you can leave the -t option out all newer kernels can mount a fat32 file system on there own

Last edited by rob.rice; 09-25-2008 at 01:51 PM.
 
Old 09-25-2008, 03:27 PM   #7
ceantuco
Member
 
Registered: Mar 2008
Location: New York
Distribution: Debian
Posts: 809

Rep: Reputation: 88
so you need to copy a file from the USB to your HD? If I were you I would download a live linux CD like OpenSuse or Knoppix and try to copy the file from the usb to your hd. it might work.
 
Old 09-25-2008, 04:35 PM   #8
irishbitte
Senior Member
 
Registered: Oct 2007
Location: Brighton, UK
Distribution: Ubuntu Hardy, Ubuntu Jaunty, Eeebuntu, Debian, SME-Server
Posts: 1,213
Blog Entries: 1

Rep: Reputation: 88
Ok,*step by step:

1: Plug in your USB drive

2:

Code:
dave@dave-laptop:~$ dmesg|tail
[  396.133702] sd 5:0:0:0: [sdb] Assuming drive cache: write through
[  396.133708]  sdb: sdb1
[  396.135373] sd 5:0:0:0: [sdb] Attached SCSI removable disk
[  396.135479] sd 5:0:0:0: Attached scsi generic sg2 type 0
[ 2384.114940] usb 7-1: USB disconnect, address 4
[ 4065.246717] usb 7-1: new high speed USB device using ehci_hcd and address 5
[ 4065.309711] usb 7-1: configuration #1 chosen from 1 choice
[ 4065.310192] scsi6 : SCSI emulation for USB Mass Storage devices
[ 4065.312712] usb-storage: device found at 5
[ 4065.312720] usb-storage: waiting for device to settle before scanning
dave@dave-laptop:~$ dmesg|tail
[ 4066.925675] sd 6:0:0:0: [sdb] Write Protect is off
[ 4066.925683] sd 6:0:0:0: [sdb] Mode Sense: 45 00 00 08
[ 4066.925688] sd 6:0:0:0: [sdb] Assuming drive cache: write through
[ 4066.928273] sd 6:0:0:0: [sdb] 3940479 512-byte hardware sectors (2018 MB)
[ 4066.929043] sd 6:0:0:0: [sdb] Write Protect is off
[ 4066.929050] sd 6:0:0:0: [sdb] Mode Sense: 45 00 00 08
[ 4066.929055] sd 6:0:0:0: [sdb] Assuming drive cache: write through
[ 4066.929063]  sdb: sdb1
[ 4066.930879] sd 6:0:0:0: [sdb] Attached SCSI removable disk
[ 4066.930963] sd 6:0:0:0: Attached scsi generic sg2 type 0
3:

You can see in my case that on the third last line I have

Code:
[ 4066.929063]  sdb: sdb1
So I know that the first partition of my usb drive is sdb1

4:

Issue the commands:

Code:
dave@dave-laptop:~$ cd /mnt/
dave@dave-laptop:/mnt$ ls
dave@dave-laptop:/mnt$ sudo mkdir usb
[sudo] password for dave: 
dave@dave-laptop:/mnt$ ls
usb/
dave@dave-laptop:/mnt$ sudo mount -t vfat /dev/sdb1 /mnt/usb/
dave@dave-laptop:/mnt$ cd usb
dave@dave-laptop:/mnt/usb$ ls
chem_4_kids.sh       PDF Lists Groups
IT Room Layout.xls   
Junior Cert Science
So you can see, the USB drive is mounted on /mnt/usb/

To unmount it:
Code:
dave@dave-laptop:/mnt$ sudo umount /mnt/usb/
dave@dave-laptop:/mnt$ cd usb/
dave@dave-laptop:/mnt/usb$ ls
dave@dave-laptop:/mnt/usb$
Hope that helps you....
 
Old 09-25-2008, 04:37 PM   #9
irishbitte
Senior Member
 
Registered: Oct 2007
Location: Brighton, UK
Distribution: Ubuntu Hardy, Ubuntu Jaunty, Eeebuntu, Debian, SME-Server
Posts: 1,213
Blog Entries: 1

Rep: Reputation: 88
Note, on my last post, I am using ubuntu, hence 'sudo' is required. If you can login as root, all you need to do is drop sudo wherever I have it.
 
Old 09-25-2008, 04:37 PM   #10
rcrummett
LQ Newbie
 
Registered: Aug 2005
Location: The Desert
Distribution: Ubuntu
Posts: 29

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by ceantuco View Post
so you need to copy a file from the USB to your HD? If I were you I would download a live linux CD like OpenSuse or Knoppix and try to copy the file from the usb to your hd. it might work.
Interesting idea. Haven't worked with the live CDs before; do I have access to the Linux partition on my hard drive from a live CD? I'm all for that, assuming I can find a copy.
 
Old 09-25-2008, 05:16 PM   #11
rcrummett
LQ Newbie
 
Registered: Aug 2005
Location: The Desert
Distribution: Ubuntu
Posts: 29

Original Poster
Rep: Reputation: 15
irishbitte -

IT WORKED!

I was trying to mount the USB drive using usbfs instead of vfat. Changing this took care of EVERYTHING; I was able to install the packages I needed to and GNOME is running again.

Thank you all for your help!
 
  


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
can not mount a samba drive on command line but see via GUI cricballa Linux - Newbie 9 10-20-2007 08:40 PM
Saving a file to a USB thumb drive from the command line dbough Linux - Newbie 7 04-17-2007 07:21 PM
when i mount my USB Flash Drive A Messenge has come that mount: can't find /dev/sda/h feda82 Red Hat 2 12-24-2005 07:16 AM
when i mount my USB Flash Drive A Messenge has come that mount: can't find /dev/sda/h feda82 Red Hat 2 12-24-2005 02:15 AM
mount usb module then mount usb hard drive guanyu Linux - Hardware 1 10-08-2003 11:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:28 AM.

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