This page looks best with JavaScript enabled

Disks and partitions in FreeBSD

 ·  🎃 kr0m

When managing FreeBSD operating systems, it will eventually be necessary to identify the disks and partitions of the installed hard drives. In this manual, we will show the disks using camcontrol, the partitions using gpart, and the ZFS pools using zpool.

We show the hard disks:

camcontrol devlist

<Samsung SSD 850 EVO 500GB EMT02B6Q> at scbus0 target 0 lun 0 (ada0,pass0)
<WDC WD10EAVS-00D7B1 01.01A01> at scbus1 target 0 lun 0 (ada1,pass1)
<WDC WD60EFRX-68L0BN1 82.00A82> at scbus4 target 0 lun 0 (ada2,pass2)
<KINGSTON SA400S37120G SBFK71E0> at scbus7 target 0 lun 0 (ada3,pass4)
<WDC WD20EARX-00PASB0 51.0AB51> at scbus8 target 0 lun 0 (ada4,pass5)

The kernel can also show us the present disks:

sysctl kern.disks

kern.disks: ada4 ada3 ada2 ada1 ada0

The partitions:

gpart show

=>       34  976773101  ada0  GPT  (466G)
         34       2014        - free -  (1.0M)
       2048    2097152     1  ms-basic-data  (1.0G)
    2099200     921600     2  ms-recovery  (450M)
    3020800     204800     3  efi  (100M)
    3225600      32768     4  ms-reserved  (16M)
    3258368  459642880     5  ms-basic-data  (219G)
  462901248  513871887     6  linux-data  (245G)

=>        63  1953525105  ada1  MBR  (932G)
          63        1985        - free -  (993K)
        2048  1953521664     1  linux-data  (932G)
  1953523712        1456        - free -  (728K)

=>       2048  11721043087  ada2  GPT  (5.5T)
         2048  11721043087     1  linux-data  (5.5T)

=>       40  234441568  ada3  GPT  (112G)
         40     409600     1  efi  (200M)
     409640       1024     2  freebsd-boot  (512K)
     410664        984        - free -  (492K)
     411648    4194304     3  freebsd-swap  (2.0G)
    4605952  229834752     4  freebsd-zfs  (110G)
  234440704        904        - free -  (452K)

=>        63  3907029105  ada4  MBR  (1.8T)
          63        1985        - free -  (993K)
        2048  3907026944     1  ntfs  (1.8T)
  3907028992         176        - free -  (88K)

NOTE: gpart list can also be useful if we want to obtain more detailed information about the disks.

And the ZFS pools:

zpool list

NAME    SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
zroot   109G  15.8G  93.2G        -         -     7%    14%  1.00x  ONLINE  -
zpool status
  pool: zroot
 state: ONLINE
  scan: none requested
config:
    NAME        STATE     READ WRITE CKSUM
    zroot       ONLINE       0     0     0
      ada3p3    ONLINE       0     0     0

errors: No known data errors
If you liked the article, you can treat me to a RedBull here