LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-10-2017, 05:59 AM   #1
Arvind Shivaramakrishnan
LQ Newbie
 
Registered: Aug 2011
Posts: 12
Blog Entries: 2

Rep: Reputation: Disabled
How to change the name of Disk in RHEL 7 from something like /dev/sdb to /dev/data1 using udev


Hi All,
I am trying to change the NAME of the disk in RHEL 7 eg /dev/sdb to /dev/data1
I tried the following method to try it.

I am using NAME="data1" here at the end of the udev rule file.
But it doesnt create "/dev/data1"

[root@localhost rules.d]# cat 99-myrules.rules
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="3600605b0071b4c0020ca61bd1c625ccc", NAME="data1"
[root@localhost rules.d]# vi 99-myrules.rules
[root@localhost rules.d]# /sbin/udevadm control --reload-rules
[root@localhost rules.d]# /sbin/udevadm trigger --type=devices --action=change
[root@localhost rules.d]# ls -l /dev/data1
ls: cannot access /dev/data1: No such file or directory
[root@localhost rules.d]#

However i replace NAME="data1" with SYMLINK+="data1" and it does create a symlink to "/dev/sdb". But i need to get the first method working.
i.e. rename "/dev/sdb" to "/dev/data1". Please help.

[root@localhost rules.d]# cat 99-myrules.rules
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="3600605b0071b4c0020ca61bd1c625ccc", SYMLINK+="data1"
[root@localhost rules.d]# /sbin/udevadm control --reload-rules
[root@localhost rules.d]# /sbin/udevadm trigger --type=devices --action=change
[root@localhost rules.d]# ls -l /dev/data1
lrwxrwxrwx 1 root root 3 Jun 10 03:45 /dev/data1 -> sdb
[root@localhost rules.d]#
 
Old 06-10-2017, 08:32 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by Arvind Shivaramakrishnan View Post
Hi All,
I am trying to change the NAME of the disk in RHEL 7 eg /dev/sdb to /dev/data1 I tried the following method to try it.

I am using NAME="data1" here at the end of the udev rule file. But it doesnt create "/dev/data1"

[root@localhost rules.d]# cat 99-myrules.rules
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="3600605b0071b4c0020ca61bd1c625ccc", NAME="data1"
[root@localhost rules.d]# vi 99-myrules.rules
[root@localhost rules.d]# /sbin/udevadm control --reload-rules
[root@localhost rules.d]# /sbin/udevadm trigger --type=devices --action=change
[root@localhost rules.d]# ls -l /dev/data1
ls: cannot access /dev/data1: No such file or directory
[root@localhost rules.d]#

However i replace NAME="data1" with SYMLINK+="data1" and it does create a symlink to "/dev/sdb". But i need to get the first method working.
i.e. rename "/dev/sdb" to "/dev/data1". Please help.

[root@localhost rules.d]# cat 99-myrules.rules
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="3600605b0071b4c0020ca61bd1c625ccc", SYMLINK+="data1"
[root@localhost rules.d]# /sbin/udevadm control --reload-rules
[root@localhost rules.d]# /sbin/udevadm trigger --type=devices --action=change
[root@localhost rules.d]# ls -l /dev/data1
lrwxrwxrwx 1 root root 3 Jun 10 03:45 /dev/data1 -> sdb
The first and most obvious question I have here is "why???" Instead of messing with udev rules to do something like this, it would be FAR simpler to just edit your fstab file, and just mount that device as "data1" in some path. What are you trying to accomplish here?? What is your actual goal in renaming a device like this?

And as you've been told before, you're using Red Hat Enterprise...so contact Red Hat support, since you're PAYING for RHEL...RIGHT???
 
Old 06-10-2017, 08:45 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Quote:
Originally Posted by TB0ne View Post
The first and most obvious question I have here is "why???"
Agreed. Why do you care ? - if your users can use a name they are happy with. They will (probaly) not even know it's a symlink.
 
  


Reply

Tags
rhel7, udev rules



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
Change installer to /dev/sdb eight.bit.al 4MLinux 5 05-06-2016 10:10 AM
Format /dev/sdb1 fails but /dev/sdb succeeds? Lop3 Linux - Hardware 2 02-09-2014 05:06 PM
[SOLVED] Change active MBR from /dev/sdb to /dev/sda. How? JZL240I-U SUSE / openSUSE 3 04-13-2012 01:09 AM
RHEL 6 after boot primary partition shows /dev/sdb instead of /dev/sda vipul_patel Red Hat 1 04-26-2011 09:48 AM
iscsi: which local device (/dev/sda, /dev/sdb) is used WITHOUT dmesg? knikkerr Linux - Software 3 08-13-2010 04:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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