List of hard drives in shell during installation

Hi,

Is there a way to get a list of hard drives while in the shell during installation (FreeBSD 10)? The best way I've come up with myself, is to run:

Code:
# sysctl -a | grep kern.geom.disk
<118>kern.geom.disk.ada0.led:
<118>kern.geom.disk.ada1.led:
<118>kern.geom.disk.cd0.led:

Thank you,

Philipp
 
Code:
% camcontrol devlist
<PLEXTOR PX-256M3 1.07>            at scbus0 target 0 lun 0 (ada0,pass0)
<WDC WD1002FAEX-00Z3A0 05.01D05>   at scbus2 target 0 lun 0 (ada1,pass1)
<AHCI SGPIO Enclosure 1.00 0001>   at scbus6 target 0 lun 0 (pass2,ses0)

It might show a few extra devices. I don't know what that last one is, actually.

Another option:
Code:
% ls /dev/ada?
/dev/ada0	/dev/ada1
 
The kern.disks sysctl(8) is supposed to be the list of all disks in the system, even the ones that are not yet controlled by a GEOM consumer.
 
schmidp said:
Code:
# sysctl -a | grep kern.geom.disk
<118>kern.geom.disk.ada0.led:
<118>kern.geom.disk.ada1.led:
<118>kern.geom.disk.cd0.led:
There's really no need to grep through the whole list ;)

Code:
dice@molly:~> sysctl -a kern.geom.disk
kern.geom.disk.ada0.led:
kern.geom.disk.ada1.led:
kern.geom.disk.ada2.led:
kern.geom.disk.ada3.led:
kern.geom.disk.ada4.led:
kern.geom.disk.ada5.led:
kern.geom.disk.ada6.led:
kern.geom.disk.ada7.led:
kern.geom.disk.ada8.led:
kern.geom.disk.da0.led:

I didn't know that one but @kpa has a better one, easy to remember too:
Code:
dice@molly:~> sysctl kern.disks
kern.disks: da0 ada8 ada7 ada6 ada5 ada4 ada3 ada2 ada1 ada0
 
Last edited by a moderator:
You don't even need the -a: # sysctl kern.geom.disk.

Edit: Or, as listed by @kpa: # sysctl kern.disks.
 
Last edited by a moderator:
wblock@ said:
Code:
% camcontrol devlist
<PLEXTOR PX-256M3 1.07>            at scbus0 target 0 lun 0 (ada0,pass0)
<WDC WD1002FAEX-00Z3A0 05.01D05>   at scbus2 target 0 lun 0 (ada1,pass1)
<AHCI SGPIO Enclosure 1.00 0001>   at scbus6 target 0 lun 0 (pass2,ses0)

It might show a few extra devices. I don't know what that last one is, actually.
It is the enclosure services gizmo, modeled on the interface Solaris provided. If your system has a hot-swap backplane (or pretends to), you can query or manipulate its state with this device. There are a number of simple example programs in /usr/src/share/examples/ses. For example, on one of my systems (Dell PowerEdge R710, PERC H700 RAID controller, 6-slot hot-swap backplane), I get:

Code:
(0:136) hostname:/tmp# getencstat -v /dev/ses0
/dev/ses0: Enclosure Status <OK>
Element 0x0: Array device OK (Status=ok (bytes=0x01 0x80 0x00 0x00))
Element 0x1: Array device OK (Status=ok (bytes=0x01 0x80 0x00 0x00))
Element 0x2: Array device OK (Status=ok (bytes=0x01 0x80 0x00 0x00))
Element 0x3: Array device OK (Status=ok (bytes=0x01 0x80 0x00 0x00))
Element 0x4: Array device OK (Status=ok (bytes=0x01 0x80 0x00 0x00))
Element 0x5: Array device OK (Status=ok (bytes=0x01 0x80 0x00 0x00))
Other non-disk devices will also show up. This is a 48-slot robotic tape library:

Code:
(0:2) host1:~terry# camcontrol devlist
...
<IBM ULT3580-HH4 C7QJ>             at scbus7 target 0 lun 0 (pass4,sa0)
<IBM 3573-TL C.30>                 at scbus7 target 0 lun 1 (pass5,ch0)
...
The first one is the actual tape drive (the library has a drive permanently assigned to this host) and the second is the changer control interface, which can be manipulated via the misc/mtx port, among other tools.
 
It is the enclosure services gizmo, modeled on the interface Solaris provided. If your system has a hot-swap backplane (or pretends to), you can query or manipulate its state with this device. There are a number of simple example programs in /usr/src/share/examples/ses. For example, on one of my systems (Dell PowerEdge R710, PERC H700 RAID controller, 6-slot hot-swap backplane), I get:

Code:
(0:136) hostname:/tmp# getencstat -v /dev/ses0
/dev/ses0: Enclosure Status <OK>
Element 0x0: Array device OK (Status=ok (bytes=0x01 0x80 0x00 0x00))
Element 0x1: Array device OK (Status=ok (bytes=0x01 0x80 0x00 0x00))
Element 0x2: Array device OK (Status=ok (bytes=0x01 0x80 0x00 0x00))
Element 0x3: Array device OK (Status=ok (bytes=0x01 0x80 0x00 0x00))
Element 0x4: Array device OK (Status=ok (bytes=0x01 0x80 0x00 0x00))
Element 0x5: Array device OK (Status=ok (bytes=0x01 0x80 0x00 0x00))
.

On my Lenovo T140 server, looks getencstat does not have any useful output.
Code:
root@FS1:/usr/share/examples/ses/getencstat # uname -a
FreeBSD FS1 10.1-RELEASE-p3 FreeBSD 10.1-RELEASE-p3 #0: Sat Jan 10 02:03:08 PST 2015  root@FS1:/usr/obj/usr/src/sys/GENERIC  amd64
root@FS1:/usr/share/examples/ses/getencstat # camcontrol devlist
<WDC WD2003FYYS-02W0B1 01.01D02>  at scbus0 target 0 lun 0 (ada0,pass0)
<WDC WD2003FYYS-02W0B1 01.01D02>  at scbus1 target 0 lun 0 (ada1,pass1)
<PLDS DVDROM DH16D7SH WL3B>  at scbus2 target 0 lun 0 (cd0,pass2)
<AHCI SGPIO Enclosure 1.00 0001>  at scbus3 target 0 lun 0 (ses0,pass3)
root@FS1:/usr/share/examples/ses/getencstat # ./getencstat -v /dev/ses0
/dev/ses0: Enclosure Status <OK>
Element 0x0: Array Device Slot, status: Unsupported (0x00 0x00 0x00 0x00)
Element 0x1: Array Device Slot, status: Unknown (0x06 0x00 0x00 0x00), descriptor: 'SLOT 000'
Element 0x2: Array Device Slot, status: Not Installed (0x05 0x00 0x00 0x00), descriptor: 'SLOT 001'
Element 0x3: Array Device Slot, status: Not Installed (0x05 0x00 0x00 0x00), descriptor: 'SLOT 002'
Element 0x4: Array Device Slot, status: Unknown (0x06 0x00 0x00 0x00), descriptor: 'SLOT 003'
Element 0x5: Array Device Slot, status: Unknown (0x06 0x00 0x00 0x00), descriptor: 'SLOT 004'

Any hints so that I can fix this?
 
On my Lenovo T140 server, looks getencstat does not have any useful output.

Any hints so that I can fix this?
I just tried this on my 10-STABLE system and got:
Code:
(0:22) test2:/sysprog/terry# camcontrol devlist
<PLDS DVD+-RW DS-8A3S HD52>  at scbus1 target 0 lun 0 (pass0,cd0)
<SEAGATE ST9146852SS HT66>  at scbus3 target 0 lun 0 (pass1)
<SEAGATE ST9146852SS HT66>  at scbus3 target 1 lun 0 (pass2)
<SEAGATE ST9146852SS HT66>  at scbus3 target 2 lun 0 (pass3)
<SEAGATE ST9146852SS HT66>  at scbus3 target 3 lun 0 (pass4)
<SEAGATE ST9146852SS HT66>  at scbus3 target 4 lun 0 (pass5)
<SEAGATE ST9146852SS HT66>  at scbus3 target 5 lun 0 (pass6)
<DP BACKPLANE 1.07>  at scbus3 target 32 lun 0 (ses0,pass7)
(0:23) test2:/sysprog/terry# getencstat -v /dev/ses0
/dev/ses0: Enclosure Status <OK>
Element 0x0: Array Device Slot, status: Unsupported (0x00 0x00 0x00 0x00)
Element 0x1: Array Device Slot, status: OK (0x01 0x80 0x00 0x00)
Element 0x2: Array Device Slot, status: OK (0x01 0x80 0x00 0x00)
Element 0x3: Array Device Slot, status: OK (0x01 0x80 0x00 0x00)
Element 0x4: Array Device Slot, status: OK (0x01 0x80 0x00 0x00)
Element 0x5: Array Device Slot, status: OK (0x01 0x80 0x00 0x00)
Element 0x6: Array Device Slot, status: OK (0x01 0x80 0x00 0x00)
Element 0x7: Array Device Slot, status: Not Installed (0x05 0x00 0x00 0x00)
Element 0x8: Array Device Slot, status: Not Installed (0x05 0x00 0x00 0x00)
So I would tend to think that your backplane firmware is the problem - it doesn't seem to know what is in your slots 0, 3, and 4. Your backplane might only report on Lenovo-branded drives (sometimes vendors do that). Based on your reported "AHCI SGPIO Enclosure 1.00 0001", I'd suggest seeing if Lenovo has a firmware upgrade for your backplane controller available.

You might find this document useful to see what devices FreeBSD talks to and how it interprets the responses.
 
Thanks Terry,
That is a good document, and have read a couple of times since wondering whether I can do some enhancement. Unlike high end server, there is no back plane for TS140. I connected two disks directly to SATA port on motherboard. Will go to Lenovo website to take a look.
 
Back
Top