Sunday, November 23, 2008

High Level Overview: Duplicating Linux Multi-Boot Systems

Assumptions:
-- 2 drives, /dev/sda and /dev/sdb, roughly 160GB each.
-- Each node has identical h/w, including drives.
-- Partitions:
sda1(/boot), sda2(swap), sda3(OS #1), sda4(extended, containing 5-9), sda5(OS #2), sda6(OS #3), sda7(OS #4), sda8(OS #5), sda9(OS #6), sdb1(OS #7), sdb2(OS #8), sdb3(OS #9), sdb4(extended, containing 5-9), sdb5(OS #10), sdb6(OS #11), sdb7(OS #12), sdb8(OS #13), sdb9(OS #14)
-- All partitions are compatible with the partimage utility. EXT3 is the choice here.
-- GRUB installed into MBR and pulling its OS boot options (grub.conf/menu.lst) from sda1

Backup:
-- Boot Knoppix 5.1.1
-- Mount desired NFS share
-- Use sfdisk to capture the partitioning information for sda and sdb
sfdisk -d /dev/sda > /NFS/dev-sda-sfdisk-info.txt
sfdisk -d /dev/sdb > /NFS/dev-sdb-sfdisk-info.txt
-- Change into the desired NFS sub-directory
-- Use partimage to image all of the partitions. Here is the idea for sda1.
/usr/sbin/partimage --batch -z1 -o -d save /dev/sda1 ./dev-sda1-image

Restore/Duplication:
-- Boot Knoppix 5.1.1
-- If Knoppix is using a pre-existing swap partition, disable with "swapoff -v "
-- Mount desired NFS share
-- Use sfdisk to write out the partitioning information for sda and sdb
sfdisk /dev/sda < /NFS/dev-sda-sfdisk-info.txt
sfdisk /dev/sdb < /NFS/dev-sdb-sfdisk-info.txt
-- Use sfdisk to verify the partitioning information for sda and sdb
sfdisk -l -V /dev/sda
sfdisk -l -V /dev/sdb
-- Change into the desired NFS sub-directory
-- Use partimage to write out all of the partitions. Here is the idea for sda1.
/usr/sbin/partimage --batch restore /dev/sda1 ./dev-sda1-image.000
-- Use the GRUB shell to write out the MBR and insist, for our example, that GRUB pulls its OS boot options (grub.conf/menu.lst) from sda1.
grub
root (hd0,0)
setup (hd0)
quit
-- Reboot and enjoy your multi-boot Linux system.

NOTE: See this LINK for more GRUB info. It's pretty darn good.

Thursday, October 30, 2008

TestDisk Utility

Try TestDisk:

http://www.cgsecurity.org/wiki/TestDisk

Friday, October 24, 2008

InfiniBand Testing: Suggested Partitioning for Linux Hosts

Here are my suggestions for partitioning Linux host lab systems for InfiniBand OFED testing:

/boot (~100 MB)
swap (usually 2x RAM, so 4096 MB if 2GB of RAM)
/ (install rest of OS)

Other notes:
1 - use the GRUB bootloader; install into Master Boot Record (MBR)
2 - use EXT3 filesystems for compatibility with the Partimage utility
3 - when gathering data for later restoration, remember to capture the MBR.

Wednesday, September 24, 2008

One Linux Dual-Boot Technique (Pretty Specific)

Here is a basic write-up of the technique that I used to achieve
dual-booting between SuSe and RHEL operating systems.

Assumptions:
1) /dev/sda (SuSe, active GRUB boot loader)
2) /dev/sdb (RHEL)
3) The RHEL os had previously been installed/booted with GRUB in /dev/sda slot)
4) The RHEL /boot partition is now here: /dev/sdb3

Basic Technique:
1) Make a backup of the SuSe GRUB configuration file.
cd /boot/grub
cp menu.lst menu.lst-ORG (this file used to be called "grub.conf")

2) Mount the previously used RHEL /boot partition.
mkdir /mnt/rhel-boot
mount /dev/sdb3 /mnt/rhel-boot

3) Create a new, unified GRUB configuration file by pulling the necessary
RHEL boot information from the /mnt/rhel-boot/grub/menu.lst file and
add it to the end of the /boot/grub/menu.lst file associated with the
SuSe rendition of the GRUB boot loader.

When I did this, I just had to change the "root" line from "(hd0,2)"
to "(hd1,2)".

4) Unmount the RHEL /boot partition.
cd /
umount /mnt/rhel-boot

5) Reboot, and enjoy your dual-boot machine.
init 6

Tuesday, August 05, 2008

Random Test Automation Framework Attributes

Usually, at least three levels of abstraction.
L1 - protocol, suite
L2 - case, processing, program, scenario
L3 - assertion, item, step, verification point

NOTE: some sites use a L0 concept - a "suite of suites".

Usually, setup (pre-conditions or constraints) and cleanup (post-conditions or return-to-base-state) are able to be specified for L1 and L2 things.

Timeouts should usually be enforced by an automation framework rather than hard-coded throughout the test code. There should be a clear separation between a test framework and the test suites which plug into the framework.

Consider using something like JSON for data-driven things as opposed to XML (to heavy-weight), YAML (just a little over-engineered), INI (too weak), and the sourcing in of language specific syntax. As of this writing, JSON seems like the best overall technology for test input(s).

Friday, July 18, 2008

Creating Partimages of Host Machines (Very Customized For My Environment)


- Boot up the Knoppix CDROM into textual mode in RAM
knoppix 2 toram

- Eject the CDROM for possible use in another host

- Setup basic networking.

- Setup Ethernet interface:
ifconfig eth0 <ip> netmask <nm> up
- Setup default gateway (this can be skipped if files on same subnet):
route add default gw <ip_address>

- Setup correct date / time info. This information will be assumed to be correct by the partimage backup script.

export TZ=CDT
date 07181314 (MMDDhhmm)

- Assign "normal" root password

- Start up SSH server

/etc/init.d/ssh start

- SCREEN a new BASH session

chmod 755 /var/run/screen
screen bash

- Make a working directory and cd there:

mkdir /tmp/partimage
cd /tmp/partimage

- Scp the "partimage-backup.pl" script and the <hostname>-source-me.txt file.

- Source the <hostname>-source-me.txt file in.

- Use perl to execute the "partimage-backup.pl" script.

Wednesday, July 16, 2008

Creating a RHEL 5.2 KickStart Bootdisk (x86_64)


1 - Download Binary Disc 1 ISO (rhel-5.2-server-x86_64-disc1.iso)
2 - Mount ISO (step 1) via loopback on a Linux box
3 - Copy the boot.iso file somewhere else (/var/tmp for example)
4 - Umount the ISO from step 2
5 - Mount the boot.iso file (step 3) via loopback
6 - Copy that structure somewhere else, for example, /var/tmp/myiso
7 - Umount the ISO from step 5
8 - Following my example path, alter the /var/tmp/myiso/isolinux/isolinux.cfg file. Add in any necessary boot labels to address all of the KickStart scenarios you need. A simple boot stanza might look like this:

label scenario_04
kernel vmlinuz
append ks=nfs:<ip_address>:/kickstartstuff/RH5.1_server_x86_64/scenario_04.cfg initrd=initrd.img

9 - Use the mkisofs(8) command to make a new ISO. My little script looked like this:

#!/bin/bash
cd /var/tmp/myiso
rm -f ../mycustomks.iso
/usr/bin/mkisofs -r -N -allow-leading-dots -d -J -T -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -V "RHEL5U1 Custom KickStart" -boot-load-size 4 -boot-info-table -o ../mycustomks.iso .

10 - Burn/boot/test the ISO created in step 9

NOTE: The mkisofs command line was acquired from here.

Monday, June 30, 2008

Upgrading SLES10SP1 to SLES10SP1U1


1) Get the RPM files to be used in the upgrade to the machine in question.

st32:/var/tmp/joeuser # ls -alt (output edited for brevity)
-r--r--r-- 1 root root 45570118 Jun 30 15:32 kernel-source-2.6.16.53-0.16.x86_64.rpm
-r--r--r-- 1 root root 1620378 Jun 30 15:32 kernel-syms-2.6.16.53-0.16.x86_64.rpm
-r--r--r-- 1 root root 121758 Jun 30 15:32 perl-Bootloader-0.4.18.11-0.2.x86_64.rpm
-r--r--r-- 1 root root 17204994 Jun 30 15:32 kernel-smp-2.6.16.53-0.16.x86_64.rpm
-r--r--r-- 1 root root 16846928 Jun 30 15:32 kernel-default-2.6.16.53-0.16.x86_64.rpm
-r--r--r-- 1 root root 17682230 Jun 30 15:32 kernel-debug-2.6.16.53-0.16.x86_64.rpm

NOTE: In my example, I don't need the kernel-default-* or kernel-debug-* RPMs.

2) Upgrade the perl-Bootloader RPM.

# What's there now?
st32:/var/tmp/joeuser # rpm -qa | grep '^perl-Boot'
perl-Bootloader-0.4.15-0.6

# Upgrade it!
st32:/var/tmp/joeuser # rpm -U perl-Bootloader-0.4.18.11-0.2.x86_64.rpm

# Now, what's there?
st32:/var/tmp/joeuser # rpm -qa | grep '^perl-Boot'
perl-Bootloader-0.4.18.11-0.2

3) Upgrade the kernel RPMs.

# What's there now?
st32:/var/tmp/joeuser # rpm -qa | sort | grep '^kernel-'
kernel-smp-2.6.16.46-0.12
kernel-source-2.6.16.46-0.12
kernel-syms-2.6.16.46-0.12

# Upgrade the kernel-smp-* RPM
st32:/var/tmp/joeuser # rpm -U kernel-smp-2.6.16.53-0.16.x86_64.rpm
Setting up /lib/modules/2.6.16.53-0.16-smp
Root device: /dev/disk/by-id/scsi-SATA_Maxtor_6Y120M0_Y3PRT2QE-part2 (/dev/sda2) (mounted on / as reiserfs )
Module list: amd74xx sata_nv processor thermal fan reiserfs edd (xennet xenblk)

Kernel image: /boot/vmlinuz-2.6.16.53-0.16-smp
Initrd image: /boot/initrd-2.6.16.53-0.16-smp
Shared libs: lib64/ld-2.4.so lib64/libacl.so.1.1.0 lib64/libattr.so.1.1.0 lib64/libc-2.4.so lib64/libdl-2. 4.so lib64/libhistory.so.5.1 lib64/libncurses.so.5.5 lib64/libpthread-2.4.so lib64/libreadline.so.5.1 lib64/l ibrt-2.4.so lib64/libuuid.so.1.2 lib64/libnss_files-2.4.so lib64/libnss_files.so.2 lib64/libgcc_s.so.1

Driver modules: ide-core ide-disk scsi_mod sd_mod amd74xx libata sata_nv processor thermal fan edd
Filesystem modules: reiserfs
Including: initramfs fsck.reiserfs
Bootsplash: SuSE-SLES (800x600)
15311 blocks

# Upgrade the kernel-syms-* RPM. Use the "--nodeps" option because, currently, there would
# be a circular dependentcy.
# (e.g. kernel-syms is dependent on kernel-source which is dependent on kernel-sysms)
st32:/var/tmp/joeuser # rpm -U --nodeps kernel-syms-2.6.16.53-0.16.x86_64.rpm

# Upgrade the kernel-source-* RPM. Probably didn't have to use the "--nodeps" option, since
# the kernel-syms-* RPM got installed above, but did anyway.
st32:/var/tmp/joeuser # rpm -U --nodeps kernel-source-2.6.16.53-0.16.x86_64.rpm
Changing symlink /usr/src/linux from linux-2.6.16.46-0.12 to linux-2.6.16.53-0.16
Changing symlink /usr/src/linux-obj from linux-2.6.16.46-0.12-obj to linux-2.6.16.53-0.16-obj

# Reboot to see the magic take effect.
st32:/var/tmp/joeuser # init 6

Friday, June 27, 2008

IB Fabric: Installing SLES10SP1 or SLES10SP2 Consistently


1) Disable iptables
2) Configure static address for ethernet interface
3) Ensure that these package groups are installed:
Server Base System, Common Code Base, Novell AppArmor, 32 Bit Runtime Environment, Documentation, GNOME, X-Window, C/C++ Compiler And Tools, Development (all packages here, resolve minimal to no dependencies).
4) Don't let installer establish a Certificate Authority (CA).
5) Set default runlevel to "3" (multi-user, networked, no X-Window)

Note: This post is just very rough and will need to be embellished in near future.

Thursday, June 26, 2008

IB Fabric: Establishing Pre-Placed SSH Keys So That All Nodes Trust Each Other


Assumptions: /etc/sysconfig/iba/hosts file reflects the compute node (CN) set.

1) Ensure that root SSH key pairs have been generated on all nodes. If not, generate the root SSH key pair using "ssh-keygen -t rsa" on all nodes.

2) Establish SSH trust between the management node (MN) and an individual CN by appending the MN root user's public SSH key (~/.ssh/id_rsa.pub) onto the CN root user's SSH authorized keys file (~/.ssh/authorized_keys2). Repeat this for the CN set.

This command may be helpful:
cat ~/.ssh/id_rsa.pub | ssh CN "cat - >> ~/.ssh/authorized_keys2"

3) On the MN, using the FF /sbin/setup_ssh script, to build a new known_hosts file.
a) cp /dev/null ~/.ssh/known_hosts
b) /sbin/setup_ssh -C

4) On the MN, build a new authorized_keys2 file for later propagation.
a) cat ~/.ssh/id_rsa.pub > /var/tmp/new_authorized_keys2
b) cmdall "cat ~/.ssh/id_rsa.pub" | grep -v 'ssh/id_rsa.pub' >> /var/tmp/new_authorized_keys2

5) Now, distribute the new authorized_keys2 and known_hosts files.
a) scpall /var/tmp/new_authorized_keys2 ~/.ssh/authorized_keys2
b) cmdall "chmod 644 ~/.ssh/authorized_keys2"
c) scpall ~/.ssh/known_hosts ~/.ssh/known_hosts
d) cmdall "chmod 644 ~/.ssh/known_hosts

6) Gain confidence that everything is synchronized correctly by:
a) cmdall "md5sum ~/.ssh/authorized_keys2"
b) cmdall "md5sum ~/.ssh/known_hosts"

NOTE: (3-Feb-2009) -- I have now found that the IFS /sbin/setup_ssh script seems to only work to generate half (no IB interfaces) of a known_hosts file. I used something like this:

/sbin/setup_ssh -s -S -i'-ib' -f /etc/sysconfig/iba/hosts

I still had to generate the authorized_keys2 file using the technique above.

NOTE: this rough procedure still needs more debugging.

Friday, June 20, 2008

Pre-placed SSH Keys


Use this link and this link

Friday, June 13, 2008

Apt Commands To Update Ubuntu Via CLI


apt-get update; apt-get upgrade

Possible CRON:
(apt-get update && apt-get -y upgrade) > /dev/null

Source Link

Tuesday, June 10, 2008

Linux Raid 5 Example Using mdadm(8)

mdadm(8) - manage MD devices aka Linux Software RAID

RAID 5 filesystem (~940GB of effective storage, 14 disks, 2 reserves, ~73GB drives)

mdadm --create --verbose /dev/md0 --level=5 --raid-devices=14 --spare-devices=2 --chunk=128 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1 /dev/sdg1 /dev/sdh1 /dev/sdi1 /dev/sdj1 /dev/sdk1 /dev/sdl1 /dev/sdm1 /dev/sdn1 /dev/sdo1 /dev/sdp1

mke2fs -j -b 4096 -R stride=32 /dev/md0

fstab line:
/dev/md0 /raid5 ext3 rw 0 0

After reboot, we had to re-assemble by:

mdadm --assemble -f /dev/md0 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1 /dev/sdg1 /dev/sdh1 /dev/sdi1 /dev/sdj1 /dev/sdk1 /dev/sdl1 /dev/sdm1 /dev/sdn1 /dev/sdo1 /dev/sdp1

# cat /proc/mdstat
Personalities : [raid5]
md0 : active raid5 sda1[0] sdo1[14] sdp1[15] sdn1[13] sdm1[12] sdl1[11] sdk1[10] sdj1[9] sdi1[8] sdh1[7] sdg1[6] sdf1[5] sde1[4] sdd1[3] sdc1[2] sdb1[1]
931864960 blocks level 5, 128k chunk, algorithm 2 [14/14] [UUUUUUUUUUUUUU]
unused devices:

Monitor example:

mdadm --monitor -m someone@somewhere.com -f /dev/md0

Thanks co-worker (you know who you are)

Note: Please see the November 2008 issue of Linux Journal (pg. 68-72) for an excellent article on Linux SW RAID using mdadm.

Wednesday, May 14, 2008

RPMS on Ubuntu: Checkout "alien"


Checkout the "alien" utility to install RPMs on a Debian/Ubuntu based system.

Tuesday, May 13, 2008

Letting A Vncviewer Control Your Ubuntu Desktop

This link shows how to enable an Ubuntu desktop such that a vncviewer can control it.

Note: I used a TightVNC viewer on an XP box. If you put the viewer into fullscreen, you need CTRL-ALT + SHIFT-F to get you out.

Saturday, May 10, 2008

WordPress As A CMS

See this link to investigate using WordPress as a CMS for static sites.
According to my research, this has been done quite a bit for static sites.
Also, here is the part 2 that goes with the link above.

This is another great link to hit too. This too.

Google stuff like: "using WordPress for static websites" and "using WordPress as a CMS for static websites". You know, the usual stuff.

Tuesday, May 06, 2008

Managing Binary Patches With "rdiff"


If you need to create or manage binary patches, check out the "rdiff" utility. It uses the same algorithm as "rsync". Please reference Kyle Rankin's "Lightning Hacks" article in the June 2008 Linux Journal.

Thursday, May 01, 2008

Infiniband Wireshark Filter

Need the Wireshark (was Ethereal) Infiniband Filter?

Hit this:Infiniband Wireshark Filter

Monday, April 21, 2008

The Program "screen" Rocks!


# use screen in a script to detach a given program
screen -d -m <program_to_detach>

# list existing screen sessions
screen -ls

# attach to a previously screened program
screen -r <screen_id>

# detach from the currently attached screen session
CTRL-A, CTRL-D

Thursday, April 10, 2008

Ubuntu 7.10, Cisco VPN Related Packages

These are the Cisco VPN related packages that I believe are needed for my Ubuntu 7.10 Desktop:

network-manager, network-manager-gnome, network-manager-vpnc, vpnc

As a side note, I ended up not using vpnc. I ended up using the Cisco 4.8.00.0490-k9 client code and patching it. Basically, I ended up following the instructions as documented by "peteguhl" here:

Howto: Cisco VPN client on x86_64

I am almost tempted to paste a complete copy of those instructions here, but I'll hold off on that for now.

The control script is here: /etc/init.d/vpnclient_init

To connect, issue: "vpnclient connect <profile_name>"

Wednesday, March 19, 2008

Some Handy Git Commands

# Grab some GIT stuff
git clone <git_reference>

# Possible GIT workflow. One person team. Master branch.
git pull <git_reference>
git add <filesystem object>
git commit -m 'Comment here' <filesystem object>
git push <git_reference>

# See what is different
git diff

Monday, March 17, 2008

Some Handy CVS Commands

# Checkout a Module
cvs co <module>

# Checkout a Module from a given branch, MY_BRANCH_TAG
cvs co -rMY_BRANCH_TAG <module>

# Display log associated with a file
cvs log <file>

# Update the Module with any new code committed
cvs update <module>

# Add a new binary file
cvs add -kb <binary_file>
cvs commit

# Review list of files that have been modified in your diretory
cvs -qn up

Monday, March 03, 2008

Mini Fake Python DNS Server


Google: "pyminifakeDNS"
Code here

A Windows TFTP / DHCP Server


TFTPD32 (Philippe Jounin (philippe@jounin.net))

Some Excellent Dot Net Tools


.NET Reflector (Lutz Roeder)
SharpDevelop (IDE)

Thursday, February 21, 2008

Handy Find Command


Find all files on a given filesystem, capturing some nice attributes about them:

find / -xdev | xargs stat -c "%n %a %u %g" | sort > file.txt

Tuesday, February 19, 2008

VIM: Finding Lines With Bytes In CC 81 Or More


To find and highlight all lines containing characters in card column (CC) 81 and greater, use the following search:

/^.\{81,}

Thursday, February 14, 2008

Some Networking Benchmark Tools


-- iperf
-- NetPIPE
-- ttcp

Tuesday, February 12, 2008

Loopback Mount of ISO Example


mount -o loop -t iso9660 isoimagefile.iso /mnt/iso9660image

Converting Unix Man Pages To Text


Generally, this kind of thing will work:

zcat /usr/share/man/man1/chmod.1.gz | nroff -man | col -bx > chmod-1-man.txt
zcat /usr/share/man/man8/e2fsck.8.gz | nroff -man | col -bx > e2fsck-8-man.txt
zcat /usr/share/man/man8/fdisk.8.gz | nroff -man | col -bx > fdisk-8-man.txt

Handy "rdesktop" Command From Linux


rdesktop -u <windows_user_name> -g 90% <ip_address>

Sunday, February 10, 2008

SSH Tunneling Example (X Forwarding)


Machine A is a machine with an active X-Window server and the necessary SSH client software. Machine B is a Linux machine with SSHD running that we have root access to. Machine C is also a Linux machine that we have an account on. From A, we are going to create an SSH tunnel through B which accesses C and displays X-Window client applications back on A via the tunnel. Do something like this:

ssh -X -l root -L 22:<C_IP_ADDRESS>:22 -N <B_IP_ADDRESS>

-- Supply the root password for B when prompted.
-- Supply the correct login/password for C when prompted.
-- Port 22 is the default port for SSH.
-- Execute an X-Window client application on C to test. Maybe "xeyes" or "xclock".
-- If there are problems, open up the privileges for the X-Window server on A with an "xhost +"

SSH Tunneling Example (RDP)


Machine A is an XP machine with Cygwin installed, including the necessary SSH client related software. Machine A also has the remote desktop protocol (RDP) client software installed. Machine B is a Linux machine with SSHD running that we have have root access to. Machine C is an XP machine that allows incoming RDP sessions provided the client has the correct credentials. To use A to take over C via an SSH tunnel through B, do something like this from a Cygwin shell on A:

ssh -l root -L 55555:<C_IP_ADDRESS>:3389 -N <B_IP_ADDRESS>

-- Supply the root password for B when prompted.
-- Then, use the RDP client on A to connect to C via localhost:55555.
-- Supply the correct login data items for C.
-- Port 3389 is the default RDP port.
-- On an XP machine, the RDP client software is "mstsc.exe"

Thursday, February 07, 2008

Some ClearCase Operations


Assumptions:

-- "cleartool" is in $PATH and aliased to "ct"
-- /admin-vob is the Unix path for special admin version object base (VOB)
-- "main_view" is a default view with the following config spec:

element * CHECKEDOUT
element * /main/LATEST

Operations:

# Creating a branch type that is available to all VOBS
# associated with the admin VOB

$ ct setview main_view
$ cd /admin-vob
$ ct mkbrtype -global -c "<comment>" <branch_name>

# Creating a label type that is available to all VOBS
# associated with the admin VOB

$ ct setview main_view
$ cd /admin-vob
$ ct mklbtype -global -c "<comment>" <label_name>

# Applying a label types to stuff recursively (already in a view):

$ ct mklabel -recurse -c "<comment>" <label_name> <start path>

# Applying a label type to an individual element (directory):

$ ct mklabel -c "A Directory" MY_LABEL /vob-at-hand/a/b/c/d

# Applying a label type to an individual element (file):

$ ct mklabel -c "A File" MY_LABEL /vob-at-hand/a/b/c/d/random.xml

# Locking a branch type that is available to all VOBS
# associated with the admin VOB

$ ct setview main_view
$ cd /admin-vob
$ ct lock -replace brtype:<branch_name_to_lock>

# Locking a label type that is available to all VOBS
# associated with the admin VOB

$ ct setview main_view
$ cd /admin-vob
$ ct lock -replace lbtype:<LABEL_TO_LOCK>
# Rename a branch type that is available to all VOBS
# associated with the admin VOB

$ ct setview main_view
$ cd /admin-vob
$ ct rename brtype:<src_branch_name> brtype:<tgt_branch_name>

# NOTE: Of course, any views that were looking for the old
branch tag need to have their config specs fixed.

# Rename a label type that is available to all VOBS
# associated with the admin VOB

$ ct setview main_view
$ cd /admin-vob
$ ct rename lbtype:<SRC_LABEL> lbtype:<TGT_LABEL>

# Create a ClearCase dynamic view in view storage.

$ cd /view-storage
$ umask 002
$ ct mkview -tag <view_name> <view_name>.vws

# Removing a ClearCase dynamic view:

$ cd /view-storage
$ ct rmview -force <view_tag.vws>

# NOTE: should ensure that there are no checkouts in view
# before removal.

# Listing the visible elements (sorted) from within a view:
$ ct ls -r -s -visible . | sort

Wednesday, February 06, 2008

Solaris Package Manager Tips


On a Solaris machine, which packages are present?

/usr/bin/pkginfo -x

Given a package name, which files are related?

/usr/sbin/pkgchk -l <package name>

Given a package name, display package information:

/usr/bin/pkginfo -l <package name>

Given a file name, display related package information:

/usr/sbin/pkgchk -l -p /usr/bin/ls

Monday, February 04, 2008

RPM Tips


Given a file, which package is it in?

# rpm -q -f <file>

Given a package name, which files are related?

# rpm -ql <package>

Given a package name, display package information:

# rpm -qi <package>

Dump all package names:

# rpm -qa | sort | more

Dump all package information:

# rpm -qai

Search uninstalled RPMs for a file:

# ls -1 *.rpm | xargs rpm --query --filesbypkg --package | grep <search_pattern>

Note: The tip above was adapted from the Nov 2008 Linux Journal "Tech Tip" by Dashamir Hoxha on page 31.

Sunday, February 03, 2008

Using Old Micron PCs For Rsync (via SSH) Targets


At a high level, here is what I did to configure three(3) old Micron boxen (Pentium 3, 500MHz, 64MB RAM, 13.5GB) to serve exclusively as rsync targets for production data:

1) Burnt a debian (etch) 4.0r2-i386 "netinst" CD.
2) Booted CD with "netcfg/disable_dhcp=true" option so that I could conduct static network configuration during the install.
3) Used following partition sizes: 800MB (/), 256MB (swap), and 12.6GB (/data).
4) Installed the minimal set of software I could get away with using the non-expert path.
5) Took CD out, rebooted.
6) apt-get install openssh-server (I used the "netinst" CD to satisfy this)
7) apt-get install rsync
8) Rebooted.

Note: I had to setup the BIOS to not halt on detecting a missing keyboard since the intention is to use them like that (no head either).

Saturday, February 02, 2008

Rsync Example


Using rsync to execute an initial copy of data from the SOURCE to TARGET machine via a SSH transport:

rsync -avx --numeric-ids --progress -e ssh /data/ root@<TARGET_IP_ADDRESS>:/data

Using rsync to maintain synchronization after the initial copy:

rsync -avx --numeric-ids --progress --delete -e ssh /data/ root@<TARGET_IP_ADDRESS>:/data

-- The "--delete" option has been added to delete files from the TARGET that have been deleted from the SOURCE since the initial rsync.

-- The "--dry-run" or "-n" option can be added to reveal what rsync intends to do.

-- The trailing "/" on the SOURCE directory is intentionally there and keeps that directory from being created under the TARGET subdirectory.

Friday, February 01, 2008

Quick Symmetric Encryption / Decryption


To encrypt:

gpg -c < cleartext > ciphertext

-- This will prompt for a passphrase.

To decrypt:

gpg < ciphertext > cleartext

-- This will prompt for a passphrase.
-- Use the same passphrase as was used for the encryption.