LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-29-2004, 12:24 PM   #1
pwalden
Member
 
Registered: Jun 2003
Location: Washington
Distribution: Raspbian, Ubuntu, Chrome/Crouton
Posts: 374

Rep: Reputation: 50
Two USB flash drives keep swapping device files


Sorry if my terminolgy is not a 100% correct here.

I was fine with my RH9 system when I just had my USB camera to plug in. It dutifully and always was registered to /dev/sda1. My /etc/fstab file mounts it to /mnt/cam.

Then I get a Scandisk 512MB flash thumb drive for Christmas.

The problem is that the first device plugged in gets sda1, the second get sdb1.

Any way to get the system to detect the vendor/prod codes and register it to a fixed device file?
 
Old 12-29-2004, 04:49 PM   #2
Vincent_Vega
Member
 
Registered: Nov 2003
Location: South Jersey
Distribution: Slackware, Raspbian, Manjaro
Posts: 826

Rep: Reputation: 31
Anything is possible but how much work would it take to get what you want - that's the question. I just decided to use /mnt/usb1, /mnt/usb2, etc. so that I'm not mounting my mp3 player with the name camera or something. That was just my way of simplifying things.
I'll be checking here to see if there's a way though. That would be nice.
 
Old 12-29-2004, 10:27 PM   #3
kevinalm
Member
 
Registered: Oct 2003
Location: Iowa
Distribution: LFS 5.0, building 6.3, win98se, multiboot
Posts: 288

Rep: Reputation: 30
Haven't tried it yet but I beleive you can refer to a partition by a label instead of a /dev/<devicename> in fstab. sda1 and sda2 will still swap but the camera would always mount at /mnt/camera and pendrive at /mnt/pendrive for example. Just got a muvo nomad mp3player/pendrive combo myself and I've been meaning to look into that.
 
Old 12-30-2004, 12:54 AM   #4
pwalden
Member
 
Registered: Jun 2003
Location: Washington
Distribution: Raspbian, Ubuntu, Chrome/Crouton
Posts: 374

Original Poster
Rep: Reputation: 50
Your idea to use the label sounds great. I googled around looking for ways to discover the label on the pre-existing vfat filesystems on my camera card or pendrive to no avail. All I found was that you can set set the label when creating the filesystem using mkfs.vfat(8).

I am not sure I am ready to muck with my camera card and pendrive yet.
 
Old 12-30-2004, 09:06 AM   #5
kevinalm
Member
 
Registered: Oct 2003
Location: Iowa
Distribution: LFS 5.0, building 6.3, win98se, multiboot
Posts: 288

Rep: Reputation: 30
I'm going by memory, but I'm pretty sure you can label in msdos/windows nondestructively. I don't recall how, maybe ms fdisk, maybe something safer. Next time I boot into windows I'll have a look around. I _seem_ to recall a dos command label.
 
Old 12-30-2004, 10:52 AM   #6
kevinalm
Member
 
Registered: Oct 2003
Location: Iowa
Distribution: LFS 5.0, building 6.3, win98se, multiboot
Posts: 288

Rep: Reputation: 30
Update. It is easy to label in win9x. Right click on the drive icon and choose properties, add/chage the label and click ok.

The command label works on the command line. For example:

label a: mylabel

I believe labels may mangle to uppercase, so keep that in mind.
 
Old 12-30-2004, 11:30 AM   #7
pwalden
Member
 
Registered: Jun 2003
Location: Washington
Distribution: Raspbian, Ubuntu, Chrome/Crouton
Posts: 374

Original Poster
Rep: Reputation: 50
Well you were right. I used my XP box to look at LABEL and VOL dos commands. I tried labelling the flash drive as PENDRIVE and added the LABEL=PENDRIVE line into fstab and then tried a:

$ mount -L PENDRIVE
mount: no such partition found

Turns out the LABEL and UUID mount capability relies on partition labels and uuids registered in /proc/partitions. This kernel file seems to contain only ext2 and ext3 filesystems on my computer.

I guess vfat labels are not registered as partitions.
 
Old 12-30-2004, 12:45 PM   #8
cathectic
Member
 
Registered: Sep 2004
Location: UK, Europe
Distribution: Slackware64
Posts: 761

Rep: Reputation: 35
If you have a 2.6 kernel, then you can use udev to create permanent naming rules for the devices, to ensure that they will always have a unique name (or a symlink that will always point to wherever the device is connected.)

If you're using a 2.4 kernel, then I'm afraid can't help you on that one.
 
Old 12-30-2004, 03:48 PM   #9
kevinalm
Member
 
Registered: Oct 2003
Location: Iowa
Distribution: LFS 5.0, building 6.3, win98se, multiboot
Posts: 288

Rep: Reputation: 30
I think your right about vfat and msdos not being supported. man fstab states ext2/3 and xfs labels are. I suspect that reiserfs might work, as there is a kernel config option to desplay reiser stats in /proc. Also, floppies don't seem to work. Probably only ide and scsi drives. Oh well, it was a nice idea.

I do recall reading about cathetic's udev hint. But I dislike the whole udev/devfs thing myself.

Regards,
Kevin
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Both USB Flash Drives already fried digiplaya Linux - Hardware 7 06-02-2006 05:22 PM
udev, USB Flash Drives, and usb-mount talkingwires Debian 13 11-07-2004 12:15 PM
USB Flash Drives Last Attacker Linux - Hardware 3 06-11-2004 03:36 PM
More trouble with certain usb flash drives... Jeeper Linux - Hardware 2 04-01-2004 12:11 AM
Swapping files with an 02 XDA/pocket pc device slackist Linux - Laptop and Netbook 1 03-11-2004 12:00 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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