FreeBSD

Send command results per email

ll | mail -s "Test - delete me" root

Use top to monitor I/O on FreeBSD

~# top -m io -o total

~# iostat -w 1

Monitor disk activity

gstat – print statistics about GEOM disks
-a Only display providers that are at least 0.1% busy.
-p Only display physical providers (those with rank of 1).

gstat -p

sesutil

sesutil – Utility for managing SCSI Enclosure Services (SES) device

sesutil map -u /dev/ses0
sesutil fault -u /dev/ses0 da15 on
sesutil locate all off
sesutil fault all off

Netstat

netstat -4an

Check disk usage of a directory

  • -A Display the apparent size instead of the disk usage. This can be helpful when operating on compressed volumes or sparse files.
  • -h “Human-readable” output. Use unit suffixes: Byte, Kilobyte, Megabyte, Gigabyte, Terabyte and Petabyte.
  • -d depth Display an entry for all files and directories depth directories deep.
du -hAd1 .
du -hAxd1 Documents/archived | sort -hr

Hardware info

pciconf -lv
lspci
lspci -s 81:00.0 -vvv | grep Width

Tunables

ARC stuff

vm.kmem_size = 800G
vm.kmem_size_max = 800G
vfs.zfs.arc_max = 780G

rsync between datasets (FreeNAS only ?)

The –no-perms seems mandatory. If not present, the receiving side refuses to create a temporary file to get the contents and the copy aborts.

rsync -ah --one-file-system --info=progress2 --no-perms /mnt/pool/dataset1/stuff /mnt/pool/dataset2/
rsync -avzh --chown="DOM\user":"DOM\group" --progress --no-perms /mnt/pool/dataset1/stuff /mnt/pool/dataset2/

List running processes and kill a group

Useful for stopping a replication task, for instance…

ps x -o "pid pgid tty time command"
kill -TERM -4180

SMB

smbstatus – report on current Samba connections

smbstatus -L
smbstatus --locks

Camcontrol

camcontrol — CAM (Common Access Method) control program

camcontrol devlist

Source: https://www.freebsd.org/cgi/man.cgi?query=camcontrol