Hardcoding device names

This article talks about FreeBSD 8.2 and how device names might change when you add new devices to an existing system.

The other day, when I was telling you about the new tape library, one of the important bits was the device names. The existing tape drive was sa0. The new one was sa1. That’s good. But today, after a system reboot, the tape drives are renumbered. Here is what I had:

<DEC TL800    (C) DEC 0326>        at scbus12 target 0 lun 0 (pass11,ch0)
<QUANTUM DLT8000 0250>             at scbus12 target 4 lun 0 (pass13,sa1)
<DEC TZ89     (C) DEC 2561>        at scbus12 target 5 lun 0 (sa0,pass12)
<OVERLAND LXB 0524>                at scbus12 target 6 lun 0 (ch1,pass14)

Today, after a reboot, I have:

<DEC TL800    (C) DEC 0326>        at scbus12 target 0 lun 0 (pass11,ch0)
<QUANTUM DLT8000 0250>             at scbus12 target 4 lun 0 (sa0,pass12)
<DEC TZ89     (C) DEC 2561>        at scbus12 target 5 lun 0 (sa1,pass13)
<OVERLAND LXB 0524>                at scbus12 target 6 lun 0 (pass14,ch1)

As you can see, the new DLT 8000 is now sa0, and the old DEC tape is sa1. Why is this an issue? The Bacula configuration is refers to sa0 and sa1. It wouldn’t do to get these messed in. In fact, right now, Bacula is waiting on sa0

It is interesting to note that the changer devices remain unchanged. Just the tape devices have changed.

08-Dec 15:36 bacula-dir JobId 113631: Start Copying JobId 113631, Job=CopyToTape-Inc.2012-12-08_09.32.02_16
08-Dec 15:36 bacula-dir JobId 113631: Using Device "DTL01"
08-Dec 15:36 kraken-sd JobId 113631: Ready to read from volume "IncrAuto-2344" on device "MegaFile" (/storage/compressed/bacula/volumes).
08-Dec 15:37 kraken-sd JobId 113631: Please mount Volume "ETU101" or label a new one for:
    Job:          CopyToTape-Inc.2012-12-08_09.32.02_16
    Storage:      "DTL01" (/dev/nsa0)
    Pool:         Incrementals
    Media type:   DLT
08-Dec 16:38 kraken-sd JobId 113631: Please mount Volume "ETU101" or label a new one for:
    Job:          CopyToTape-Inc.2012-12-08_09.32.02_16
    Storage:      "DTL01" (/dev/nsa0)
    Pool:         Incrementals
    Media type:   DLT

I was not yet aware of the device renumbering when I issued this command:

*mount
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"
The defined Storage resources are:
     1: File
     2: MegaFile
     3: FileRemote
     4: FileRemoteTLS
     5: DLT
     6: DigitalTapeLibrary
     7: OverlandTapeLibrary
     8: DLTRemote
     9: DLTRemoteTLS
Select Storage resource (1-9): 7
Enter autochanger slot: 9
3307 Issuing autochanger "unload slot 1, drive 0" command.
3995 Bad autochanger "unload slot 1, drive 0": ERR=Child exited with code 1
Results=Unloading drive 0 into Storage Element 1...mtx: Request Sense: Long Report=yes
mtx: Request Sense: Valid Residual=no
mtx: Request Sense: Error Code=70 (Current)
mtx: Request Sense: Sense Key=Illegal Request
mtx: Request Sense: FileMark=no
mtx: Request Sense: EOM=no
mtx: Request Sense: ILI=no
mtx: Request Sense: Additional Sense Code = 53
mtx: Request Sense: Additional Sense Qualifier = 02
mtx: Request Sense: BPV=no
mtx: Request Sense: Error in CDB=no
mtx: Request Sense: SKSV=no
MOVE MEDIUM from Element Address 240 to 1 Failed

3301 Issuing autochanger "loaded? drive 0" command.
3302 Autochanger "loaded? drive 0", result is Slot 1.
3902 Cannot mount Volume on Storage Device ""DTL02" (/dev/nsa1)" because:
label.c:237 Could not reserve volume ETU101 on "DTL02" (/dev/nsa1)
3001 Device ""DTL02" (/dev/nsa1)" is already mounted with Volume "ETU101"
*

AHH! See, there’s my clue. The requested tape drive is on DLT02, which I knew (or rather, thought) was in the new Overland auto-changer.

One last check. What’s in the Overland unit:

$ /usr/local/sbin/mtx-changer /dev/pass14 14 list
2:ETU140
1:ETU145

Fortunately, there is a way to hardware these things. /boot/device.hints

Searching for a solution

When I first started looking at this problem, I could not recall what file contained the settings for hardwiring devices. So I started searching in /etc/ and /boot, and failed. I starting Googling for ‘freebsd scsi device hardwire’. Eventually I found a good reference. Look closely and you’ll see it’s a question I raised about two years ago on the mailing lists…

First, and failed, attempt

Based on the information at that URL, and the output of camcontrol devlist (reproduced below), here is what I’m going to try:

<DEC TL800    (C) DEC 0326>        at scbus12 target 0 lun 0 (pass11,ch0)
<QUANTUM DLT8000 0250>             at scbus12 target 4 lun 0 (sa0,pass12)
<DEC TZ89     (C) DEC 2561>        at scbus12 target 5 lun 0 (sa1,pass13)
<OVERLAND LXB 0524>                at scbus12 target 6 lun 0 (pass14,ch1)
# sa0 should be the DEC library
hint.sa.0.at="scbus12"
hint.sa.0.target="4"
hint.sa.0.unit="0"

# ch0 is the DEC auto-changer
hint.pass.11.at="scbus12"
hint.pass.11.target="0"
hint.pass.11.unit="0"

# sa1 should be the Overland library
hint.sa.1.at="scbus12"
hint.sa.1.target="5"
hint.sa.1.unit="0"

# ch1 is the Overland auto-changer
hint.pass.14.at="scbus12"
hint.pass.14.target="06"
hint.pass.14.unit="0"

After making those changes, I rebooted the server. Then I checked the camcontrol devlist output again:

<DEC TL800    (C) DEC 0326>        at scbus12 target 0 lun 0 (pass11,ch0)
<QUANTUM DLT8000 0250>             at scbus12 target 4 lun 0 (sa0,pass12)
<DEC TZ89     (C) DEC 2561>        at scbus12 target 5 lun 0 (sa1,pass13)
<OVERLAND LXB 0524>                at scbus12 target 6 lun 0 (pass14,ch1)

Bugger. That’s not right.

The correct solution

After a few minutes of pondering, I realized I’d just copied the existing situation, not the situation I wanted. Let’s try this:

# sa0 should be the DEC library
hint.sa.0.at="scbus12"
hint.sa.0.target="5"
hint.sa.0.unit="0"

# ch0 is the DEC auto-changer
hint.pass.13.at="scbus12" 
hint.pass.13.target="5" 
hint.pass.13.unit="0" 

# sa1 should be the Overland library
hint.sa.1.at="scbus12"
hint.sa.1.target="4"
hint.sa.1.unit="0"

# ch1 is the Overland auto-changer
hint.pass.14.at="scbus12" 
hint.pass.14.target="6"   
hint.pass.14.unit="0" 

After another reboot:

<DEC TL800    (C) DEC 0326>        at scbus12 target 0 lun 0 (pass11,ch0)
<QUANTUM DLT8000 0250>             at scbus12 target 4 lun 0 (sa1,pass12)
<DEC TZ89     (C) DEC 2561>        at scbus12 target 5 lun 0 (sa0,pass13)
<OVERLAND LXB 0524>                at scbus12 target 6 lun 0 (pass14,ch1)

Ahhh! There we go. sa1 is the DLT 8000, and sa0 is the DEC tape drive. Great!

What what is Bacula saying now?

08-Dec 22:06 bacula-dir JobId 113635: Warning: bsock.c:127 Could not connect to Storage daemon on kraken.unixathome.org:9103. ERR=Connection refused
Retrying ...
08-Dec 22:09 bacula-dir JobId 113635: Using Device "DTL01"
08-Dec 22:09 kraken-sd JobId 113635: Ready to read from volume "IncrAuto-2344" on device "MegaFile" (/storage/compressed/bacula/volumes).
08-Dec 22:10 kraken-sd JobId 113635: Volume "ETU101" previously written, moving to end of data.

Much better.

My thanks to the team that wrote device.hints way back on FreeBSD 5.

Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

Leave a Comment

Scroll to Top