LinuxQuestions.org
Review your favorite Linux distribution.
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 03-01-2005, 02:43 AM   #1
erraticassassin
Member
 
Registered: Feb 2004
Distribution: Slackware 13.1
Posts: 131

Rep: Reputation: 18
How to swap USB flashdrives without conflict...


Hi all,

I have a wee query for you. I have a number of USB flashdrives which I use for swapping files between my laptop and main PC. If I mount one at /dev/sda1, then remove it and try another, the next drive is recognised as /dev/sdb1, which isn't listed in my fstab and so can't be mounted.

Is it really necessary to add more lines to my fstab, considering I only have one USB port on my laptop and can't use more than one drive at once? Or is it possible to restart/flush out whichever subsystem deals with USB devices?

For reference I'm running a basic Slack 9.1 install with the stock 2.4.* kernel.

Any assistance greatly appreciated...
 
Old 03-01-2005, 02:53 AM   #2
samac
Senior Member
 
Registered: Mar 2004
Location: Kirkwall, Orkney
Distribution: Linux Mint 20.3 - Cinnamon
Posts: 1,425

Rep: Reputation: 139Reputation: 139
Try unmounting the drive before swapping in a new one, either by right clicking on the icon and selecting unmount or running umount /mnt/removeable (or wherever it is mounted) as root from a terminal.

samac
 
Old 03-01-2005, 04:37 PM   #3
erraticassassin
Member
 
Registered: Feb 2004
Distribution: Slackware 13.1
Posts: 131

Original Poster
Rep: Reputation: 18
Right-click? Icon? Dude, I'm hardcore... I use Fluxbox. Well, firmcore maybe.

The command that gets run from the Fluxbox menu is umount /dev/sda1, which seems to be ok. Must I run it as root to completely flush out the system?
 
Old 03-01-2005, 11:30 PM   #4
android1654
Member
 
Registered: Jan 2003
Location: Baltimore
Distribution: Slackware,peanut linux
Posts: 30

Rep: Reputation: 15
are you sure you need to place it in fstab at all with slack. im running 10.0 and i just made some shell scripts that do the following:

mount -t vfat /dev/sda1 /mnt/usb

and

umount /mnt/usb

nothing with sda is in my fstab, i do have hotplugs running although i really know nothing about hotplugs (or even if it deals with usb).

once you umount it double check if your directory you had it mounted on is now empty. if its not you obviously are having a umount problem.
 
Old 03-02-2005, 02:30 AM   #5
greybeard01
LQ Newbie
 
Registered: Sep 2004
Posts: 6

Rep: Reputation: 0
I had a similar problem with my Sony memory sticks I have a 16 and 64 MB stick and the only way around it was to remove and reload the USB storage module by using
"modprobe -r usb-storage" and then adding it back again using "modprobe usb-storage"
This is on RH.
I don't know if it the correct method but it works for me.
 
Old 03-02-2005, 02:47 AM   #6
erraticassassin
Member
 
Registered: Feb 2004
Distribution: Slackware 13.1
Posts: 131

Original Poster
Rep: Reputation: 18
Android - when I first bought a USB flashdrive I trawled the forums here in order to find out how to use it, which is where the idea of making an entry in fstab came from. Are you using the stock kernel in 10.0, or a 2.6.* kernel?

Greybeard - your method sounds useful. If all else fails I could perhaps combine your idea with Android's and write a shell script to be called from the Fluxbox root menu which would unmount the flashdrive and reset the USB set at the same time.
 
Old 03-02-2005, 02:51 AM   #7
Optimistic
Member
 
Registered: Jun 2004
Location: Germany
Distribution: Debian (testing)
Posts: 276

Rep: Reputation: 33
You could just set up a few different mount directories in fstab like:

/dev/sda1 gets mounted to /mnt/sda1
/dev/sdb1 gets mounted to /mnt/sdb1

But, seriously, you really should unmount devices before you rip them out of the computer.
 
Old 03-02-2005, 03:58 AM   #8
greybeard01
LQ Newbie
 
Registered: Sep 2004
Posts: 6

Rep: Reputation: 0
Just for interest I tested mounting the Sony Memory sticks with my Slackware server with 2.6.7 kernel and I can happily swap and exchange the the sticks and some usb drives without removing the module. I use android1654's method of mounting and unmounting the usb devices.
 
Old 03-02-2005, 04:15 AM   #9
Darin
Senior Member
 
Registered: Jan 2003
Location: Portland, OR USA
Distribution: Slackware, SLAX, Gentoo, RH/Fedora
Posts: 1,024

Rep: Reputation: 45
Quote:
Originally posted by android1654
are you sure you need to place it in fstab at all with slack...
For anything besides partitions needed for Linux to run, fstab entries are just a central repository of info and a way to save typing. Technically, it's a good idea to add entries but it's not necessary if you don't mind typing the whole mount command, or making seperate scripts if that's your cup of tea.
 
Old 03-02-2005, 01:49 PM   #10
erraticassassin
Member
 
Registered: Feb 2004
Distribution: Slackware 13.1
Posts: 131

Original Poster
Rep: Reputation: 18
Optomistic - I didn't make it clear, but I DO unmount the devices before removing them. I have put entries in my Fluxbox root menu specifically for mounting and unmounting media using the appropriate commands, which is why the behaviour of the USB system is puzzling.

Having the commands built into the menu also means that the same commands have to work to mount and unmount all the USB flashdrives. I'm only ever going to use one at once - and my laptop has only one USB port anyway - so there's no real reason for each drive to be recognised as a different device.

A number of other USB-related queries I have posted have brought out responses suggesting that the 2.6 kernel is the way to go. I've been quite happy sticking with the 2.4 until now, so it's only really the USB issue which is forcing the matter. Would an upgrade to a 2.6 kernel bring any real, tangible benefits?
 
Old 03-02-2005, 06:10 PM   #11
android1654
Member
 
Registered: Jan 2003
Location: Baltimore
Distribution: Slackware,peanut linux
Posts: 30

Rep: Reputation: 15
yes i do use the 2.4 kernel to mount/ umount my drives.

Maybe talking us through the problem more might set off a lightbulb in someones head about how to fix it.
I have a very similar setup, fluxbox, slack 10, 2.4 kernel, laptop.

(sorry for any repeat questions here)

So you want to use your usb drives, first of all what brand/model are they?

1. First thing you do is plug it into the usb port, then what command exactly do you run to mount it?

2. can you now see the drive mounted

3. What command do you run to unmount it?

4. Can you still see the drive mounted? (YOU SHOULDNT)

5. You unplug the device and plug another in the same port, run the same command again, what happens?

6. Does this only occur when you use two different drives one after the other, or does it also happen when you unplug the drive and then try and plug it back in and remount it?
 
Old 03-02-2005, 06:28 PM   #12
mcd
Member
 
Registered: Aug 2003
Location: Denver, CO
Distribution: CentOS, Debian
Posts: 825

Rep: Reputation: 33
as a quick question to help clarify: you said that you added the mount and umount commands to your root menu in fluxbox (by which i assume you mean the ./fluxbox/menu that pops up when you right click. as far as i know, mount and umount must be run as root. if you're logged in as user, whatever command you try to run from the menu will be run as user. therefore, mounting and umounting from the menu shouldn't work.

but i can't quite make out whether those assumptions of mine are correct. so as the previous poster requested, please post the exact commands you use to mount/umount, a step-by-step list of things you have tried, error messages you have received, etc. if you have entries in /.fluxbox/menu please post them.
 
Old 03-03-2005, 02:38 AM   #13
erraticassassin
Member
 
Registered: Feb 2004
Distribution: Slackware 13.1
Posts: 131

Original Poster
Rep: Reputation: 18
Okay, here goes...

I have a 128Mb Discgo and a 512Mb device made by a company called PQI, whom I haven't heard of before. I use the Discgo more on a day to day basis for swapping files between computers (including files I download at work on the office broadband connection... heh).

So... I would normally insert the Discgo and either use the fluxbox menu entries or open up an xterm and type mount /dev/sda1 or mount /dev/flashdrive. ( Flashdrive is a link to /dev/sda1 ). I would issue the commands as a normal user, not root. The drive is then mounted and I can examine the contents, either by cd'ing to the directory in xterm or by opening up Rox.

When I've finished using the Discgo, I make sure the /mnt/flashdrive directory isn't in use by xterm or Rox, then issue the command umount /dev/sda1. Examining the /mnt/flashdrive directory will show the device as being unmounted.

If I then replug the Disgo and go through the same procedure again, it works as before. If however I try to plug in the PQI drive, it is recognised as /dev/sdb1, even though it is the only USB device in use.

The entries in the fluxbox menu, from memory, are:

[exec] (USB) {mount /dev/sda1}
or [exec] (USB) {umount /dev/sda1}

( I have the menu set up so that there is a main entry called Media..., which brings up submenus for mount and unmount, which bring up submenus for CD, DVD, floppy and flashdrive. )

Phew, I think that's everything. As you can see, I've not previously had to be root to mount or unmount...
 
Old 03-03-2005, 04:00 AM   #14
Darin
Senior Member
 
Registered: Jan 2003
Location: Portland, OR USA
Distribution: Slackware, SLAX, Gentoo, RH/Fedora
Posts: 1,024

Rep: Reputation: 45
My guess is that it's something in hotplug that recognizes that the two different drives are unique and assigns different /dev nodes to them. Since I only have one flash drive and I'm not near a Linux system I can plug one into now, I can't test this theory or recreate it.

If it's hotplug there should be a way to configure the hotplug system to give both drives the same /dev node or even a way to do a workaround in a shell script such as changing the /dev/flashdrive symlink based on something like lsmod prior to issuing a mount command.
 
Old 03-03-2005, 01:09 PM   #15
Optimistic
Member
 
Registered: Jun 2004
Location: Germany
Distribution: Debian (testing)
Posts: 276

Rep: Reputation: 33
Quote:
Originally posted by erraticassassin
If I then replug the Disgo and go through the same procedure again, it works as before. If however I try to plug in the PQI drive, it is recognised as /dev/sdb1, even though it is the only USB device in use.
Ahh, I see. This happens to me too on my Slackware Laptop which only has one USB. My Lexar Jumpdrive shows up as /dev/sda1 and my Archos MP3 Player shows up as /dev/sdb1. If the two drives show up consistently as sdb1 or sda1, then why not have two lines in fstab like I suggested before? USB ports can support something like 99 devices so it is a good thing that Slack is being smart and keeping track of different devices.

Maybe there is a way to tell Slack to always use the first available /dev node for sd devices, but I don't know what that would be.
 
  


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
Are USB flashdrives hot pluggable in Linux? tzonkov Linux - Hardware 7 01-25-2016 01:23 PM
USB conflict mstrimel Linux - Hardware 0 09-04-2005 03:07 PM
Memorex USB Thumbdrive will not mount on RH9 - USB conflict Tsatellite81 Linux - Hardware 1 02-24-2005 12:01 PM
audio and USB conflict? farmerjoe Linux - Wireless Networking 1 01-17-2005 12:25 PM
Are usb flashdrives reliable? have you ever had a bad experience about it? kublador General 3 04-16-2004 04:04 PM

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

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