Renaming devices in AIX 7.1

I remember reading this interesting document about some challenges renaming AIX devices.

The_Fun_of_Oracle_RAC_ASM_and_Device_Names.doc

This poor guy had to jump through some hoops to rename some disk and network devices in a clustered AIX (Oracle RAC) environment.

 

This comment stayed with me:

 

The easy way to get network adapters and disk names to match between systems would be to run something like

 

# chdev –l old_name –n new_name

 

Except, this command option does NOT exist.

 

Since then I’ve always been on the “look out” for an easy way to rename devices in AIX.

 

In particular in large clustered environments where it is sometimes very important to have the same disk and network device names in sync across all nodes in a cluster. And besides, it’s a lot easier  to verify a cluster configuration if the hdisk names are all the same. Matching PVIDs works but it requires a lot more effort! For example, knowing that hdisk123 is the same device on all nodes makes life easier than scanning lspv output for a PVID like 00f6048868b4gead.  Of course you can script things to make this easier but it would be great if you didn’t need to do this and that there was a way to rename devices as needed, without resorting to unsupported methods.

 

Well, this is no longer an issue for AIX.

 

Starting with AIX 7.1, you can now easily rename devices. A new command called rendev was introduced to allow AIX administrators to rename devices as required.

 

From the man page:

 

The rendev command enables devices to be renamed. The device to be renamed, is specified with the -l flag, and the new desired name is specified with the -n flag.

 

The new desired name must not exceed 15 characters in length. If the name has already been used or is present in the /dev directory, the operation fails. If the name formed by appending  the new name after the character r is already used as a device name, or appears in the /dev directory, the operation fails.

 

 If the device is in the Available state, the rendev command must unconfigure the device before renaming it. This is similar to the operation performed by the rmdev -l Name command. If the unconfigure operation fails, the renaming will also fail. If the unconfigure succeeds, the rendev command will configure the device, after renaming it, to restore it to the Available state. The -u flag may be used to prevent the device from being configured again after it is renamed.

 

 Some devices may have special requirements on their names in order for other devices or applications to use them. Using the rendev command to rename such a device may result in the device being unusable. Note: To protect the configuration database, the rendev command cannot be interrupted once it has started. Trying to stop this command before completion, could result in a corrupted database.

 

This functionality was required to help simplify cluster device configuration with the new Cluster Aware AIX (CAA) feature in AIX 7.1.

 

I’ll be blogging about CAA in a future post.

 

Here are some examples of using the rendev command on AIX 7.1 (GA) system. In the first example I will rename hdisk3 to hdisk300. Note: hdisk3 is not in use (busy).

If the disk had been allocated to a volume group, I would have needed to varyoff the volume group first.

 

 

# lspv

hdisk0          00f61ab2f73e46e2                    rootvg          active

hdisk1          00f61ab20bf28ac6                    None

hdisk2          00f61ab2202f7c0b                    None

hdisk4          00f61ab20b97190d                    None

hdisk3          00f61ab2202f93ab                    None

 

# rendev -l hdisk3 -n hdisk300

 

# lspv

hdisk0          00f61ab2f73e46e2                    rootvg          active

hdisk1          00f61ab20bf28ac6                    None

hdisk2          00f61ab2202f7c0b                    None

hdisk4          00f61ab20b97190d                    None

hdisk300        00f61ab2202f93ab                    None

 

Easy!

 

Next, I’ll rename a virtual SCSI adapter. I renamed vscsi0 to vscsi2. Note: I placed the adapter, vscsi0, in a Defined state before renaming the device.

 

# rmdev -Rl vscsi0

 

# lsdev -Cc adapter

ent0   Available  Virtual I/O Ethernet Adapter (l-lan)

ent1   Available  Virtual I/O Ethernet Adapter (l-lan)

vsa0   Available  LPAR Virtual Serial Adapter

vscsi0 Defined    Virtual SCSI Client Adapter

vscsi1 Available  Virtual SCSI Client Adapter

 

# rendev -l vscsi0 -n vscsi2

 

# lsdev -Cc adapter

ent0   Available  Virtual I/O Ethernet Adapter (l-lan)

ent1   Available  Virtual I/O Ethernet Adapter (l-lan)

vsa0   Available  LPAR Virtual Serial Adapter

vscsi1 Available  Virtual SCSI Client Adapter

vscsi2 Defined    Virtual SCSI Client Adapter

 

Now I’ll rename a network adapter from ent0 to ent10. I bring down the interface before changing the device name

 

# lsdev -Cc adapter

ent0   Available  Virtual I/O Ethernet Adapter (l-lan)

ent1   Available  Virtual I/O Ethernet Adapter (l-lan)

vsa0   Available  LPAR Virtual Serial Adapter

vscsi1 Available  Virtual SCSI Client Adapter

vscsi2 Defined    Virtual SCSI Client Adapter

 

# ifconfig en0

en0: flags=1e080863,480<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),CHAIN>

        inet 10.1.20.19 netmask 0xffff0000 broadcast 10.153.255.255

         tcp_sendspace 262144 tcp_recvspace 262144 rfc1323 1

 

# ifconfig en0 down detach

 

# rendev -l ent0 -n ent10

 

# lsdev -Cc adapter

ent1   Available  Virtual I/O Ethernet Adapter (l-lan)

ent10  Available  Virtual I/O Ethernet Adapter (l-lan)

vsa0   Available  LPAR Virtual Serial Adapter

vscsi1 Available  Virtual SCSI Client Adapter

vscsi2 Defined    Virtual SCSI Client Adapter

 

# rendev -l en0 -n en10

 

# chdev -l en10 -a state=up

en10 changed

 

# mkdev -l inet0

inet0 Available

 

# ifconfig en10

en10: flags=1e080863,480<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),CHAIN>

        inet 10.1.20.19 netmask 0xffff0000 broadcast 10.153.255.255

         tcp_sendspace 262144 tcp_recvspace 262144 rfc1323 1

 

If you want to be creative you can rename devices to anything you like (as long as it’s not more than 15 characters). For example I’ll rename vscsi2 to myvscsiadapter.

 

 

# rendev -l vscsi2 -n myvscsiadapter

# lsdev -Cc adapter

ent1           Available  Virtual I/O Ethernet Adapter (l-lan)

myadapter      Available  Virtual I/O Ethernet Adapter (l-lan)

myvscsiadapter Defined    Virtual SCSI Client Adapter

vsa0           Available  LPAR Virtual Serial Adapter

vscsi1         Available  Virtual SCSI Client Adapter

 

And in the last example I’ll demonstrate changing virtual SCSI adapter device names on a live system.

 

This is single disk system (hdisk0), with two vscsi adapters.

 

# lspv

hdisk0          00f6048868b4deee                    rootvg          active

 

# lspath

Enabled hdisk0 vscsi0

Enabled hdisk0 vscsi1

 

# lsdev -Cc adapter

ent0   Available  Virtual I/O Ethernet Adapter (l-lan)

ent1   Available  Virtual I/O Ethernet Adapter (l-lan)

vsa0   Available  LPAR Virtual Serial Adapter

vscsi0 Available  Virtual SCSI Client Adapter

vscsi1 Available  Virtual SCSI Client Adapter

 

We ensure the adapter is in a Defined state before renaming it. This will fail otherwise.

 

# rmdev -Rl vscsi1

vscsi1 Defined

# lsdev -Cc adapter | grep vscsi

vscsi0 Available  Virtual SCSI Client Adapter

vscsi1 Defined    Virtual SCSI Client Adapter

 

Now we rename the adapter vscsi1 to vscsi3.

 

# rendev -l vscsi1 -n vscsi3

 

# lsdev -Cc adapter | grep vscsi

vscsi0 Available  Virtual SCSI Client Adapter

vscsi3 Defined    Virtual SCSI Client Adapter

 

That was easy enough. Now I need to bring the adapter and path online with cfgmgr. The lspath output displays an additional path to vscsi3.

 

# lspath

Enabled hdisk0 vscsi0

Defined hdisk0 vscsi1

 

# cfgmgr

Method error (/etc/methods/cfgscsidisk -l hdisk0 ):

        0514-082 The requested function could only be performed for some

                 of the specified paths.

 

# lspath

Enabled hdisk0 vscsi0

Defined hdisk0 vscsi1

Enabled hdisk0 vscsi3

 

Now I need to remove the old path to vscsi1. The path to vscsi3 is now Enabled. The adapter, vscsi3, is in an Available state. All is good.

 

# rmpath -l hdisk0 -p vscsi1 -d

path Deleted

 

# lspath

Enabled hdisk0 vscsi0

Enabled hdisk0 vscsi3

 

# lsdev -Cc adapter | grep vscsi

vscsi0 Available  Virtual SCSI Client Adapter

vscsi3 Available  Virtual SCSI Client Adapter

 

The same steps need to be repeated for the vscsi0 adapter. This is renamed to vscsi2.

 

# rmdev -Rl vscsi0

vscsi0 Defined

# lsdev -Cc adapter | grep vscsi

vscsi0 Defined    Virtual SCSI Client Adapter

vscsi3 Available  Virtual SCSI Client Adapter

 

 

# rendev -l vscsi0 -n vscsi2

 

# lsdev -Cc adapter | grep vscsi

vscsi2 Defined    Virtual SCSI Client Adapter

vscsi3 Available  Virtual SCSI Client Adapter

 

 

# lspath

Defined hdisk0 vscsi0

Enabled hdisk0 vscsi3

 

# cfgmgr

Method error (/etc/methods/cfgscsidisk -l hdisk0 ):

        0514-082 The requested function could only be performed for some

                 of the specified paths.

 

# lspath

Defined hdisk0 vscsi0

Enabled hdisk0 vscsi2

Enabled hdisk0 vscsi3

 

# rmpath -l hdisk0 -p vscsi0 -d

path Deleted

 

# cfgmgr

# lspath

Enabled hdisk0 vscsi2

Enabled hdisk0 vscsi3

 

That’s it. Both adapters have been renamed while the system was in use. No downtime required.

 

# lsdev -Cc adapter | grep vscsi

vscsi2 Available  Virtual SCSI Client Adapter

vscsi3 Available  Virtual SCSI Client Adapter

 

# lspath

Enabled hdisk0 vscsi2

Enabled hdisk0 vscsi3

 

Please refer to the AIX 7.1 command reference for more information on this new command:

http://publib.boulder.ibm.com/infocenter/aix/v7r1/topic/com.ibm.aix.cmds/doc/aixcmds4/rendev.htm

 

And by the way, here’s a draft of what I’ve been working on for the last 5 weeks:

 

IBM AIX Version 7.1 Differences Guide:

http://www.redbooks.ibm.com/Redbooks.nsf/RedpieceAbstracts/sg247910.html?Open

 

转载于:https://my.oschina.net/chanrevival/blog/2986899

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值