Cover V09, I06


Questions and Answers

Jim McKinstry

A couple of months ago, I received a question about deleting files with a “/” in the name. The answer I published was wrong. I received many emails from readers pointing this out to me. Here's an excerpt from an email I received from Brad Morrison with the correct answer:

“I don't think the find command will work, because it execs /bin/sh with {} for args. I think you have to use clri (clear inode) in a case like this, which means you have to fsck the partition later to zap the all-zeroes inode.”

Thanks Brad (and everyone else) for spotting my error and sending me a correct answer.

 Q I want to network my Red Hat 6.1 box with an NT neighbor. I want to be able to share resources. How and where do I start?

 A Set up Samba. It comes with Red Hat and can be configured with the linuxconf tool.

 Q How can I know which port number is available on Linux and which one is in use by another application?

 A Start by looking in /etc/services. This file defines all of the “well-known” ports that are used by standard network services (telnet, ftp, etc.). Also, good administrators keep this file updated with any other ports that they may be using. You can also use netstat to look at what ports are currently active. Finally, you can use one of many hacker tools to probe all of the ports to see what ports are in use.

 Q I need to conduct TPC-C benchmarking for Oracle. What are the details involved with setting up this hardware and software?

 A Go to and download the specification. It's about 130 pages long. The TPC-C tests are complex and expensive to set up and execute. I recommend looking at the Web site and finding a scenario that is close to what you are using; you can then extrapolate numbers from that. TPC-C setups can cost millions of dollars to configure and execute.

 Q When I do a df -k on Solaris 2.6, I get this partial result: /dev/dsk/c0t2d0s0 962134 870898 0 100% /idx. Why is this output wrong? How can I fix it?

 A I'm assuming that you are asking why /dev/dsk/c0t2d0s0 has 962134 blocks and only 870898 are used, but df shows 0 blocks free and 100% utilization. This output is not wrong. There is approximately a 10% overhead in a file system. That means that a file system with 962134 blocks has only about 865921 blocks available (962134 - 96213 = 865921). That's why you are at 100% utilization. You may actually see some systems report utilization at over 100%. This is because some systems allow root to write to a file system's reserved space.

 Q We have a mixture of Sun OS, Solaris, Linux, OpenBSD, Win98, and Win NT systems and need to decide on a repository to be used by all. Should we upgrade Sun OS and Solaris to OpenBSD or Linux? For a repository, should we use CVS, SourceSafe, or something else?

 A Let's start with the operating systems that you are running. SunOS and OpenBSD are both Berkeley-based operating systems. Linux and Solaris are both SVR4-based operating systems. Throw Microsoft in the mix and managing these can be a nightmare. I'd pick a common UNIX operating system to move forward with. If you are currently running Solaris or SunOS on a SPARC box, upgrade the SunOS, Linux, and OpenBSD to Solaris (since Solaris is the only OS that runs on both SPARC and x86 architectures). You may also want to try Linux on your SPARC systems. I've never tried it but heard that it smokes. If it works well, then you can consider going completely to Linux. As for your repository, I know that MKS has a nice product (Source Integrity) that I've used in the past. It is RCS based. You can also download RCS for free by searching on the Web for it. I prefer RCS to CVS.

 Q Presently, /usr and /var reside on the root file system, which is 90% full. To make room, I would like to move these /usr and /var directories to another file system. These file system mount points should be /usr and /var. How can I do this without reinstalling the operating system?

 A Here's a step-by-step process.

1. Create two file systems of appropriate sizes (one for usr and one for var).
2. Boot into single-user mode (you don't need to do this but it's safer).
3. Mount the two file systems on temporary mount points (/usr_temp and /var_temp).
4. Copy /var to /var_temp and /usr to /usr_temp
cd /var

find . -xdev -depth -print | cpio -puxdm /var_temp
cd /usr

find . -xdev -depth -print | cpio -puxdm /usr_temp
5. Modify /etc/vfstab to mount /usr and /var on the new file systems.
6. Boot from CDROM and mount /.
7. Remove all of /usr and /var.
8. Reboot; /usr and /var should now be on their own file systems and / should have a ton of room.
 Q How can I open large files in the vi editor? I am using SCO UnixWare 7.1.0.

 A You are probably running out of space in the file system that holds the temp file that vi creates. vi a large file in one session (telnet, x-windows, etc.). In another session, do a df -k to see if there is a full file system (probably /var). If this is the case, increase the size of the file system in question or clean up the file system. I believe that vi uses /var/tmp to store its temporary file.

 Q What can I do if I see:

Jan 30 19:30:00 smtp3 unix: NOTICE: /home: out of inodes
Jan 30 19:30:00 smtp3 unix:
 A It sounds like /home has a lot of smaller files in it, using up all of the inodes. You need to recreate the /home file system one of two ways:

1. Create a larger file system that will give you more inodes.
2. Create the same size file system with a smaller size inode (it's the -i flag in newfs). The default inode size is 4096. To double the amount of inodes, use -i 2048. Unless you have enough space, you will need to backup /home, create the new file system with more inodes, and restore the data.
 Q When I log into an account named “Zhang” with the correct password, it is not successful. It is successful, however, when I log in as root. As root, I enter su Zhang after prompt and return, and a “No shell” error appears. I have changed attributes of some files as superuser in order to raise system security, but I've forgotten what files. Until now, other functions have had no problems. Any suggestions?

 A Check /etc/passwd and verify that the account in question (Zhang) has a default shell defined. Next, verify that the shell exists and that it has the correct permissions associated with it.

 Q What's the purpose of the scripts in /etc/init.d?

 A /etc/init.d (or /sbin/init.d on HP-UX 10.x) holds all of the scripts that are called as the system goes through the different init levels. On HP-UX 10.x, if you do a ls -l /sbin/rc2.d, you will see that all of the scripts are links to files in /sbin/init.d. Let's say that you are running in init state 3 and you issue the shutdown command. The system will execute all of the files in /sbin/rc3.d, /sbin/rc2.d, /sbin/rc1.d, and /sbin/rc0.d that start with a “K”. Each “K” script is passed a parameter of “stop”. During a boot (to init state 3), the system executes all of the files in /sbin/rc0.d, /sbin/rc1.d, /sbin/rc2.d, and /sbin/rc3.d that start with an “S”. Each “S” script is passed a parameter of “start”. If you edit any of the /sbin/init.d scripts, you will see that they are all the same format. Basically, they are a big “case” statement that handle at least “start” and “stop”. All user scripts written to be used during startup/shutdown should be placed in the init.d directory and links should be set to them in the appropriate rc directory. They should also be written in the same format that the system supplied startup/shutdown scripts are written.

 Q I am interested in getting certified in UNIX administration. Where should I start?

 A Start by picking the flavor of UNIX you want to be certified in (Solaris, HP-UX, Red Hat, Caldera, etc.) then visit the vendor Web site for that operating system. Most vendors offer certification. There is no industry recognized UNIX certification. Many UNIX administrators I know feel that lots of the certifications out there are a joke and don't really add any value. Frequently, employers care more about a candidate's experience than about a specific certification. In addition to investigating the various vendors' certification processes, I recommend checking out the qualifications and duties expected of systems administrators on the Usenix Web site.

 Q I have five years of computer experience working in the Windows environment. Now I'd like to get into the UNIX world. What is the best approach to take to obtain employable UNIX skills? Do you know of any UNIX training programs other than taking classes at a university?

Can you suggest any books or other resources that could help me learn UNIX from the beginning level to advanced level?

 A I get a lot of these “How do I become a UNIX Administrator” questions. Basically, I'm a big fan of the apprenticeship/on-the-job-training/”Just Do It” approach. If you work somewhere that uses UNIX, ask if you can take over some of the basic tasks (I don't think you will get much resistance from the current administrator). Start with account management (adding/deleting users). Use the system tools at first and then start doing it by hand. When you are very comfortable, write a script to do it. You will learn a lot. Also ask the administrator to include you when debugging problems. Tag along and watch. You should also read the books that come with the operating system. HP supplies a book named something like Tasks for the Systems Administrator. Get a copy of the Essential Systems Administration book (O'Reilly and Associates). You should also look into taking classes from the vendor that you are using (Sun, HP, IBM, etc.). As I mentioned above, the Usenix Web site has a list of duties and skill expectations for various levels of systems administration. They, along with other organizations, also offer conferences that you should consider attending.

 Q What are the duties of a UNIX systems administrator?

 A The duties for a UNIX administrator (or any administrator for that matter) include all or some of the following:

• Account Management
• add/delete users
• defining/implementing standard login environments
• password rules
• Backup/Recovery/DRP Strategy
• tape rotation
• backup schedule
• recovery testing
• backup verification
• Security
• user level (password, group membership, etc.)
• file/directory level
• network (/etc/services, tcp_wrappers, etc.)
• Software Installation and Maintenance
• operating system patches (determining need, installing, testing)
• operating system upgrades
• application install/patches/upgrades
• Hardware Maintenance
• monitor system logs for errors
• schedule downtime for fixes
• maintain support contracts
• Capacity Planning/System Tuning
• monitor and track CPY, network, memory, disk utilization and performance using system tools (sar, iostat, netstat, etc.) and third party applications
• perform trend analysis to map out growth plan
• work with DBAs, users, and management to determine future growth

About the Author

Jim McKinstry is a Senior Sales Engineer for MTI Technology Corporation ( MTI is a leading international provider of data storage management products and services. He can be reached at: