Friday, February 15, 2008

Traversing Red Hat Enterprise Linux 5 on System p

So you've been the IBM® AIX® guru on your team for years now and your bosses have determined that they want to try Linux® on System p™. You can fight the change, or you can embrace it and learn Linux, if not learn to love it. The purpose of this article is to introduce Linux to AIX administrators. It will show you what you need to know to make the transition to Linux simpler. It will also show you the equivalent commands to perform specific tasks and also discusses process management, filesystem management, how to peruse systems information, install packages, and other important bits of information that you as the systems administrator will need to know. While you will not become an expert at Linux from this article, this should give you a good head start in what you need to know.

Introduction

Traversing Linux is usually a shock to most AIX administrators. While Linux is in many ways just another variant of UNIX®, in other ways it is a very different beast. For UNIX administrators who have moved to AIX from Solaris or HP-UX, you'll understand what I'm talking about. If UNIX is not always UNIX (look at the differences between Solaris, HP-UX, and AIX), how more-so will Linux not be AIX. Futhermore, with Linux, you won't have smitty to fall back on.

Generally speaking, it is easier for Solaris administrators to make the transition to Linux than AIX administrators because there are more files that need editing on both Solaris and Linux. Both Solaris and Linux are also more command-line driven than AIX. One advantage you will have as an AIX administrator is that the hardware is the same, so if you're familiar with Virtualization using AIX on System p, you'll find a lot of similarities. If you were using Red Hat Enterprise Linux 5 (RHEL5) on an x86 box, you would be using Red Hat's Xen-based virtualization process (see Resources for more information on Xen). On System p, you'll be using the same PowerVM™ that you are using on AIX. While virtualization is outside the scope of this article, this is an important concept to understand and a big plus for you (see the Resources section for some good articles on the topic).

AIX administrators know that while their environment has a rich set of command-line tools, many of the commands will not hold without a reboot, which is one of the primary reasons for their reliance on smit. With Linux, there are many more files that have to be edited manually and, generally speaking, more commands need to be run to complete the same tasks. Red Hat also has a front end, which is a combination of various system-config-* commands, including: system-config-display, system-config-printer, system-config-network, system-config-network, systems-config-packages, systems-config-authentication, system-config-users, and system-config-lvm. Some of them will work in text mode, and some of them will require you to get your X environment working. I strongly suggest you do so, because the GUI tools on RHEL5 add a lot of value in addition to being well designed.

While RHEL5 has a feature-rich GUI environment that you may learn to like, it is not as productive as smitty. With AIX you can use smit or smitty; you don't always have the option of going text or GUI with Linux. With Linux you also won't have the Object Data Manager (ODM), which AIX utilizes for managing devices and configuration files. With Linux, you'll rely on editing text-based files. For the purposes of this article, I'll use AIX V6.1 - TL 0 and SP2 and Red Hat Enterprise Linux Server release 5.1, with kernel Linux version 2.6.18-53.el5. Both are running on an IBM System p 570 with one CPU and 2GB RAM.

Next, you will see the tools used to get information about the system.


 


 

Systems information

As an AIX administrator, you're probably used to running prtconf and a half-dozen or so lscfg or lsattr commands. With RHEL5, you go to /proc and cat files for this data. In AIX /proc, these files are are also virtual files like in Linux, showing hardware and some settings, for example, using interprocess communications. It is used more or less for the set of 'p' commands for retrieving useful data. For example, Listing 1 shows the AIX output of one such command, pstat.


Listing 1. Output for pstat command
 
                 
lpar23ml16fd_pub[/] > pstat -a
PROC TABLE:

SLT ST    PID   PPID   PGRP   UID  EUID  TCNT  NAME
  0 a       0      0      0     0     0     1  swapper
        FLAGS:swapped_inno_swapfixed_prikproc 64bit

 

When you look at the directory structure for /proc on RHEL5, you'll see Listing 2.


Listing 2. Directory structure for /proc on RHEL5
 
                
root@172_29_140_173 proc]# ls
1     139   1551  2712  2955  6            driver       kmsg        self
10    142   1574  2713  2956  7            execdomains  loadavg     slabinfo
1015  143   170   2745  2989  8            fb           locks       stat
1016  144   1793  2746  2990  9            filesystems  mdstat      swaps
1047  1447  1810  2814  3     asound       fs           meminfo     sys
1170  145   1814  2816  3031  buddyinfo    ide          misc        sysrq-trigger
1174  1450  2     2817  350   bus          interrupts   modules     sysvipc
1178  1462  205   284   378   cmdline      iomem        mounts      tty
1182  1486  206   2850  379   cpuinfo      ioports      net         uptime
1183  149   207   2852  380   crypto       irq          partitions  version
1187  1507  208   2853  4     devices      kallsyms     ppc64       vmstat
1191  151   209   2888  403   device-tree  kcore        rtas        zoneinfo
1201  1549  210   2892  432   diskstats    keys         schedstat
1202  1550  2710  2953  5     dma          key-users    scsi
[root@172_29_140_173 proc]#

 

With AIX, you won't see all these text files to glean information from. On the RHEL5 partition, cat a file to get some information about our system. Listing 3 shows cpuinfo.


Listing 3. Using cpuinfo to get system information
 
                 
cd /proc[root@172_29_140_173 /]# cd /proc[root@172_29_140_173 proc]# more  cpuinfo
processor       : 0
cpu             : POWER5 (gr)
clock           : 1654.344000MHz
revision        : 2.1 (pvr 003a 0201)

processor       : 1
cpu             : POWER5 (gr)
clock           : 1654.344000MHz
revision        : 2.1 (pvr 003a 0201)

timebase        : 207050000
platform        : pSeries
machine         : CHRP IBM,9117-570
[root@172_29_140_173 proc]# \

 

Other files worth 'cating' include meminfo, partitions, version, and filesystems. Another useful Linux command is dmesg, as shown in Listing 4.


Listing 4. Using dmesg
 
                
root@172_29_140_173 ~]# dmesg | more
Using pSeries machine description
Page orders: linear mapping = 24, virtual = 12, io = 12
Found initrd at 0xc000000002400000:0xc000000002679400
Partition configured for 2 cpus.
Starting Linux PPC64 #1 SMP Wed Oct 10 16:38:58 EDT 2007
-----------------------------------------------------
ppc64_pft_size                = 0x19
physicalMemorySize            = 0x80000000
ppc64_caches.dcache_line_size = 0x80
ppc64_caches.icache_line_size = 0x80
htab_address                  = 0x0000000000000000
htab_hash_mask                = 0x3ffff
-----------------------------------------------------
Linux version 2.6.18-53.el5 (brewbuilder@js20-bc2-12.build.redhat.com) (gcc version 4.1.2
20070626 (Red Hat 4.1.2-14)) #1 SMP Wed Oct 10 16:38:58 EDT 2007

 

This command is similar to prtconf and is also used to log errors, similar to errpt. As you can see, there is also POWER specific information that is gleaned from the dmesg command.

Next, you'll see the tools needed for filesystem and Logical Volume Management (LVM).


 


 

Filesystem and disk management

The default JFS filesystem for AIX is JFS2 and for RHEL5 it is ext3, which is an enhanced version of ext2. A new RHEL5 command is resize2fs (replacing ext2onliner), which allows one to enlarge or shrink mounted filesystems on the fly. This is supported through the Linux 2.6 kernel. It's important to note that this command does not manipulate the size of partitions, so prior to enlarging filesystem you must ensure that the underlying partition is big enough to support this. This is a similar concept to AIX where you must make sure that your volume group is large enough to support this kind of operation.

This is something else you will need to get used to. As you are aware, with AIX everything is already managed outside of the box with LVM. With Linux you'll need to work with partitions before you can configure LVM. Everything is just much more tightly integrated within AIX.

To return to RHEL5, partition information can be gleaned using fdisk or parted (see Listing 5). I perfer parted, as it is simpler to use.


Listing 5. Using parted to get partition information
 
                
[root@172_29_140_173 sbin]# parted
GNU Parted 1.8.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print

Model: AIX VDASD (scsi)
Disk /dev/sda: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      32.3kB  8225kB  8193kB  primary               boot, prep
 2      8225kB  115MB   107MB   primary  ext3
 3      115MB   19.3GB  19.2GB  primary  ext3
 4      19.3GB  21.4GB  2089MB  primary  linux-swap
 

 

Creating Linux filesystems can also be performed using mkfs, which is a front end to the mke2fs tool. Listing 6 shows how to create an ext3 filesystem.


Listing 6. Using mkfs to create an ext3 filesystem
 
                  
[root@172_29_140_173 sbin]# mkfs.ext3 /dev/sda1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
2000 inodes, 8000 blocks
400 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=8388608
1 block group
8192 blocks per group, 8192 fragments per group
2000 inodes per group

Writing inode tables: done
Creating journal (1024 blocks): done
Writing superblocks and filesystem accounting information: done

 

Now try to resize the filesystem using the resize2fs utility referenced earlier (see Listing 7).


Listing 7. Attempting to resize the filesystem
 
                
root@172_29_140_173 sbin]# resize2fs /dev/sda1 1G
resize2fs 1.39 (29-May-2006)
The containing partition (or device) is only 8001 (1k) blocks.
You requested a new size of 1048576 blocks.

 

As shown in Listing 7, it did not work because of the partition issue discussed earlier. Remember, your partition size must be able to support the new FS, similar to how with AIX you must have enough space on your volume group to increase space. Note that similar to AIX, you can now shrink an ext3 filesystem.

LVM

Figure 1 is a view of the RHEL5 LVM using the system-config-lvm tool.


Figure 1. RHEL5 LVM using the system-config-lvm tool
RHEL5 LVM using the system-config-lvm tool
 

With Linux, before you can use LVM, you will need to initialize your partitions to support LVM. When that process is completed, the partition will be classified as an unallocated physical volume. From here, you can create a volume group, add to an existing volume group, or remove a volume from the LVM altogether. Command-line tools available for you include lvcreate, lvremove, and lvextend.


 


 

Packages and software

This section discusses the tools needed for software installation and overall package management.

Sorry AIX brethren, but you'll have to learn to live without lslpp. With Linux you have RPMs. Many AIX administrators already know these commands because AIX has had RPM capabilities since 5L.

Now query our systems for packages using the -qa flag, as shown in Listing 8.


Listing 8. Querying our systems for packages using the -qa flag
 
                 
root@172_29_140_173 sbin]# rpm -qa |more
popt-1.10.2-47.el5
pcre-6.6-1.1
libICE-1.0.1-2.1
libattr-2.4.32-1.1
libxslt-1.1.17-2
libgfortran-4.1.2-14.el5
bc-1.06-21

 

To install packages, use the -i flag to upgrade the -U flag. RPM is very powerful, but it isn't the simplest tool to learn. Make sure you take the time to learn this tool or use more sophisticated and user-friendly front ends that may be available to you. One such front end is the Yellow Dog Updated Modified (YUM). It is an interactive, automated update program that can be used for maintaining systems using RPM. RHEL4 used up2date package manager and RHEL5 uses YUM (see Resources for more information on YUM).

To activate daily YUM updates on a system using the chkconfig command (which I'll discuss in the next section), you can use this command: [root@172_29_140_173 sbin]# /sbin/chkconfig --level 345 yum on; /sbin/service yum start.

Next, you'll learn about the tools needed for network configuration.


 


 

Network management

To support networking with RHEL5, you can either edit files, use the command line, use the network administration utility system-config-network, or use the setup command. Here you'll use setup, which is really meant for initially configuring your systems. Once you launch setup, you will see the Choose a Tool dialog, which contains different configuration options including Authentication, Firewall, Keyboard, Network, System services, Timezone, and X configuration.

Select Network configuration from this dialog to bring up the TCP/IP configuration dialog shown in Figure 2.


Figure 2. Configure TCP/IP dialog
Configure TCP/IP dialog
 

From here, you can set up the Network Interface Controller (NIC) with the appropriate IP information, address, netmask, gateway, and nameserver. With RHEL5 networking, you also have the standard UNIX commands you should already be accustomed to, such as route, the netstat commands, and other utilities like ping and traceroute.

Next, you'll learn about the tools needed for service management.


 


 

Service management

AIX has the System Resource Controller and you make use of commands such as lssrc and startsrc. RHELhas various utilities including the system-config-services command. You can also do some of the work with the setup command, as referenced earlier. Setup actually allows one to specify which services you want to start and to bring up on boot. Other methods are to use the service command and the chkconfig command.

Use the service command to get a status, as shown in Listing 9.


Listing 9. Using the service command
 
                
root@172_29_140_173 sbin]# service --status-all
amd is stopped
anacron is stopped
arpwatch is stopped
atd is stopped
auditd is stopped
automount is stopped

 

Alternatively, you can use the chkconfig service, which is also very handy with scripts (see Listing 10).


Listing 10. Using the chkconfig service
 
                
root@172_29_140_173 sbin]# chkconfig --list
NetworkManager  0:off   1:off   2:off   3:off   4:off   5:off   6:off
NetworkManagerDispatcher        0:off   1:off   2:off   3:off   4:off   5:off   6:off
amd             0:off   1:off   2:off   3:off   4:off   5:off   6:off
anacron         0:off   1:off   2:off   3:off   4:off   5:off   6:off

 

The text files that you can edit include /etc/sysconfig/network-scripts, /etc/resolv.conf, and /etc/hosts.

Now look at a table (see Table 1) that compares some of the most popular commands for AIX and RHEL5.


Table 1. Comparing commands on AIX and RHEL5
 
Type AIX RHEL5
Adding users mkuser, chuser, lsuser useradd, usermod
Adding filesystems crfs, chfs mke2fs, mkfs
Maintaining logical volumens mklv, chlv lvcreate, lvextend, lvdisplay
Adding swap space lsps -a swapon -s
Managing processes Systems resourced controller (SRC) commands chkconfig, services, setup
System-info prtconf more /proc/cpuinfo, mem
Kernal paramerts vmo, ioo, schedo, no more /etc/sysctl.conf
Filesystem: default jfs2 ext3
Virtualization PowerVM PowerVM - only on System p (Xen available in x86 versions)
GUI smit system-config-*
commands,setup
Oslevel oslevel -s more redhat-release
Software lslpp rpm, yum
Error reports errpt dmesg
Runlevel who -r runlevel
Filesystems /etc/filesystems /etc/fstab

 


 

Summary

Having worked with many administrators who have transitioned to Linux from AIX, the general rule is that it is a lot easier to transition from Solaris to Linux and then AIX to Linux because Linux is more text driven and also because the text files themselves have more similar naming conventions. As an AIX administrator, you should already be very familiar with many command-line tools, which will be helpful when making the transition. While you won't find smit, you'll find enough GUI's out there to increase your comfort level.

Even though Linux has come a long way, it is simply not as mature of a product as AIX and there will be more you will need to do to document and keep your systems up and running. The good news is that today you can also sign up with IBM for a support contract with Linux, which even the most senior of AIX administrators continue to do on AIX. Linux continues to make huge inroads in terms of its reliability and scalability, particularly on the IBM System p platform. The IBM commitment to Linux is second to none in the industry, which is a huge selling point for businesses that want to start moving towards Linux.

I strongly suggest that AIX administrators receive appropriate training to ease the transition process. Don't be afraid to experiment and make mistakes. You will find that with Linux there are many more ways to accomplish the same task as with AIX. Just make sure you don't experiment in production. I always recommend that AIX administrators create a sandbox Linux partition on their System p server so that they can get a head start when the business wants to put something on the platform.

No comments: