How can I get my USB Hard drive to always mount in the same place?
FedoraThis forum is for the discussion of the Fedora Project.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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/ )
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)
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.