FreeBSD - list disks drive in the system with atacontrol and camcontrol
FreeBSD uses ad prefix for IDE/SATA disks and da prefix for SCSI and other technologies disks.
ad ATAPI (IDE) disk
da SCSI direct access disk
acd ATAPI (IDE) CDROM
cd SCSI CDROM
fd Floppy disk
A snapshot of all the information and hardware detected by the kernel at boot time is kept in /var/run/dmesg.boot file.
List all hard disk drives installed into FreeBSD and detected by kernel using atacontrol
Code:
# egrep '^ad[0-9]|^da[0-9]' /var/run/dmesg.boot
ad0: 152627MB at ata0-master UDMA33
ad1: 38166MB at ata0-slave UDMA33
Above information shows two ide disks, 160GB and 40GB size as well as model number, access mode and status.
If the disks are ATA disks, like in the above example, atacontrol utility can show information regarding ATA channel and status of each disk:
Code:
# atacontrol list
ATA channel 0:
Master: ad0 <ST3160215A/3.AAD> ATA/ATAPI revision 7
Slave: ad1 <WDC WD400BB-32CFC0/02.08B02> ATA/ATAPI revision 5
ATA channel 1:
Master: no device present
Slave: no device present
# atacontrol info ata0
Master: ad0 <ST3160215A/3.AAD> ATA/ATAPI revision 7
Slave: ad1 <WDC WD400BB-32CFC0/02.08B02> ATA/ATAPI revision 5
Above example shows that both disks are using the same ata channel (0) and that the Seagate is Master and WesternDigital disk is the slave.
ATTENTION !!! Using atacontrol utility with other arguments other than info|list meight harm your system.
Quote:
Man atacontrol(8):
ATACONTROL(8) FreeBSD System Manager's Manual ATACONTROL(8)
NAME
atacontrol -- ATA device driver control program
SYNOPSIS
atacontrol args
atacontrol attach channel
atacontrol detach channel
atacontrol reinit channel
atacontrol create type [interleave] disk0 ... diskN
atacontrol delete raid
atacontrol addspare raid disk
atacontrol rebuild raid
atacontrol status raid
atacontrol mode device
atacontrol info channel
atacontrol cap device
atacontrol list
DESCRIPTION
The atacontrol utility is a control program that provides the user access
and control to the FreeBSD ata(4) subsystem.
The atacontrol utility can cause severe system crashes and loss of data
if used improperly. Please exercise caution when using this command!
The channel argument is the ATA channel device (e.g., ata0) on which to
operate. The following commands are supported:
FreeBSD list disk using camcontrol
Another method to list hard disks in a FreeBSD system is the "camcontrol" command:
Code:
# camcontrol devlist
<NECVMWar VMware IDE CDR10 1.00> at scbus1 target 0 lun 0 (cd0,pass0)
<VMware Virtual disk 1.0> at scbus2 target 0 lun 0 (pass1,da0)
<AMCC 9650SE-4LP DISK 4.10> at scbus2 target 1 lun 0 (pass2,da1)
# camcontrol devlist -v
scbus0 on ata0 bus 0:
<> at scbus0 target -1 lun ffffffff ()
scbus1 on ata1 bus 0:
<NECVMWar VMware IDE CDR10 1.00> at scbus1 target 0 lun 0 (cd0,pass0)
<> at scbus1 target -1 lun ffffffff ()
scbus2 on mpt0 bus 0:
<VMware Virtual disk 1.0> at scbus2 target 0 lun 0 (pass1,da0)
<AMCC 9650SE-4LP DISK 4.10> at scbus2 target 1 lun 0 (pass2,da1)
<> at scbus2 target -1 lun ffffffff ()
scbus-1 on xpt0 bus 0:
<> at scbus-1 target -1 lun ffffffff (xpt0)
From the manual:
Quote:
...
devlist List all physical devices (logical units) attached to the CAM
subsystem. This also includes a list of peripheral drivers
attached to each device. With the -v argument, SCSI bus num-
ber, adapter name and unit numbers are printed as well. On
the other hand, with the -b argument, only the bus adapter,
and unit information will be printed, and device information
will be omitted.
...