LinuxQuestions.org
Register a domain and help support LQ
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 07-12-2007, 11:03 PM   #1
p3ngu1n
LQ Newbie
 
Registered: Jul 2007
Distribution: ubuntu
Posts: 10

Rep: Reputation: 0
Unhappy mounting


ok, im SLOWLY figguring this out. i got slackware 11 and i need to know how to mount my flash drive. i know its at /dev/sda but how do i :
mount
list files
write files to
and unmount

please try to be descriptive. i realy like the way linux works, its just that i dont know unix very well. i needs to it more
 
Old 07-13-2007, 12:51 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
Do you see a pop up when you insert the device? If not you can manually mount the device. You can add an entry in /etc/fstab for this device that will allow you to manually mount it as a normal users.

Here is an example:
Code:
udevinfo -n /dev/sdc1 -q env
ID_VENDOR=SanDisk
ID_MODEL=Cruzer_Mini
ID_REVISION=0.2
ID_SERIAL=SanDisk_Cruzer_Mini_20043513721b2c90edb5
ID_TYPE=disk
ID_BUS=usb
ID_PATH=pci-0000:00:02.2-usb-0:2:1.0-scsi-0:0:0:0
ID_FS_USAGE=filesystem
ID_FS_TYPE=vfat
ID_FS_VERSION=FAT16
ID_FS_UUID=3B69-1AFD
ID_FS_LABEL=
ID_FS_LABEL_SAFE=

/etc/fstab entry:
UUID=3B69-1AFD /media/cruz128 vfat rw,noauto,user,uid=1000,gid=1000,fmask=117,dmask=007 0 0
I used the udevinfo output to find the UUID number for the filesystem. You mount the partition and not the entire disk. Using a device name like /dev/sda1 in fstab for a removable disk is a bad idea. Next time a different device like /dev/sdb1 might be used instead. You can use "UUID=" or "LABEL=" instead. You may want to use other options like iocharset if you need them.

Please read through the info manual for coreutils. It covers the commands like ls, cat and many others that are the most common you will use. Also read through the man page for the mount command. I'm sure that your slackware distro includes documentation as well.

I hope slackware uses udev, otherwise I might have made some bad assumptions.

Last edited by jschiwal; 07-13-2007 at 12:52 AM.
 
Old 07-13-2007, 01:00 AM   #3
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
The default kernel is 2.4.33.3 in Slack 11.0, so udev won't be used. If you use the kernel in /extra (which is 2.6.17.13), you can use udev (and 11.0 does have a package for it).

Quote:
Originally Posted by jschiwal
Using a device name like /dev/sda1 in fstab for a removable disk is a bad idea. Next time a different device like /dev/sdb1 might be used instead.
jschiwal's point is that this is precisely the reason to use udev.
 
Old 07-13-2007, 01:02 AM   #4
felixc
Member
 
Registered: Jul 2005
Distribution: Debian
Posts: 94

Rep: Reputation: Disabled
Hi,

Mounting your USB drive should be pretty simple. First, decide where you want to access the files from, or create a directory for that purpose. For example
Code:
mkdir /mnt/memstick
Now just use the mount command, giving it the location of your drive and the location you want to mount it to as parameters. Going with the previous example, we have
Code:
mount /dev/sda /mnt/memstick
If that gives you an error, I would verify your device is actually at /dev/sda. You can do that by unplugging it, plugging it back in, and running "dmesg". If it doesn't mention /dev/sda, it will probably be /dev/sdb1 or something similar.

Now for the process of writing files back and forth. If you are using the terminal exclusively, just use the "cp" command to copy files to or from /mnt/memstick (or wherever you mounted the device). If you are using a graphical desktop environment, you can access it just like any other folder through your file manager. To unmount, simply use the "umount" command.

And finally, you can always find more information on any of these commands with good 'ole "man". Try
Code:
man mount
man mkdir
man dmesg
man cp 
man umount
Cheers, and good luck!

PS - In case you're not aware of this, I'll give you a little incentive to research these topics on the web - it is possible (and fairly simple) to set the system up to automatically mount these devices to a predefined mount point, so you just have to plug it in. Your friendly local search engine will be able to tell you how.
 
Old 07-13-2007, 01:05 AM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
I'm not sure if you need to use jschiwal's method or not....
Here is another slant: (Do this as root)

Code:
cd /mnt
mkdir myflash
mount /dev/sda1 myflash
cd myflash
ls
You should now be looking at the contents of your flash drive.

This is only a temporary mount--it will disappear when you reboot. For a permanent mount, you still need fstab.
 
Old 07-13-2007, 01:21 AM   #6
p3ngu1n
LQ Newbie
 
Registered: Jul 2007
Distribution: ubuntu
Posts: 10

Original Poster
Rep: Reputation: 0
im up for mounting it after each boot i need the practice xD thats why i got slackware. it was a distro that practicaly REQUIRES usage of the unix-like thing. if i get good at that, i can learn to take full advantage of linux, eh? i hear its reeeeally cool when you know how to use those unix commands
 
Old 07-13-2007, 01:39 AM   #7
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Quote:
Originally Posted by p3ngu1n
i hear its reeeeally cool when you know how to use those unix commands
In some circles, really cool. At the local coffee shop, maybe not....

Seriously, some believe that "real operating sytems" started with Unix. The folklore is that DOS was based on Unix. Then DOS begat Windows, and the rest is history....
 
Old 07-13-2007, 02:03 AM   #8
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Quote:
Seriously, some believe that "real operating sytems" started with Unix. The folklore is that DOS was based on Unix. Then DOS begat Windows, and the rest is history....
Yup, the history continues with a new monster entering the arena, called Windows NT. After that...headache was invented. Soon it became the must-have problem of everyone, but still it's most often met among Windows users.

Enough joking.
Code:
mkdir -p /mnt/flash
mount -t vfat -o rw,users /dev/sda1 /mnt/flash
mount
mount | grep sda1
that's what's described above. The '-p' with mkdir means that if neither 'flash' or '/mnt' exist, create both instead of crying out loud that '/mnt' doesn't exist so 'flash' can't be created. Just a step to make sure you get no whining when creating subdirectories. The options and fs type aren't necessarily needed with 'mount', but just as an example, that's how you give them. Fs type, '-t', is by default 'auto' which means it tries to figure it out itself. Options are usually 'defaults' which do include rw, but it doesn't harm to see how you can put them. After mounting the flash drive, see what the difference is between these commands:
Code:
umount /dev/sda1
umount /mnt/flash
eject /dev/sda1
That's right, umount umounts the device and if you 'eject' it, it should also cut power down. Should. With Udev in place, and possibly Hal, you don't need these too much.

After adding a simple entry to /etc/fstab like this for example:
Code:
/dev/sda1   /mnt/flash   vfat   defaults,users   0   0
(note: instead of 'vfat' it's usually safe to enter 'auto' which is more comfortable)
...now you can mount the device with just this:
Code:
mount /mnt/flash
because everything else is in /fstab, mount doesn't need to ask you questions about "what do I mount to /mnt/flash?" or "what is the fs type or options?" because fstab already knows to tell them.

www.linuxcommand.org

Last edited by b0uncer; 07-13-2007 at 02:06 AM.
 
Old 07-13-2007, 02:06 AM   #9
dister
LQ Newbie
 
Registered: Jul 2007
Posts: 3

Rep: Reputation: 0
Just adding a quick note,

Never ever insert and remove your usb memory sticks just like that.

Always use the eject command before removing the inserted usb memory stick.

Saves lot of pain.
 
  


Reply

Tags
usb


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
mounting digital camera, mounting in general? lugoteehalt Linux - Hardware 6 08-29-2006 01:52 PM
Mounting an ISO image from a CD different than mounting from HD? NoTiG Linux - Software 4 08-03-2005 05:40 PM
Gnome 2.6 Right click mounting and the mounting system Acetylcholine Linux - Hardware 0 07-25-2004 08:34 AM
Mounting HDD vs. Mounting Filesystem snailophone Linux - Hardware 4 08-12-2003 12:00 PM
Mounting mounting extended partition and its Logical drives desbyleo Linux - Newbie 10 02-18-2002 04:13 PM


All times are GMT -5. The time now is 12:07 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