LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   USB to have same device file (https://www.linuxquestions.org/questions/linux-newbie-8/usb-to-have-same-device-file-4175527273/)

procfs 12-03-2014 11:20 PM

USB to have same device file
 
Hi Is the a way to reserve a device file say /dev/sdz for a usb hard disk. so no matter what I plugin my usb hard disk will have a persistent device file

My env is Redhat linux 6.3

Thanks and regards

qlue 12-04-2014 02:38 AM

Device files are provided on a first-come-first-serve basis and are provided as needed. So I doubt this is possible.
However, using an entry in /etc/fstab it is possible to assign a preferred path and mount point for external storage devices. For a device specific path, use the UUID of the device.

Read more about this here and here.

Although the Ubuntu Wiki is a little easier to follow.

As an aside, I have an external, usb connected drive that I use frequently. I wanted this to mount automatically and with consistency. But I didn't want any error messages if the drive was not available. Using the drives UUID, I add the following line to my /etc/fstab file;
Code:

UUID="1a5e41b5-01e6-46b6-8400-cf4ba647383a" /media/qlue/wd-backup/ ext4        defaults,nofail 0 2
This causes the drive to mount with a consistent path if connected during boot and even if connected after the system has already booted.
Note that I also created the directory qlue/ in /media/ and the directory wd-backup/ in /media/qlue/ although I think that this may not alway be needed depending on the distro. (some distros may create these paths as needed but I'm not certain.)

ndc85430 12-05-2014 12:36 AM

I assume you really mean Red Hat Enterprise Linux. If you're using Red Hat Linux, then you should know that it's obsolete and unsupported.

Quote:

Originally Posted by qlue (Post 5279236)
Device files are provided on a first-come-first-serve basis and are provided as needed. So I doubt this is possible.

udev was created to solve this problem. Info on writing udev rules can be found at http://www.reactivated.net/writing_udev_rules.html, for example. The document is from 2008, so some things have undoubtedly changed (I believe udevinfo is no longer used and udevadm is used now, for example), but the basics remain the same.

procfs 12-12-2014 05:09 AM

Hi Guys thanks you for the replies

Best regards


All times are GMT -5. The time now is 10:51 AM.