LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices

Reply
 
Search this Thread
Old 01-31-2008, 08:31 PM   #1
DJOtaku
Member
 
Registered: Oct 2004
Location: USA
Distribution: Fedora 20; Arch; Kubuntu; Debian
Posts: 711

Rep: Reputation: 31
How can I get my USB Hard drive to always mount in the same place?


Perhaps I am remebering this incorrectly, but didn't Fedora stop using fstab about 1 or 2 releases ago? I think I remember hearing that the fstab was deprecated since CDs, Thumb drives, etc were just going to load into /media/volumename

However, I have a USB Hard drive which I need to always go into /media/usbdisk, which is what it was called back around Fedora 5 or 6 or so. I have a lot of scripts, programs, etc that expect certain files to be at /media/usbdisk. For now, I need to always also mount it at /media/usbdisk, but I'm growing weary of this after having done it for the past year or two. How can I have this happen automatically?

Also, I seem to have noticed that it's not always /dev/sdx sometimes it may be /dev/sdy (where x and y are any letter of the alphabet) so if I do put this into fstab, how can I refer to it such that the computer knows that I'm talking about no matter what /dev/sdx it is. I think in my Ubuntu computer I saw it using a volume name or something like that.

Thanks a lot!
 
Old 01-31-2008, 08:38 PM   #2
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655
If you create a label for the disk of "usbdisk" it will be mounted that way. A possible gotha is that it may be mounted as "USBDISK", so you may need to modify your scripts but after that it should be constant.

An alternative is to create an fstab entry. Instead of using the device name, use the uuid number of the filesystem. If you use the "uid=" option and the "users" option in your entry, you will be able to mount it as a regular user without needing to use sudo.
You can determine the uuid of the filesystem with the command:
udevinfo -q env -n /dev/sdX
where X is the device letter where it is currently mounted. Now the UUID number is used instead of the device node that may change on you the next time you plug it in.

If you right-click on the disk icon, is there an option to determine how it will be mounted? This may be the easiest method.

Another option is to modify your udev or hotplug or hal rules.

---

As a general rule, I use /mnt for items in fstab and leave /media to HAL/Udev automounted devices.

Last edited by jschiwal; 01-31-2008 at 08:40 PM.
 
Old 01-31-2008, 09:23 PM   #3
DJOtaku
Member
 
Registered: Oct 2004
Location: USA
Distribution: Fedora 20; Arch; Kubuntu; Debian
Posts: 711

Original Poster
Rep: Reputation: 31
Thanks for the quick reply.

Ok, if I do sdb, I get

Code:
[e@mario ~]$ udevinfo -q env -n /dev/sdb
DEVTYPE=disk
ID_VENDOR=Maxtor
ID_MODEL=OneTouch
ID_REVISION=0200
ID_SERIAL=Maxtor_OneTouch_Y3K2RLGE-0:0
ID_SERIAL_SHORT=Y3K2RLGE
ID_TYPE=disk
ID_INSTANCE=0:0
ID_BUS=usb
if I do sdb1, I get:
Code:
[emesa@mario ~]$ udevinfo -q env -n /dev/sdb1
DEVTYPE=partition
ID_VENDOR=Maxtor
ID_MODEL=OneTouch
ID_REVISION=0200
ID_SERIAL=Maxtor_OneTouch_Y3K2RLGE-0:0
ID_SERIAL_SHORT=Y3K2RLGE
ID_TYPE=disk
ID_INSTANCE=0:0
ID_BUS=usb
ID_PATH=pci-0000:00:10.4-usb-0:3:1.0-scsi-0:0:0:0
ID_FS_USAGE=filesystem
ID_FS_TYPE=ext3
ID_FS_VERSION=1.0
ID_FS_UUID=9aa4aac3-eb2f-425b-8e6f-7c27897a7911
ID_FS_UUID_ENC=9aa4aac3-eb2f-425b-8e6f-7c27897a7911
ID_FS_LABEL=
ID_FS_LABEL_ENC=
ID_FS_LABEL_SAFE=
Which of teh UUIDs do I use? ID_FS_UUID or ID_FS_UUID_ENC?

Thanks!
 
Old 01-31-2008, 11:28 PM   #4
dcroxton
Member
 
Registered: Apr 2004
Distribution: Ubuntu Jaunty
Posts: 65

Rep: Reputation: 16
Quote:
Originally Posted by DJOtaku View Post
Thanks for the quick reply.

Ok, if I do sdb, I get

Code:
[e@mario ~]$ udevinfo -q env -n /dev/sdb
DEVTYPE=disk
ID_VENDOR=Maxtor
ID_MODEL=OneTouch
ID_REVISION=0200
ID_SERIAL=Maxtor_OneTouch_Y3K2RLGE-0:0
ID_SERIAL_SHORT=Y3K2RLGE
ID_TYPE=disk
ID_INSTANCE=0:0
ID_BUS=usb
if I do sdb1, I get:
Code:
[emesa@mario ~]$ udevinfo -q env -n /dev/sdb1
DEVTYPE=partition
ID_VENDOR=Maxtor
ID_MODEL=OneTouch
ID_REVISION=0200
ID_SERIAL=Maxtor_OneTouch_Y3K2RLGE-0:0
ID_SERIAL_SHORT=Y3K2RLGE
ID_TYPE=disk
ID_INSTANCE=0:0
ID_BUS=usb
ID_PATH=pci-0000:00:10.4-usb-0:3:1.0-scsi-0:0:0:0
ID_FS_USAGE=filesystem
ID_FS_TYPE=ext3
ID_FS_VERSION=1.0
ID_FS_UUID=9aa4aac3-eb2f-425b-8e6f-7c27897a7911
ID_FS_UUID_ENC=9aa4aac3-eb2f-425b-8e6f-7c27897a7911
ID_FS_LABEL=
ID_FS_LABEL_ENC=
ID_FS_LABEL_SAFE=
Which of teh UUIDs do I use? ID_FS_UUID or ID_FS_UUID_ENC?

Thanks!
I'm pretty ignorant on this subject, but they look identical to me.
 
Old 02-01-2008, 02:02 AM   #5
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 13.1 / 12.3_64-KDE, Ubuntu 14.04, Fedora 20, Mint 17, Chakra
Posts: 3,677

Rep: Reputation: Disabled
Here is something on hal or rather udev:

http://linuxcommand.org/man_pages/udev8.html
http://www.linuxfromscratch.org/lfs/...er07/udev.html
http://www.reactivated.net/writing_udev_rules.html
http://ftp.kernel.org/pub/linux/util...tplug/udev-FAQ
 
Old 02-01-2008, 04:10 PM   #6
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655
Use the value from ID_FS_UUID. They are the same so it doesn't matter which value you use. Maybe they would be different if you had an encrypted filesystem.

You can also look in /dev/disk/by-uid/. The filesystem uuid will also have a symbolic link there (that was created by hal). You could use this to verify the number. ( ls -l /dev/disk/by-uuid/ )
 
Old 02-01-2008, 06:23 PM   #7
axobeauvi
Member
 
Registered: Apr 2003
Posts: 128

Rep: Reputation: 16
can you cheat?

can you just make a symlink with the name you want it to be ?
from the directory it's in try "ln -s mountpointname mountpointnameyouwant " (without the quotes)
 
Old 02-01-2008, 06:39 PM   #8
AceofSpades19
Senior Member
 
Registered: Feb 2007
Location: Chilliwack,BC.Canada
Distribution: Slackware64 -current
Posts: 2,079

Rep: Reputation: 57
I'm pretty sure fedora still uses fstab, I know in Fedora 7 they still used it, I don't understand how you could mount partitions on a harddisk without it.
 
Old 02-01-2008, 08:42 PM   #9
DJOtaku
Member
 
Registered: Oct 2004
Location: USA
Distribution: Fedora 20; Arch; Kubuntu; Debian
Posts: 711

Original Poster
Rep: Reputation: 31
Thanks for the help guys. I've changed it and I'll give it a test on my next reboot.
 
Old 02-01-2008, 11:44 PM   #10
AuldLochinvar
LQ Newbie
 
Registered: Aug 2007
Posts: 10

Rep: Reputation: 0
I _really_ dislike the gobbledygook of the UUID stuff!
and I _like_ the fstab.

Of course, I'm an old codger who once thought System/360's JCL was pretty clever.
And I was good at it.

What was the reason for changing my hdx references to sdx?
The last SCSI bus device I used was on a Mac.
 
Old 02-02-2008, 05:31 AM   #11
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655
The kernel module that used to be used had problems and wasn't being the best maintained. The UUID entry is needed because it is a removable drive. A different device node may be used the next time the device is plugged in. By using the UUID of the filesystem, you will be able to mount it even when that happens.

You can have entries for pendrives as well. If your the fstab entry uses the UUID number, and you use the options uid, gid, users & noauto, you can mount it as a normal user and with the right fmask and dmask options you will have exclusive access on that machine.
 
  


Reply

Tags
udev


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
how to automatically mount a usb drive / cd when inserted and place icon on desktop? mr.v. Slackware 4 03-07-2007 05:39 PM
I can mount a usb hard drive fiacobelli Linux - Hardware 3 07-06-2005 02:52 PM
USB hard drive, how do I mount it? Oxyacetylene Debian 11 10-24-2004 07:00 PM
How do I mount an USB hard Drive? nandy70 Linux - Newbie 1 11-20-2003 01:29 PM
mount usb module then mount usb hard drive guanyu Linux - Hardware 1 10-08-2003 12:50 PM


All times are GMT -5. The time now is 04:22 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration