Setting Up RAID1 with GEOM on FreeBSD 8.1

After doing a default install I need to mirror my root hard drive. In the past I would have used ATA or CCD (Concatenated Disk Driver). I also have used Vinum which is a logical volume manager similar to Varitas Volume Manager or LVM in AIX. Reading though the notes and documentation I see that Vinum has been re-implemented as GEOM based and they have add a very easy subset called GEOM Mirror. That is what I went with.

All information and procedures was gleam from the always excellent FreeBSD Docs. There usually is no need to go else where, I find it convenient to distill the essential material down to these post purely for ease and convenience. These are instruction that while generally true are geared towards what I am doing.

Mirroring Whole Disks

  • Before building the mirror, enable additional debugging information and opening access to the device by setting the kern.geom.debugflags. sysctl kern.geom.debugflags=17
  • Begin the process by storing meta-data information on the primary disk device. gmirror label -vb round-robin gm0 /dev/da0

    Warning: Creating a mirror out of the boot drive may result in data loss if any data has been stored on the last sector of the disk.

  • load the /boot/kernel/geom_mirror.ko kernel module gmirror load
  • Enable loading of the geom_mirror.ko kernel module during system initialization echo 'geom_mirror_load="YES"' >> /boot/loader.conf
  • Edit the /etc/fstab file, replacing references to the old da0 with the new device nodes of the gm0 mirror device.
  • Reboot the system
  • Using the mount command check the gm0 is being used.
  • Add your second disk gmirror insert gm0 /dev/da1
  • Check status with gmirror status
Posted in FreeBSD -- Setup, UNIX | Leave a comment

Updating FreeBSD 8.1

After the box that was hosting the old FreeBSD box (version 6.x) finally gave up the ghost and knowing that I wanted to skip 7.x, I just finished a fresh install of 8.1. After setting up my accounts the next step is updating and patching. All material comes from the FreeBSD Handbook.

FreeBSD Update
This updates source, world and kernel.

  • I choose to use the defaults in /etc/freebsd-update.conf
  • Fetch the updates freebsd-update fetch
  • Apply the updates freebsd-update install
  • Reboot the systems shutdown -r now

If a rollback is needed the freebsd-update rollback

Updating Ports Collections

  • Download updated ports portsnap fetch
  • The first time portsnap is executed, you have to use extract to install the downloaded files. portsnap extract
  • Rest of the time portsnap update is OK.

Upgrading Ports
pkgdb -aF
portupgrade -ay

Updating Documentation Sources
cvsup -h -g -L 2 /usr/share/examples/cvsup/doc-supfile

Cleaning up Obsolete files, Directories and Libraries

  • check for obsolete files and libraries
    cd /usr/src
    make check-old
    make check-old-libs
  • If any obsolete files are found, deleted
    make delete-old
    make delete-old-libs
  • portsclean -D will purge old distfiles.
  • portsclean -C will clean all ‘work’ directories.
  • portsclean -L will clean up unused libraries in /usr/local/lib/compat/pkg.
  • portsclean -P will clean up outdated packages.
Posted in FreeBSD -- General, UNIX | Leave a comment

More RSS Injection Testing

I am playing around with my RSS feeds and see what items that can be added to them.

Posted in Personal | Tagged | Leave a comment

Testing RSS Injection

This is a test of rss injection, for another project.

Posted in Personal | Leave a comment

Add Line Break in Excel Cell

To add a line break in an excel cell:

Alt + Enter

Control + Option + Return

[ad name=”Google Adsense”]

Posted in Personal | Leave a comment

Setting Up a Test Site for an Existing WordPress Site

In preparation for an upgrade to an existing custom wordpress site, I wanted to create a sub-domain for testing. For example with a test site After setting up the site and DNS for test i need to copy the real site to the test site.

All info related to the actual change of the wordpress site and the database comes from this wonderful set of instructions.

Importing Data into the test site.

  • Copy the physical files from one site to another.
  • Export a copy of the real website’s MySQL db
  • Import data into your testsite db.

    mysql -u username -ppassword -h –default-character-set=utf8 db_name < realdomain_mysql_export.sql

Changing the wp_config.php

  • Make sure to modify the wp_config.php to point to the new db. The setting are found at the top of the file.

    // ** MySQL settings ** //
    define(‘DB_NAME’, ‘db_name‘); // The name of the database
    define(‘DB_USER’, ‘username‘); // Your MySQL username
    define(‘DB_PASSWORD’, ‘password‘); // …and password
    define(‘DB_HOST’, ‘‘);

Change site & home urls

  • Login to phpMyAdmin.
  • Click the link to Databases.
  • A list of dbs will appear. Choose the one that is the test WordPress db.
  • All the tables in the test db will appear.
  • Look for wp_options. Note: The table prefix of wp_ may be different if you changed it when installing.
  • Click on the small icon indicated as Browse.
  • A screen will open with a list of the fields within the wp_options table.
  • Under the field option_name, scroll down and look for siteurl.
  • Click the Edit Field icon which usually is found at the far left at the beginning of the row.
  • In the input box for option_value, change the URL information to the new address.
  • Verify this is correct and click Go to save the change.
  • You should be returned to your wp-options table.
  • Find the home field in the table and click Edit Field. Note There are several pages of tables inside wp_options. Look for the > symbol to page through them.
  • In the input box for option_value, change the URL information to the new address.
  • Verify this is correct and click Go to save the information.

Changing internal post links

There is one specific field you will need to change and that is the guid, you can also use this to switch links within you posts, but that is not required and left to your preferences.

  • Login to phpMyAdmin.
  • Click the link to your Databases.
  • Choose the one that is the test WordPress db.
  • Look for the name of the table within your database used to hold your post information. Usually it is called wp_posts, but it may have been changed.
  • Clicking the Browse icon or link, open the wp_posts table.
  • Look for the field that holds your post “guid”. It is usually called guid, but it may have been changed.
  • Click the tab at the top for SQL.
  • Switch the old and new URL addresses you wish to update or search and replace within your database:

    UPDATE wp_posts SET guid = REPLACE (

  • Make sure that the names of wp-posts and post_content match the tables and fields within your database. Change them if not.
  • Ensure that the ONLY content you want to change are within the little single ‘quotes’ . Make sure EVERYTHING is spelled right and that you are sure this is correct.
  • click Go.
  • At the top of the screen will be generated a list of how many of the tables and fields have been changed.
Posted in Web Related | Leave a comment

Playing with wordpress and moving sites

A friend of mine died recently and I needed to undertake an emergency move of the site from one vendor to another. Even though we were staying on the same platform and OS there was a quite a few difference between providers. As soon as I get some sleep I will relay this experience and the technical road blocks I ran into.

Posted in Web Related | Leave a comment

Upgrading from FreeBSD 6.2 to FreeBSD 6.4

I have been slack about keeping my BSD server up to date. I have a replacement box ready to install FreeBSD 7, but I noticed that 7.1 is about ready to move to RELEASE and 8 should be out shortly. Until the I decide which way I want to move, I have decided to update to the latest version of 6.x.

  • Find the version you are currently on

    # uname -a
    FreeBSD 6.2-RELEASE-p11 FreeBSD 6.2-RELEASE-p11 #0: Wed Feb 13 06:44:57 UTC 2008 i386

  • Create a cvsup file with the following information:

    *default base=/var/db
    *default prefix=/usr
    *default release=cvs
    *default delete use-rel-suffix compress
    src-all tag=RELENG_6_4
    ports-all tag=RELENG_6_4
    doc-all tag=RELENG_6_4

    This will update source, ports and docs.

  • Clean your source tree

    cd /usr/src && make cleanworld

  • Update your sources, ports and docs.

    cvsup -L 2 ./cvsupfile

    Go get a cup of coffee and relax for awhile. This step takes some time.

  • Make world & kernal, then install kernel

    # cd /usr/src
    # make buildworld
    # make buildkernel
    # make installkernel
    # nextboot -o "-s" -k kernel
    # reboot

  • The system will come up in single user mode, check and mount the file system.

    # fsck -p
    # mount -u /
    # mount -a -t ufs
    # swapon -a

  • Finish updating system

    # cd /usr/src
    # mergemaster -p
    # make installworld
    # mergemaster –Ui
    # reboot

  • Check that update worked

    # uname -a
    # FreeBSD 6.4-RELEASE-p1 FreeBSD 6.4-RELEASE-p1 #0: Sat Jan 3 15:31:37 EST 2009 i386

Posted in FreeBSD -- Setup | Tagged , | Leave a comment

Copyright Symbol on A Mac

Keyboard Shortcut:

hold option & press g.

Link to other symbols

Posted in Mac OS X | Leave a comment

Creating Joliet iso images on a Mac

Open Disk Utility and use the New Image from Folder menu item to create an image. Use uncompressed and use the CD/DVD master option.

Use hdiutil to convert cdr to iso

cd ~/Desktop
hdiutil makehybrid -iso -joliet -o Master.iso Master.cdr

This will create an ISO/Joliet .iso file.

Posted in Mac OS X | Leave a comment