sg_rdac reads the SCSI RDAC mode page so you can see, and later change, which controller owns a LUN. Use it to identify which options can change ownership, and to verify the local installation before touching an array. Allow about 10 minutes for a read-only inspection. A controller transfer needs a tested storage change window and a recovery plan.
Install the sg3-utils package and identify the SCSI device path for the array or logical unit you intend to inspect. The command needs a SCSI pass-through device, not a regular file or an arbitrary block device. You also need permission to open that device. Use an ordinary shell first; add sudo only if the device permissions require it.
This guide was checked against Ubuntu package sg3-utils 1.46-3ubuntu4. The installed manpage is labelled sg3_utils-1.43, and the local binary reports its own version as 1.17 20180512. The utility is an older, short-option interface, so do not assume that newer sg3_utils programs' long options apply here.
Start by confirming that the command you will run is the expected one.
command -v sg_rdac
sg_rdac -V
The version command exits successfully and prints a line similar to:
sg_rdac version: 1.17 20180512
The exact version string can differ between packages. The useful check is that sg_rdac -V exits with status 0 and prints a version rather than attempting to access storage.
At this point you have verified the executable without sending a SCSI command. The command changes nothing when neither -a nor -f is supplied.
Replace the placeholder with the device path supplied by your storage administrator or host inventory.
DEVICE=/dev/sgX
sg_rdac "$DEVICE"
status=$?
printf 'sg_rdac exit status: %s\n' "$status"
Successful operation displays the current RDAC controller settings and exits with status 0. The utility reads the Redundant Controller mode page, page 0x2c, using 10-byte SCSI MODE SENSE and MODE SELECT command variants by default. This invocation only displays the current settings.
Do not use /dev/null as a test device. It is not a SCSI pass-through endpoint, so an error such as Inappropriate ioctl for device proves only that the endpoint is unsuitable; it does not diagnose the array.
The optional -6 flag selects the 6-byte CDB variants for MODE SENSE and MODE SELECT. Without it, the utility uses 10-byte variants.
sg_rdac -6 "$DEVICE"
Use this only when the target's SCSI compatibility or an existing storage procedure calls for it. The flag matters to transfer operations too: with -6, a logical unit number passed to -f cannot exceed 31. Without -6, that limit is 255.
A plain invocation and a plain -6 invocation display settings. The next two forms request a controller ownership change. Treat them as storage operations, not as alternate ways to format output.
The controller receiving the command becomes the destination for the requested transfer. The device argument therefore identifies the controller path on which the command is received.
-f=LUN requests transfer of the device identified by the decimal logical unit number. The manpage says this works only when the controller supports Dual Active Mode, also called active/active mode.-a requests transfer of all visible devices to the controller serving the supplied device.-v enables verbose output. It does not make an ownership request safe or read-only.Examples, shown only as change-window templates:
# Transfer one decimal LUN; confirm the value with your array documentation.
sudo sg_rdac -f=12 /dev/sgX
# Transfer all visible devices; use only with an approved runbook.
sudo sg_rdac -a /dev/sgX
Do not copy either transfer example into an ad hoc troubleshooting session. A transfer changes controller ownership and can affect paths, multipath state, and application I/O. The command has no general undo switch in its documented interface. Before changing state, record the current display, confirm the target LUN or visible-device scope, check that the array is in the supported mode, and ensure that the alternate controller path is healthy.
If a transfer has already been made, stop and follow the array vendor's recovery procedure. A later sg_rdac invocation on the intended controller path may transfer ownership again, but the correct command depends on the array's RDAC implementation and active/active support. Do not guess a compensating LUN or use -a as a blanket recovery action.
After a planned transfer, rerun the read-only display through the relevant controller path and compare it with the record from step 2.
sg_rdac /dev/sgY
echo "$?"
A return status of 0 means sg_rdac completed successfully. A non-zero status means the operation failed; the installed manpage directs you to the sg3_utils(8) exit-status guidance for further interpretation. Capture the command's diagnostic output and the device path, then check the array and host multipath logs before retrying.
-a or -f, the documented action is display only.-f syntax: the documented form is -f=LUN, with a decimal number. Keep the equals sign while testing a runbook.-6 changes the maximum accepted LUN from 255 to 31.sg_rdac -V identified the installed binary and version.