When I attach a disk to FreeBSD I can list any attached disks by doing:

[root@freenas] ~# sysctl kern.disks
kern.disks: xbd2 xbd1 ada0
[root@freenas] ~#

How can I then find out the size of each attached disk?


diskinfo -v ada0 if you just want to see disk size.

If you want to use this info in some script, you can parse sysctl -n kern.geom.confxml output.

| improve this answer | |
  • diskinfo is better, you get points. – Phil Oct 8 '15 at 1:38

Geometry of each disk can be shown by fdisk ada0 utility.

Disks used for filesystems are shown by mount with no args.

Accessible capacity of the filesystem on a disk can be viewed by df -h <filesystem>

| improve this answer | |
  • fdisk seems to be the answer. – Phil Oct 7 '15 at 8:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.