FreeBSD: Monitor svn Updates

If you use the  svn subversion tool to update source tree or ports tree, you want to have a possibility to look back what was pulled, pushed and droped you can use a Log File to monitor the update scripts. This helps if you temporarily log out the Terminal Sessions for a Coffee break.

Howto:

  • Login to FreeBSD via SSH
  • Use a tmux program like screen or tmux, if not installed, then install it. This allows ongoing operations on disconnects
  • Run on the Terminal
    $tmux
  • Run
     $sudo svn update /usr/src > /home/updates/svn.log #exit STRG+B then press "d" detach
    
  • The svn script goes on at background and write the output to the svn.log
  • To read at realtime the log do
    $tail -f /home/updates/svn.log #remark this allow no interaction!
  • Later you can read the Log again to view what files were, dropped, updated, created. This helps to find MAJOR CHANGES!

FreeBSD: Current Version port upgrade fails with „portsnap extract“ bug

If you use the current „head“ Version (Release 12) of FreeBSD with a svn updated /usr/src path you could run into errors after updating the OS via buildworld from sources.

There’s a bug ahead Revision „r314099“ at the „portsnap“ lib that will stop on extracting the ports.tgz to /usr/ports!

Solution: Pull again sources to /usr/src with

$svn update /usr/src
$make buildworld
$make buildkernel
$make installkernel
$reboot
$mergemaster -p
$make installworld
$mergemaster -FiU
$reboot
$portsnap fetch update #again.. to update ports tree
$portupgrade -a
$reboot

This should work now, the failed portsnap extract function was a known bug. If you dont want to rebuild the system, you can use svn to update /usr/ports via svn repository. You can later rebuild the source OS again.

FreeBSD: Clicking noise Harddrive SATA WDC WD5000LPVX SATA 3 Drive on FreeBSD 9.1

FreeBSD: Clicking noise WDC WD5000LPVX SATA 3 Drive on FreeBSD 9.1

same like in Linux:
APM Funktion starts/stops the heads and make click sounds, not needed on a Server. To disable like in Linux with hdparm on FreeBSD do:

If you want to disable APM (Advanced Power Management) on your hard drive to reduce heads movements and increase your hard drive life you can do that very easy by using ataidle app from FreeBSD’s Ports:

cd /usr/ports/sysutils/ataidle
make install clean; rehash

Then to disable APM on your hard drive run:
ataidle -P 0 /dev/ad0

We can start ataidle app at FreeBSD boot time by adding the following lines in /etc/rc.conf (the second line correspond to our previous command that we want to run at boot time):
ataidle_enable="YES"
ataidle_devices="ada0"
ataidle_ada0="-P 0"

Remark: most Server SATA Controllers change HDD Names like from ad6 to ada0, read last lines of „dmesg“ and see, „Drive ada0: Previously was known as ad6“ Message!!!

Linux Tip: Split Console Screen on Widescreen Laptop / PCs with „screen“ and „terminator“

Current Laptops / PCs uses 16:9 Widescreen Displays and if you dont want to use Xorg (Gnome,unity,Openbox Desktops)

you can use on Linux Console the program called „screen“ it offers:

– Split Consoles horizontally and vertically
– disconnect the screen and let the scripts/commands active on remote Systems
– reconnect if the remote Session was broken cause network problems

On Gnome or unity you can use „terminator“

screen-tiled

see:

– manpage of screen
– http://unix.stackexchange.com/questions/7453/how-to-split-the-terminal-into-more-than-one-view

Linux FreeBSD: Protect your Disc Data against power loss

Problem: If you use IDE or SATA Disc Drives inside your Workstation or Server without a additional uninterruppted power supply after a power loss your Disc Drives can lose data, do not boot clean up agian or damage the drive headers and sectors.

Background: SATA or IDE Drives uses „Disc Cached Controllers“, the count of this disc cache reach from 8 to 64 megabytes. In case of data write to disc, the disc controllers do cache some data who are often used. A Raid 1 Disc Mirror is affected too by this problem. SCSI od SAS are not using Cache by default.

Solution:

Install the software tool called hdparm to set the cache parameters to disabled, cause most of operating systems have enabled by default.

  1. at Debian/ubuntu do : # sudo aptitude install hdparm
  2. at Centos/Redhat do:  #sudo yum install hdparm

now lets show discs which are installed:

  1. at Debian/ubuntu do: # sudo fdisk -l
  2. at Centos/Redhat do: #sudo  /sbin/sfdisk -l
  3. at FreeBSD do: # fdisk -l

yet lets take settings to disable the cache on every boot:

  1. at all linux do: sudo nano /etc/rc.local
  2. insert for every drive
    hdarm -W 0 /dev/sdX
    (X is for a to …)
  3. at FreeBSD  do : #vi /etc/loader.conf
  4. insert once for all drives 
    hw.ata.wc="0"

Remarks:

  1. If you have two drives with same physical size inside your PC config a mdadm Software Raid 1 additional on your System.
  2. Set the PC Bios Settings to auto boot ofter power failure and plug off the power on you testing System, check the results. There should not be needed a check disk called fsck after the Test, but its better to do it.
  3. Hardware Raid Controllers do often have RAM Cache too, size 128MB up to 2GB, at power loss these Data lost, this can only be surpressed by a addtition RAM Cache Backup Battery connected to the Hardware Raid Controller

 

FreeBSD Linux: Remove Clear GPT Partition Table from drives

Problem: FreeBSD 9 use GPT Partitionlabel by default to remove with Linux do:

fdisk message: WARNING: GTP (GUID Partition Table) detected on '/dev/sdX'
The util fdisk isn't support GPT.

do on console:
sudo parted /dev/sdX

mklabel msdos (Enter Yes!)
quit

now use Linux fdisk to recreate a new partion Table

Hardening Freebsd 7.1 Filesystem with Raid1 and Journal

Problem: If you setup a free freebsd webserver with two disks on same size the ufs2 filesystem fails the gmirror raid1 if the server lost power. The problem is that open files are destroyed.

Solution: If you setup a new freebsd system create for every partition a extra partition (for journal) install the gjournal AFTER GMIRROR!! and make some power failure tests. After powerfailure the system must reboot and rebuild its mirror and should run online after rebuild without any problem.

Howto for

  1. gmirror
  2. gjournal