Operating System - HP-UX
1834849 Members
2407 Online
110070 Solutions
New Discussion

Re: Default tar device file

 
Roberto Volsa
Frequent Advisor

Default tar device file

Hello,
i would like to know how to change the default device used by tar command (2m instead of 0m).

Thanks in advance
BR
8 REPLIES 8
melvyn burnard
Honored Contributor

Re: Default tar device file

us the f option or key to supply the destination file, as in:

tar -f /dev/rmt/2m
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
Eric Antunes
Honored Contributor

Re: Default tar device file

Hi Roberto,

ioscan will tell you what you archive file you can use:

#ioscan -fnCtape

Best Regards,

Eric Antunes
Each and every day is a good day to learn.
Roberto Volsa
Frequent Advisor

Re: Default tar device file

Hello,
my concern is avoiding adding "-f /dev/rmt/2m" ant each tar execution.

BR
Pete Randall
Outstanding Contributor

Re: Default tar device file

Do you have a device at 0m? If not, you could simply create a link from 0m to 2m. You could also create a new device file (see the attached method).


Pete

Pete
Eric Antunes
Honored Contributor

Re: Default tar device file

Hi,

By default, tar uses /dev/rmt/0m. So:

#tar cv

will use /dev/rmt/0m

Eric
Each and every day is a good day to learn.
Bill Hassell
Honored Contributor

Re: Default tar device file

There is no way to change tar's behavior. /dev/rmt/0m is hardcoded into the program. However, I would never run tar without explicitly using the full devicefile path (ie, -f option) simply because assuming defaults are always the same can cause lots of problems (such as overwriting the wrong tape). Similarly, linking device files can lead to mistakes when sysadmins forget or don't know about the link.


Bill Hassell, sysadmin
baiju_3
Esteemed Contributor

Re: Default tar device file

Ya ,I understood your Q.

In HP 0m is the default.

In other Unix like SCO unix ,U can change the default tape drive in /etc/defalt/tar
file .

This way it will not work in HP.

what you can do is ,if there is no H/W available in 0m and 1m path remove the
device files by rmsf and do a reboot or rcreate the /dev/rmt/0m dev file with the major and monor number of /dev/rmt/2m file.

Or go for a reboot .

Should work ,
Thanks,
BL.




Good things Just Got better (Plz,not stolen from advertisement -:) )
RolandH
Honored Contributor

Re: Default tar device file

Switch the tape device so the /dev/rmt/1m becomes /dev/rmt/0m and
the /dev/rmt/0m becomes /dev/rmt1m
--------------------------------------------------------
Run the following ioscan command to get the Hardware Path:
#ioscan -kf | grep -e INTERFACE -e DEVICE | grep -v target | awk '{printf "%s %
s %s\n",$3,$1,$2}'
8/0/0 tty 0
8/4 ext_bus 0
8/4.5.0 disk 0
8/4.7.0 ctl 0
8/4.8.0 disk 1
8/4.9.0 disk 2
8/4.10.0 disk 3
8/4.11.0 disk 4
8/4.12.0 disk 5
8/4.13.0 disk 6
8/4.14.0 disk 7
8/4.15.0 disk 8
8/16/0 ext_bus 2
8/16/1 pc 0
8/16/1.1 floppy 0
8/16/5 ext_bus 5
8/16/5.0.0 tape 0 <------ Here
8/16/5.2.0 disk 9
8/16/5.7.0 ctl 1
8/16/6 lan 0
8/16/7 ps2 0
8/20/2 tty 1
8/18/3.0.0 tape 1 <----- Here

#vi /tmp/infile
8/16/5.0.0 tape 1
8/18/3.0.0 tape 0

#ioinit -f /tmp/infile -r <----- This will cause a reboot

Note: Again, it might be necessary to remove the old device files with
the "rmsf" command and then re-create the device files with "insf -e".

Roland
Sometimes you lose and sometimes the others win