What do I do when VolGroup00 is not found when upgrading Fedora?

Recently, I upgraded my Fedora system from Fedora 9 to Fedora 10.  I used the new preupgrade utility and all seemed to go well.  Everything was great until the system rebooted and failed to find any of my logical volumes, VolGroup00 in particular.  Here is the sequence of steps I took to fix the problem:

  1. Download the Fedora 10 DVD
  2. Brun the ISO to DVD
  3. Boot from the Fedora 10 DVD and select the recovery mode option from the menu
  4. Follow the on-screen prompts

Once at a command prompt, here is what I did:

chroot /mnt/sysimage
cd /boot
mkinitrd -f -v --with=scsi_wait_scan initrd-2.6.27.7-134.fc10.i686.img 2.6.27.7-134.fc10.i686

This will recreate the ramdisk that is needed at boot time. This forces it to readd all pertinent ATA, SCSI, and hard disk controller drivers and relink all the libraries and modules.  This happened twice to me, once when going from FC 9 to FC 10, then again when going from kernel 2.6.27.5-117 to 2.27.7-134.

How to mount to remote NAS storage using Samba?

On Fedora 10 Linux, you can issue the following commands to mount a remote NAS storage system, such as the Buffalo Terastation family of NAS appliances:

mkdir -p /mnt/samba
/sbin/mount.cifs //buffalo-nas.acme.com/share1 /mnt/samba -o user=root,pass=Pa55w0rd

This command assumes that you have defined a share called "share1" on the buffalo-nas.acme.com appliance with a root account.

NOTE: you must have samba rpms installed for this to work.

While this works from the command line to mount the remote Samba or CIFS, you may want to have this performed automatically at system boot time.  On Fedora Linux, the best way to do this is to create a credentials file for the root user.  Do this by creating /root/.smbpassword as follows:

username=root
password=Pa55w0rd

Next, add the following to the /etc/fstab file:

//buffalo-nas.acme.com/share1 /mnt/samba cifs noauto,\
credentials=/root/.smbpassword,rw,umask=008 0 0

Consult the manpage for mount.cifs to see all the possible arguments and values.

How to find files older than 7 days with UNIX find

A useful command frequently used in backup scripts is the find command.  The UNIX find command can locate files based upon the time the files were last changed, accessed, or modified using the -ctime, -atime, or -mtime respectively.  So, to find all files in a directory that are older than 7 days might look like this:

find /home/myuser -mtime +7 -print

If you are trying to remove files that are older than 7 days, you can use pipe the output of the find command to xargs. You will want to set the -r option for xargs in case there is no output. The -r flag in xargs tells the command to skip execution when there is no data.

find /home/myuser -type f -mtime +7 -print0 | xargs -o rm -rf

The command above will perform a deep or recursive search for any files in /home/myuser and remove them. The -print0 argument will enable this search to find files in that path that may contain spaces in the file names.

MySQL Backup and Maintenance

mysql logo

Anyone operating a MySQL database server should have a sound maintenance and backup plan to either eliminate or significantly reduce the risk of data corruption or complete loss of data.  This article is the result of a recent event in which I nearly lost all my data.   MySQL can be effectively maintained using the following three task plan:

  1. Enable MySQL built-in auto recovery features
  2. Perform routine table checks, optimization, and repairs
  3. Database and binary log backups

Why does ucblib.so.1 get compiled into my software?

When compiling software on the Solaris OS, great care must go into setting the proper environment variables prior to building the software.  Recently while making an entire suite of libraries and application software, I noticed one of two things would happen:

  1. The software would not compile until /usr/ucblib was added to the library path
  2. The software would compile, but not run until /usr/ucblib was added to the library path

I found that some of my newly compiled software was linking in the legacy /usr/ucblib/ucblib.so.1 library.  To prevent this from happening, I removed /usr/ucb from my PATH environment variable, and made sure that /usr/ucblib was not defined in my LD_LIBRARY_PATH at build time.

The following command helps show library dependencies:

$ ldd httpd
        libz.so =>       /usr/lib/libz.so
        libssl.so.0.9.8 =>       /usr/sfw/lib/libssl.so.0.9.8
        libcrypto.so.0.9.8 =>    /usr/sfw/lib/libcrypto.so.0.9.8
        libaprutil-0.so.0 =>     /usr/sfw/lib/libaprutil-0.so.0
        libexpat.so.0 =>         /usr/lib/libexpat.so.0
        libiconv.so.2 =>         /usr/lib/libiconv.so.2
        libapr-0.so.0 =>         /usr/sfw/lib/libapr-0.so.0
        libsendfile.so.1 =>      /usr/lib/libsendfile.so.1
        librt.so.1 =>    /usr/lib/librt.so.1
        libm.so.1 =>     /usr/lib/libm.so.1
        libsocket.so.1 =>        /usr/lib/libsocket.so.1
        libnsl.so.1 =>   /usr/lib/libnsl.so.1
        libresolv.so.2 =>        /usr/lib/libresolv.so.2
        libpthread.so.1 =>       /usr/lib/libpthread.so.1
        libdl.so.1 =>    /usr/lib/libdl.so.1
        libc.so.1 =>     /usr/lib/libc.so.1
        libgcc_s.so.1 =>         /usr/sfw/lib/libgcc_s.so.1
        libaio.so.1 =>   /usr/lib/libaio.so.1
        libmp.so.2 =>    /usr/lib/libmp.so.2
        libthread.so.1 =>        /usr/lib/libthread.so.1
        /usr/platform/SUNW,Sun-Fire-V240/lib/libc_psr.so.1

The command issued above shows that the httpd binary file does NOT have any dependencies on the /usr/ucblib libraries.

How do I pass library and include path when building software?

There are times when you build newer system libraries and install them to non-standard system directories.   When you are building software that is dependent on these newer libraries, you sometimes have to pass the non-standard include and lib directories as arguments to the build process so that the new software can find its dependent libraries and header files.  The easiest way to do this is to set the CPPFLAGS and LDFLAGS. It is done as follows:

CPPFLAGS="-I/usr/local/openssl-0.9.8i/include \
          -I/usr/local/net-snmp-5.4.1/include \
          -I/usr/local/BerkeleyDB.4.1/include"
LDFLAGS="-L/usr/local/openssl-0.9.8i/lib \
         -L/usr/local/net-snmp-5.4.1/lib \
         -L/usr/local/BerkeleyDB.4.1/lib"