How to use FreeBSD camcontrol epc command with USB...
Created on: May 20, 2025
Created on: May 20, 2025
How to use FreeBSD camcontrol epc command with USB bridged SATA HDDs
Below is a practical checklist you can follow to make camcontrol epc(8) work on a SATA hard-disk that sits behind a USB bridge on FreeBSD.
camcontrol (and SMART, APM, EPC, …) only work if the USB-to-SATA bridge implements SAT-2/SAT-3 ATA PASS THROUGH (12/16).
A fast way to test is:
sh# Identify the drive through the SCSI layer camcontrol identify /dev/da0
USB disks appear as daX
(and a matching passY
) rather than adaX
.
Either node works, but passY
makes it absolutely clear you are talking to the CAM pass-through layer:
sh# List all CAM devices camcontrol devlist # Example result <ST4000DM004-2CV104> at scbus2 target 0 lun 0 (pass4,da0)
shcamcontrol epc /dev/da0 -c status
sh# Turn APM off first – spec says APM and EPC are mutually exclusive camcontrol apm /dev/da0 # no number = disable # Enable the EPC feature set camcontrol epc /dev/da0 -c enable
If that works you are ready to program timers or disable individual low-power states. Example recipes below come straight from real-world usage and the FreeBSD community docs Server Fault:
Goal | Command | Notes |
---|---|---|
See current timers / allowed states | camcontrol epc da0 -c status | Shows which EPC timers are running and which states (Idle _a/b/c, Standby _y/z, DevSleep) the drive may enter. |
Disable head-parking but keep spin-down | <br>camcontrol epc da0 -c state -d -p Idle_b <br>camcontrol epc da0 -c state -d -p Idle_c | Use -s to make it persistent. |
Disable spin-down completely | camcontrol epc da0 -c state -d -p Standby_z -s | -d = disable that state, -s = save to disk NVRAM so it survives power-cycling. |
Change a timer (e.g. Standby_z after 1 h) | camcontrol epc da0 -c timer -p Standby_z -T 3600 -e -s | -e first enables EPC if it was still off. -T is in seconds; fractional values allowed (e.g. 60.5). |
Instantly put the drive into Standby_z (for scripts) | camcontrol epc da0 -c goto -p Standby_z | Useful when you want to spin a disk down right now. |
(Run the commands as root; they are safe for data but a typo can still leave a drive unwritable until the next reset.)
-s
– that asks the firmware to copy the current value into its “saved” page so it survives a power loss.-s
; simply re-run your chosen commands from /etc/rc.local
or a periodic script at boot.Symptom | Likely cause / fix |
---|---|
camcontrol: ATA SETFEATURES… ABRT immediately | Disk does not support EPC – stay with APM instead. |
Sense key ILLEGAL REQUEST from umass | Bridge does not pass ATA commands ➜ try a different enclosure. |
Works on SATA but not on USB | Same as above – or the bridge only supports 12-byte pass-through. FreeBSD uses 16-byte by default; rebuild kernel with CAM_ATA_PASS_THROUGH_12 or test with smartctl -d sat,12 to confirm. |
Settings work until reboot only | Add -s , or run the commands from an rc script. |
daX
/passY
node, enable EPC once, then configure timers or disable unwanted states with -c timer
/ -c state
.-s
if the drive firmware supports it; otherwise replay the commands at boot.After you have verified that your enclosure passes ATA commands, the examples above should let you tune or disable any power-saving state on the drive just as if it were plugged into a native SATA port.
How to solve "The epc subcommand only works with ATA protocol devices" error for command "camcontrol epc /dev/da1 -c status"
camcontrol: The epc subcommand only works with ATA protocol devices
camcontrol epc
refuses to run unless the CAM layer thinks the target speaks the ATA protocol.
When a disk is behind a USB–-to-SATA adapter the kernel sees it as a SCSI device (daX
).
If (and only if) the bridge advertises SAT (SCSI → ATA Translation) CAM marks the device internally as
PROTO_ATA
, so camcontrol epc
, apm
, SMART, etc. work.
If the bridge does not expose SAT CAM marks it PROTO_SCSI
, and epc
bails out with the message you are seeing. Wikipedia The FreeBSD Forums
Step | Command | What you should see | What it means |
---|---|---|---|
1. Does the kernel think it’s ATA? | camcontrol identify /dev/da1 | A normal IDENTIFY block | Bridge is SAT-compliant → jump to step 3 |
passN: <…> SPC-4 SCSI device or “ATA IDENTIFY failed” | Bridge is not SAT-compliant → you cannot use epc , go to Only real fix below | ||
2. Double-check with smartctl | smartctl -d sat -i /dev/da1 | Drive info prints | Confirms SAT works |
smartctl -d sat,12 -i /dev/da1 prints but plain -d sat fails | Bridge only accepts 12-byte ATA PASS-THROUGH – see Old bridges below FreeBSD Manual Pages | ||
3. Now ask EPC again | camcontrol epc /dev/da1 -c status | EPC state/timers | Success – you’re done |
identify
worksOld bridges that only support 12-byte pass-through
FreeBSD uses the 16-byte SAT commands by default.
Re-build your kernel with
options CAM_ATA_PASS_12
or, on 14-CURRENT and newer, add to /boot/loader.conf
:
kern.cam.ata.pass_12=1
Then reboot and repeat the test. FreeBSD Manual Pages
Ancient userland / kernel
EPC support for SAT devices was completed in FreeBSD 13.0.
Make sure you’re on at least 13.2-RELEASE or any 14-STABLE snapshot.
If step 1 already shows a plain “SPC-4 SCSI device”, your enclosure does not forward ATA commands.
There is no software workaround – camcontrol epc
, SMART, APM, and friends will never work through that adapter.
You need a USB-SATA bridge that advertises SAT (look for chips such as ASMedia ASM1153/1153E, ASM235CM, JMicron JMS567/JMS578, Realtek RTL9210) or plug the disk into a native SATA port. The FreeBSD Forums
CAM_ATA_PASS_12
or update to a current kernel.camcontrol epc
works exactly as it does on a direct SATA port.Run the three-step checklist above and you’ll know immediately which case you have and how to proceed.