Operating System - HP-UX
1826501 Members
1614 Online
109692 Solutions
New Discussion

Renaming special device files

 
Luis Toro
Regular Advisor

Renaming special device files

Can I simply use the "mv" command to rename special tape device files (ie., /dev/rmt/5mnb) ? We have 20 tape drives configured in our backup software, and when we do DR testing we inevitably have to reconfigure the software to point to different tape device files. I thought it might be easier to simply rename the files to what is already in the software.

Thank you
3 REPLIES 3
Joaquin Gil de Vergara
Respected Contributor

Re: Renaming special device files

better create a new file

make a
#ll /dev/rmt/*crw-rw-rw- 2 bin bin 205 0x013000 Aug 4 11:25 0m
crw-rw-rw- 2 bin bin 205 0x013080 Aug 4 11:25 0mb
crw-rw-rw- 2 bin bin 205 0x013040 Aug 4 11:25 0mn
crw-rw-rw- 2 bin bin 205 0x0130c0 Aug 4 11:25 0mnb
crw-rw-rw- 2 bin bin 205 0x013000 Aug 4 11:25 c1t3d0BEST
crw-rw-rw- 2 bin bin 205 0x013080 Aug 4 11:25 c1t3d0BESTb
crw-rw-rw- 2 bin bin 205 0x013040 Aug 4 11:25 c1t3d0BESTn
crw-rw-rw- 2 bin bin 205 0x0130c0 Aug 4 11:25 c1t3d0BESTnb
crw-rw-rw- 1 bin bin 205 0x013001 Aug 4 11:25 c1t3d0DDS
crw-rw-rw- 1 bin bin 205 0x013081 Aug 4 11:25 c1t3d0DDSb
crw-rw-rw- 1 bin bin 205 0x013041 Aug 4 11:25 c1t3d0DDSn
crw-rw-rw- 1 bin bin 205 0x0130c1 Aug 4 11:25 c1t3d0DDSnb
crw-r--r-- 1 bin bin 205 0xfffffe Aug 4 11:25 stape_config
#

create a new one with the same major and minor number
# mknod /dev/rmt/cinta c 205 0x013000
# ll /dev/rmt/*crw-rw-rw- 2 bin bin 205 0x013000 Aug 4 11:25 /dev/rmt/0m
crw-rw-rw- 2 bin bin 205 0x013080 Aug 4 11:25 /dev/rmt/0mb
crw-rw-rw- 2 bin bin 205 0x013040 Aug 4 11:25 /dev/rmt/0mn
crw-rw-rw- 2 bin bin 205 0x0130c0 Aug 4 11:25 /dev/rmt/0mnb
crw-rw-rw- 2 bin bin 205 0x013000 Aug 4 11:25 /dev/rmt/c1t3d0BE
ST
crw-rw-rw- 2 bin bin 205 0x013080 Aug 4 11:25 /dev/rmt/c1t3d0BE
STb
crw-rw-rw- 2 bin bin 205 0x013040 Aug 4 11:25 /dev/rmt/c1t3d0BE
STn
crw-rw-rw- 2 bin bin 205 0x0130c0 Aug 4 11:25 /dev/rmt/c1t3d0BE
STnb
crw-rw-rw- 1 bin bin 205 0x013001 Aug 4 11:25 /dev/rmt/c1t3d0DD
S
crw-rw-rw- 1 bin bin 205 0x013081 Aug 4 11:25 /dev/rmt/c1t3d0DD
Sb
crw-rw-rw- 1 bin bin 205 0x013041 Aug 4 11:25 /dev/rmt/c1t3d0DD
Sn
crw-rw-rw- 1 bin bin 205 0x0130c1 Aug 4 11:25 /dev/rmt/c1t3d0DD
Snb
crw-rw-rw- 1 root sys 205 0x013000 Sep 16 16:24 /dev/rmt/cinta
crw-r--r-- 1 bin bin 205 0xfffffe Aug 4 11:25 /dev/rmt/stape_co
nfig
# chown bin:bin /dev/rmt/cinta

(look at owners and permissions)

# ioscan -kfnCtape# ioscan -kfnCtape
Class I H/W Path Driver S/W State H/W Type Description
=====================================================================
tape 0 8/16/5.3.0 stape CLAIMED DEVICE HP C1533A
/dev/rmt/0m /dev/rmt/c1t3d0BESTnb
/dev/rmt/0mb /dev/rmt/c1t3d0DDS
/dev/rmt/0mn /dev/rmt/c1t3d0DDSb
/dev/rmt/0mnb /dev/rmt/c1t3d0DDSn
/dev/rmt/c1t3d0BEST /dev/rmt/c1t3d0DDSnb
/dev/rmt/c1t3d0BESTb /dev/rmt/cinta
/dev/rmt/c1t3d0BESTn
#

#
now you have an alias... is not necessary to delete files
(if you want to delete any special file use the rmsf command)





Teach is the best way to learn
A. Clay Stephenson
Acclaimed Contributor

Re: Renaming special device files

THe better way is to simply do an ls -l of the existing desired device node and note the major and minor device numbers.

Let's say that you have c2t0d0BEST and 0m that have major numbers 205 and minor numbers 0x020000. You want them 0m to be 5m.

1) rm /dev/rmt/0m
2) mknod /dev/rmt/5m c 205 0x020000

The computer only cares about the major and minor device numbers; you could rename /dev/rmt/0m to MickeyMouse and as long as the device numbers are correct then the tape drive will work just fine.
If it ain't broke, I can fix that.
Jean-Louis Phelix
Honored Contributor

Re: Renaming special device files

Yes you can rename the special files, but you have to move all of them (rewind, norewind, ...). The other simple solution is to use the ioinit command and change the instance numbers of your tapes.

- Create a file with your new mapping :

tape instance

- run ioinit -f file

- if there is no error, shutdown -r

Regards,

Jean-Louis.

It works for me (© Bill McNAMARA ...)