FreeBSD
FreeBSD Update / Upgrade Release
The freebsd-update(8) utility supports binary upgrades of i386 and amd64 systems running earlier FreeBSD releases. Systems running 7.[012]-RELEASE, 8.0-BETA[1234], or 8.0-RC[123] can upgrade as follows:
freebsd-update upgrade -r 11.0-RELEASE
During this process, FreeBSD Update may ask the user to help by merging some configuration files or by confirming that the automatically performed merging was done correctly.
freebsd-update install
The system must be rebooted with the newly installed kernel before continuing.
shutdown -r now
After rebooting, freebsd-update needs to be run again to install the new userland components:
freebsd-update install
Finally, reboot into 11.0-RELEASE:
shutdown -r now
Rebuild the complete Server
These concerns have led to the following recommended sequence. Note that the detailed sequence for particular updates may require additional steps, but this core process should remain unchanged for some time:
make -s buildworld
This first compiles the new compiler and a few related tools, then uses the new compiler to compile the rest of the new world. The result ends up in /usr/obj.
make -s buildkernel KERNCONF=CUSTOM
Unlike the older approach, using config(8) and make(1), this uses the new compiler residing in /usr/obj. This protects you against compiler-kernel mismatches.
make -s installkernel
Place the new kernel and kernel modules onto the disk, making it possible to boot with the newly updated kernel.
Reboot into single user mode.
Single user mode minimizes problems from updating software that's already running. It also minimizes any problems from running the old world on a new kernel.
mergemaster -p
This does some initial configuration file updates in preparation for the new world. For instance it may add new user groups to the system, or new user names to the password database. This is often necessary when new groups or special system-user accounts have been added since the last update, so that the installworld step will be able to use the newly installed system user or system group names without problems.
make -s installworld
Copies the world from /usr/obj. You now have a new kernel and new world on disk.
mergemaster -FiU
Now you can update the remaining configuration files, since you have a installed new world on disk (FreeBSD Basic Operation System Files).
Reboot.
Tuning Make Info: Remark: If you have a Multi CORE CPU System you often read Tuning Tips on setting "-j5" after the make Option! Don't use it on Production Systems it can break the Build Process cause the Maintainer / Developers of the Pakets SET the correct Settings for successful and clean builds!! Often Users asked me why the "build world" breaks or the "port build" breaks! Make Process runs safe on normal Mode, cause it prevent the build processes from blocking access each other or on Library Files!!! Give the System to compile clean and safe..
Ports Update / Additional Apps
Download a local Copy of the Ports Database and Files to /usr/ports tree
portsnap fetch
Extract the Ports Database and Files to /usr/ports
portsnap extract
Install a useful Port Manager for easy handling
pkg add -r portupgrade
Port Upgrade ALL the local Ports Database and Files at /usr/ports tree, use Option "-af" to get a clean ports Collection! (prevent old broken Lib Links)
portupgrade -af
Resume a broken portupgrade Process without reinstall ALL
Console Message:
* multimedia/ffmpeg (ffmpeg..) ! x11-toolkits/libYaw (libXaw ..) (uninstall error)
remove manual the outdated port:
pkg delete portname
now copy Message of all listed ports to a text file called fail.txt
resume with formated list:
format:
awk '{print $2}' fail.txt > resume.txt
resume:
resume.txt|xargs portupgrade -f
Ports Tree Cleanup
(Remark portmaster isn't a builtin tool, it's external tool of ports tree!)
first backup /usr/ports
tar -cvzf /backups/ports-tree.tgz /usr/ports
now cleanup
cd /usr/ports portmaster --check-depends portmaster --check-port-dbdir portmaster -s portmaster -y --clean-distfiles
Sources Tree Cleanup
first backup /usr/src
tar -cvzf /backups/src-tree.tgz /usr/src
now cleanup
rm -rf /usr/src/*
Objects Tree Cleanup
do
cd /usr/obj chflags -R noschg * rm -rf *
This should save much Space on your Server! Perhaps move the Backups to external Disk!
Raid1 gmirror
set Kernel Flags for gmirror
sysctl kern.geom.debugflags=17
create mirror database of mirror named gm0
gmirror label -vb round-robin gm0 /dev/disk0
load mirror Kernel module into active Kernel
gmirror load
Set gmirror module to load on boot
echo 'geom_mirror_load="YES"' >> /boot/loader.conf
change /etc/fstab
/dev/XXX to /dev/mirror/gm0diskpartitions
reboot..
gmirror error Handling
if
gmirror status
shows old raid data then delete the disk with Live CD
dd if=/dev/null of=/dev/disk count=1
or try gmirror remove gm0 disk,
gmirror remove gm0 /dev/ad0 gmirror remove gm0 /dev/ad2
change mount points at /etc/fstab from /dev/gmirror/xxxx to /dev/disk0
after this reboot and reinstall gmirror new!
Customize FreeBSD
Auto fsck on every boot Check disk and Auto Repair Filesystem after hard Server Crash