How to get disk drive information in FreeBSD
To acquire the information related to disk drives and cd ROMs, etc., the most straightforward path we can take is to head over to /var/run/dmesg.boot file and accessing the file. This is where the required information is kept in a snapshot, taken right after the system mounts the disk drives.
Listing disk drives with egrep
To find out the exact number of hdds/ssds are working under the server, use the grep command as under:
Alternatively, you may put:
The output you’ll get should list all of the disk drives, including cd/DVD ROMs being read by your system.
Using geom utility to list disk-drive information:
You can use the geom command line to show disk drive information as well:
This listing can be made more specific when combined with the grep command.
Using atacontrol command to list disk drives
Using the atacontrol command-line utility, we can list the disk drives working within our system. The atacontrol command is used to gain permission to work with the FreeBSD ata subsystems and should be used with caution. If executed improperly, it can cause the CPU to crash, leading to some unrecoverable data loss.
Disk drive information with camcontrol command
You can also use the camcontrol command to access the CAM subsystem and see the working drives on your system. This is made possible by the CAM subsystem, a modular system that drivers for ATA and SCSI devices use to implement. The CAM system also accommodates host adapter drivers for the SCSI and ATA host controllers.
To present a list of disk-drives on your system, type in:
To see details on each partition:
Find out the disk sizes with the diskinfo command
Use the diskinfo command to acquire information on the disk sizes
$ diskinfo -v ada1
$ diskinfo -v ada0
Installing and using the lsblk command
Enter the line below to install the lsblk command for use later:
Then run the lsblk command:
To list all of the detectable disks on your FreeBSD
To display info on a specific disk, use a similar syntax to the command below, which is requesting info for ada0 disks:
Wrapping up
This tutorial presents different ways to obtain information on disk-drives in a FreeBSD system. We’ve presented commands and methods that are very different from each other, as they have wildly different intended applications.