FreeBSD: Difference between revisions
(2 intermediate revisions by the same user not shown) | |||
Line 135: | Line 135: | ||
</source> | </source> | ||
</blockquote><!-- Filesystem --> | </blockquote><!-- Filesystem --> | ||
= Kernel Event Queue = | |||
<blockquote> | |||
See [[kqueue]]. | |||
</blockquote><!-- Kernel Events --> | |||
= Init/Services System = | = Init/Services System = | ||
Line 141: | Line 147: | ||
</blockquote><!-- Init System --> | </blockquote><!-- Init System --> | ||
= Logging = | |||
<blockquote> | |||
See [[FreeBSD syslogd]]. | |||
</blockquote><!-- Logging --> | |||
= Startup/Shutdown = | = Startup/Shutdown = |
Latest revision as of 13:29, 18 December 2022
Install Media Creation
Download one of the .img files from https://www.freebsd.org/where.html
Install Documentation: https://www.freebsd.org/doc/handbook/bsdinstall-pre.html
# dd to raw disk, not partition # (same 'dd' params on bsd and linux) dd if=FreeBSD-10.2-RELEASE-amd64-memstick.img of=/dev/da0 bs=1M conv=syncInstallation can also be scripted using the FreeBSD bsdinstall commandline tool.
Release Management
Updates from FreeBSD version (ex: 11.1 -> 11.2) are possible. See freebsd release management.
Package Management
Important Package Locations /usr/local/share/
Typical Package install location /etc/rc.d
/usr/local/etc/rc.d
Init script locations (find out what variables to use in rc.conf here) http://pkg.FreeBSD.org/FreeBSD:12:amd64/quarterly/All packages downloaded from here FreeBSD has three methods of installing programs. Ports, pkg_add, and pkg.
- Ports are the source code and makefiles, which must be compiled.
- Pkg_add are precompiled binaries.
- pkg, or PackageNG are also precompiled binaries, but they have \
been compiled from the ports tree. This is the preferred method of\ package management.
pkgng freebsd-ports Freebsd still supports pkg_add, but it's main package manager is pkgng.
Kernel Sourcecode
# Fetch kernel sourcecode, extract to /usr/src fetch -o /tmp ftp://ftp.freebsd.org/pub/`uname -s`/releases/`uname -m`/`uname -r | cut -d'-' -f1,2`/src.txz tar -C / -xvf /tmp/src.txz
Kernel Modules
/boot/kernel/
Kernel Module Location sudo kldload fuse ## Load a kernel module (by name) sudo kldstat ## Show all loaded kernel modules# /boot/loader.conf # this file contains all kernel-modules to be started on boot fuse_load="YES"See Also kld.
FileSystem
BSD FileSystem FreeBSD devfs Volume Management
camcontrol devlist # lists diskname/device (ada0, da0, ..) gpart show /dev/ada0 # list partition table ls /dev/disk/ # lists available disks/partitions ls /dev/diskid/ # lists disks by id
Create new UFSgpart destroy -F da1 ## delete MBG/gpt gpart create -s gpt da1 ## create GPT partition system. gpart add -t freebsd-ufs da1 ## create partition covering entire disk newfs -U /dev/da1s1 ## new ufs filesystem df -h /dev/da1s1 ## confirm size of filesystem is appropriateMount ZFS
zpool import -fR /mnt -a ## mount a zpool to /mntMount ext2/3/4
# see: https://www.freebsd.org/doc/handbook/filesystems-linux.html # requires port: sysutils/fusefs-ext2fs kldload ext2fs mount -t ext2fs /dev/ad1s1 /mntMount exfat
# requires port: sysutils/fusefs-exfat mount -t exfat /dev/ad1s1 /mntMount fat32
sudo mount -t msdosfs /dev/da0p1 /mnt
Kernel Event Queue
See kqueue.
Init/Services System
See FreeBSD-init.
Logging
See FreeBSD syslogd.
Startup/Shutdown
shutdown -p now reboot
Date/Time
## Query Date date ## prints current date/time ## Timezone ln -s /usr/share/zoneinfo/America/Toronto /etc/localtime ## Sync Current Time ntpdate -v -b in.pool.ntp.org ## set current date with ntp
Networking
See freebsd networking.
start/stop/restart network
# restart network service netif restart service routing restart # connect to network dhclient en01
TTY
FreeBSD currently uses freebsd vt as a console driver.
For historical drivers, see tty.
Firewall
See pf.
# unable to set subjectline? echo 'my body' | sendmail \ -fnoreply `# ${user}@domain.com -- where domain.com is rc.conf hostname` \ -F'No Reply' `# sender name` \
Containers
FreeBSD jails
Linux Emulation
See FreeBSD linuxlator .
Resource Management
Documentation
memory https://wiki.freebsd.org/Memory virtual memory https://www.freebsd.org/doc/en_US.ISO8859-1/books/arch-handbook/vm.html CPU
bsd top Memory
freebsd procfs bsd ps bsd top procstat bsd vmstat Network
tcpdump pflog sockstat netstat
Backups & Restoration
freebsd dump