Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX System Administrator's Guide: Routine Management Tasks: HP-UX 11i Version 3 > Chapter 3 Managing Systems

How To:

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

Determining What Version of the HP-UX Operating System is Running

To determine what version of operating system you are running and on which platform, use the uname command with the -a option:

uname -a
HP-UX tavi B.11.31 A 9000/800 1920004321 two-user license

In the example above, the system returned the following information:

HP-UX

Operating system name

tavi

System name

B.11.31

Operating system release identifier

A

Operating system version identifier

9000/800

Machine and model numbers

1290005321

Machine identification number

two-user license

Operating system license level

For more information about uname, see uname(1).

NOTE: The system release identifier B.11.31 corresponds with HP-UX 11i Version 3.

Checking the System’s Run Level

To find out what run level the system is in (for example if you want to check that you are in single-user mode) enter:

who -r

The run level is the number in the third field from the right.

For example, this output

run-level 4 Apr 23 16:37 4 0 S

means that the system is in run-level 4.

Scheduling a cron Job

To schedule a job in cron (as root):

  1. Run the command: crontab -e root (you can replace root with a different user name to edit the respective user's crontab file). This will open an editor, allowing you to create or change crontab entries.

  2. Edit the entries as appropriate:

    Add an entry; for example,

    0 12 * * * tar cv /work /home >/tarlog 2>&1

    takes a tar backup of /work and /home every day at noon.

    Here’s how this works (the letters under the first five fields of the example are keyed to the explanations that follow):

    0 12 * * * tar cv /work /home 1>/tarlog 2>&1A B C D E

    • A = minute

    • B = hour

    • C = day of the month

    • D = month of the year

    • E = day of the week (0 = Sunday)

    • An asterisk (*) means all legal values, so the asterisks in fields C, D, and E mean do it every day of the year. Note that standard output and standard error are redirected to /tarlog.

    See “Creating an Automated Backup Schedule” for additional information and examples on how to format cron file entries.

  3. When you exit the editor, crontab will automatically copy the entries to the user's crontab file.

See cron(1M) and crontab(1) for more information.

Adding Users to a Workgroup

This section includes the following topics:

Accessing Multiple Systems

If a user has an account with the same login on more than one system, (for example, if the user’s $HOME directory is NFS-mounted from a file server) the UID number should be the same on all of these systems.

For example, suppose user thomas has a UID of 200 on system tmsystem1 and imports files to tmsystem2 where he has a UID of 330. If the files created on tmsystem1 have permissions of -rw-------, then they will not be accessible to him from tmsystem2. HP-UX determines file ownership by the UID, not by the user name.

As system administrator, you should ensure that each new user login name has a corresponding UID that is unique within the workgroup, site, or network that the user needs to reach.

See HP-UX System Administrator’s Guide: Configuration Management.

To allow a user to access a remote system usingrcp or remsh or to use rlogin without supplying a password, set up $HOME/.rhostsfile on the remote system.

$HOME/.rhosts file

Users listed in the $HOME/.rhosts file are allowed access to the local system, from the remote systems and accounts named in the file, without supplying a password. This file should be owned by the local user.

In the following example, /home/evan/.rhosts resides on system et6700. Users zac and matthew can log in to evan’s account on et6700, from zship and checker respectively, without supplying a password.

zship zac checker matthew
NOTE: Your site security policies might not allow you to use a $HOME/.rhosts file or allow the use of remsh or rcp. If this is the case, consider using the secure shell (ssh) and secure copy (scp) commands instead.

Sharing Remote Work Directories

After you have created a new user’s account, you must decide which directories within the workgroup the user needs to access. NFS allows users to use their own systems to work on files residing on other file servers. The server or remote system shares the user’s system and the user’s system imports from the remote system.

The topic “Adding a User to Several Systems: A Case Study” illustrates how you might set up your users.

Local versus Remote Home Directories

Users can have their home directory on their own local system or on a remote file server. The advantage of keeping all users’ home directories on one file server is that you can back up all the accounts at one time.

If a user’s home directory is on a remote server, you may want to create a minimal home directory on the local system so that a user can still log into the local system if the server is down. See HP-UX System Administrator’s Guide: Configuration Management.

See “Adding a User to Several Systems: A Case Study” for steps to create a home directory on a remote system.

Adding a User to Several Systems: A Case Study

The following example shows how to import Tom’s home directory and work directory from the file server, flserver, and import Emacs and Netscape from the application server, appserver.

Figure 3-1 Adding a User to Several Systems

Adding a User to Several Systems

Before beginning, make sure Tom’s login name has a UID number that is unique across the systems he is going to use. (Your network administrator may have a program to ensure uniqueness of UID numbers.)

Then create an account for Tom on the file server, flserver. See HP-UX System Administrator’s Guide: Configuration Management.

Then do the following procedure:

  1. On the file server,share Tom’s home directory (/home/tom) and the projects directory where he does his work (/projects/work):

    1. Add an entry to the /etc/dfs/dfstab file to share Tom’s home directory:

      share -F nfs -o -async,anon=65534 -d “home dir” /home/tom

      If the directory is already shared, simply add the user’s system to the access list.

    2. Add an entry to the /etc/dfs/dfstab file to share the /projects/work directory:

      share -F nfs -o -async,anon=65534 -d “work” /projects/work

      This contains the files and directories Tom will share with other members of his project team.

    3. Force the server to re-read /etc/dfs/dfstab and activate the new shares for /projects/work and /home/tom:

      shareall -F nfs
  2. On the application server, share the directories (emacs and netscape) that Tom needs:

    1. Add entries to the /etc/dfs/dfstab file:

      share -F nfs -o async,anon=65534 -d “emacs” /usr/local/share/emacs share -F nfs -o async,anon=65534 -d “emacs” /opt/hp/gnu/bin700/emacs share -F nfs -o async,anon=65534 -d “netscape” /opt/netscape
    2. Export the directories for emacs and netscape:

      sharall -F nfs
  3. On Tom’s system, wsb2600, do the following:

    1. Create Tom’s account. See HP-UX System Administrator’s Guide: Configuration Management. If Tom’s login has already been set up on another system (for example on flserver) you may want to cut the line from flserver’s /etc/passwd file and paste it into the /etc/passwd file on wsb2600 to ensure that Tom’s account has the same UID number on both systems.

    2. Create empty directories for the file systems to be imported.

      mkdir /home/tom mkdir /projects/work mkdir /usr/local/share/emacs mkdir /opt/hp/gnu/bin700/emacs mkdir /opt/netscape
    3. Add entries to /etc/fstab.

      flsserver:/home/tom /home/tom nfs rw,suid 0 0 flserver:/work /work nfs rw,suid 0 0 appserver:/opt/netscape opt/netscape nfs rw,suid 0 0 appserver:/usr/share/emacs/ /usr/share/emacs nfs rw,suid 0 0 appserver:/opt/hp/gnu/bin700/emacs nfs rw,suid 0 0
    4. Mount all the directories:

      mount -a

See “Exporting a File System (HP-UX to HP-UX)” for more information.

Exporting a Local Home Directory

Assume you are setting up an account on the system named wsj6700 for the user lisa. In this example, lisa’s home directory will reside on her local disk and will be shared with the other systems she logs in on.

  1. On the local system, do the following:

    1. Create the user’s account. See HP-UX System Administrator’s Guide: Configuration Management.

    2. Export the user’s home directory to other systems that the user needs to log in to:

      • Add an entry, such as flserver, to /etc/dfs/dfstab:

                        share -F -o async,anon=65534 -d “lisa home” /home/lisa
      • Export the home directory/home/lisa:

        shareall -F nfs
  2. On the remote system, do the following:

    1. Create an empty directory:

      mkdir /home/lisa
    2. Add entry to /etc/fstab :

      mailserver:wsj6700:/home/lisa /home/lisa nfs rw,suid 0 0
    3. Mount all directories:

      mount -a

See “Exporting a File System (HP-UX to HP-UX)” for more information.

Exporting a File System (HP-UX to HP-UX)

Use either of the following procedures to set up NFS shares on the server.

Using HP SMH to Export a File System

  1. Log in to the server as root.

  2. Access the HP SMH homepage. Select Tools, Network Services Configuration, Networked File Systems, Share/Unshare File Systems (Export FS).

  3. Enable NFS if necessary:

  4. Choose Share (Export) a File System ...

  5. Fill in the fields identifying the file systems to be shared, their access privileges, and the systems that can import them. Use the online help if necessary.

The shared file system should now be listed in the /etc/dfs/sharetab file. Additional information is contained in help.

Using the Command Line to Export a File System

  1. Log into the server as root.

  2. If the system is not already configured as an NFS server:

    1. Edit /etc/rc.config.d/nfsconf, changing the values for NFS_SERVER and START_MOUNTD to 1.

    2. Run the nfs.server script:

      /sbin/init.d/nfs.server start
  3. Edit /etc/dfs/sharetab, adding an entry for each directory that is to be shareed. The entry identifies the directory and (optionally) the systems that can import it. The entry should look something like this:

    /opt/netscape async,anon=65534,access=wsb2600:appserver:wsb2600:wszx6
    NOTE: If no systems are specified for a particular file system, then all systems have permission to import the file system; if any systems are listed, then only those systems can import the file system.

    See dfstab(4) for more information.

  4. Share the directories:.

    shareall -F nfs

Moving Resources

Moving a System

This is a cookbook for moving a system from one subnet to another, changing the system’s host name, IP address, and Domain Name Server.

NOTE: Do steps 1-10 before moving the system.
  1. Run set_parms:

    /sbin/set_parms hostname

  2. Change the system name when prompted.

  3. Answer “no” to the “reboot?” question.

  4. Run set_parms again:

    /sbin/set_parms ip_address

  5. Change the system IP address when prompted.

  6. Answer “no” to the “reboot?” question.

  7. Run set_parms again:

    /sbin/set_parms addl_netwrk

  8. Change the name and IP address of the Domain Name Server.

  9. Answer “no” to the “reboot?” question.

  10. When you are ready to move the system, shut it down:

    shutdown -h

  11. Unplug and move the system.

    NOTE: Do steps 12-13 after moving the system.
  12. Connect and plug in the system components.

  13. Boot the system.

Moving a Directory (within a File System)

From time to time, a user needs to move a directory, say from /home/user to /work/project5. The following may be helpful as a cookbook.

  1. cp -r /home/user/subdir /work/project5/subdir

    Do not create /work/project5/subdir first.

  2. ll -R /home/user/subdir

  3. ll -R /work/project5/subdir

  4. Compare the output of the last two commands; if they match, proceed to the next step.

  5. rm -r /home/user/subdir

  6. Change permissions if necessary.

    The above operation should leave the ownership intact, but if you have to invoke the root user for some reason, the new files will all be owned by root. There is an elegant way to change permissions throughout a subtree:

    cd /work/project5/subdir

    find . -print | xargs chgrp usergroup

    find . -print | xargs chown user

Popping the Directory Stack

You can avoid retyping long path names when moving back and forth between directories by using the hyphen (-) to indicate the last directory you were in; for example:

$pwd/home/patrick$cd /projects$cd -/home/patrick

Continuing to Work During a Scheduled Downtime

If your file server is down and you share files from that system, those files are inaccessible to you. If you are able to use your system and the necessary software is available, copy the data files into your local directory tree and work on them there while the file server is down. You can also copy any other files or executables you need.

It is very important that you copy any modified files back to the appropriate location on the file server as soon as it is available again.

Also, while the file server is down, do not save files in the shared directory or any other mount point. Such files will be hidden when you remount the file system from the file server.

Diagramming a System’s Disk Usage

It’s useful (and in some circumstances essential) to have a hardcopy diagram of a system’s disks and how they are used. You should create such a diagram at least for each server in the workgroup, and keep it up to date as you add and replace disks and modify the configuration.

  1. Access the HP SMH Homepage.

  2. Select Tools → Disks and File Systems → Disks. This will display a list of the disks in the system.

  3. For each disk this screen shows you:

    • Hardware path (e.g., 1/0/0/3/0.6.0).

    • Usage (e.g., LVM).

    • Volume group (e.g., vg00).

    • The disk’s total capacity.

      (The usable space will be somewhat less than this, probably about 15% less altogether; see “Setting Up Logical Volumes for File Systems” in HP-UX System Administrator’s Guide: Logical Volume Management.)

    • The disk’s model number and in some cases the name of its device driver, for example, HP C3010 SCSI Disk Drive.

  4. Select each disk, one at a time. This will display more information for the selected disk at the bottom of the page. You can then select from Properties, LUN Attributes, LUN Paths, and Physical Volumes tabs to display detailed information for each selected disk.

    • The device file name(s) of the logical volume(s) that occupy the disk.

    • How each logical volume is being used (e.g., HFS, Swap/Dump).

    • The amount of space, in megabytes, being used on this disk by each logical volume.

      If a logical volume is spread over more than one disk, you can use this screen to see how the space is shared among the disks.

      For example, on the system shown in the diagram, logical volume lvol1 of volume group vg02 is distributed across two disks, c0t2d0 and c0t5d0.

    • The file system the logical volume is mounted to, if any.

      You can see how a file system is distributed across LVM disks; for example, the /home directory on the system shown in the diagram is mounted to /dev/vg02/lvol1, which occupies all of c0t2d0 and 356 MB of c0t5d0.

    It’s useful to know the mapping of physical disk space to logical volumes and file systems, so you may want to record it on your own diagram.

    Use the detailed information to begin the diagram: group the disks into their volume groups and fill in their hardware addresses and sizes; you may also want to add the model number (e.g., HP C3010) and device driver name (e.g., SCSI).

  5. You can get information on the logical volumes by clicking on the Logical Volumes tab at the top of the page. This will display a list of logical volumes. You can then select the logical volumes one at a time to obtain similar detailed information for each logical volume.

  6. Clicking on the Volume Groups or File Systems tabs at the top of the page will display additional information such as overall storage available and file system distribution.

Finding Large Files

As a preliminary to getting your users to clean up unneeded files from an overfull volume, it’s useful to identify the largest files (often core files users are unaware of, postscript files they have long ago printed and been forgotten about, folders containing ancient mail, and so on). The following commands are examples of how you might look for these files:

Example 3-1 Producing a directory listing sorted by size

ll dirname | sort -n -k5,6

Example 3-2 Finding files larger than a specific size

This command pipe will provide a listing of files found within a directory tree, rooted at dirname, greater than 2 million characters in size:

find dirname -size +2000000c|xargs ll -d

You can adjust the value for the size to whatever you like. You can also use other options to the find command to further refine your search. For example, the above command pipe can be adjusted to only look for files owned by the user skibby:

find dirname -user skibby -size +2000000c|xargs ll -d

Examining File System Characteristics

To see what characteristics a file system was built with, use the -m option of mkfs. This works particularly well for JFS:

#bdf | grep /work /dev/vg01/lvol8      73728    7856   61648   11% /work #mkfs -m /dev/vg01/lvol8 mkfs -F vxfs -o ninode=unlimited,bsize=8192,version=6,inosize=256,logsize=2048,largefiles0 #
NOTE: bsize in the resulting output is the configured block size, in bytes, of the file system /work. But in JFS file systems, the configured block size determines only the block size of the direct blocks , typically the first blocks written out to a new file. Indirect blocks, typically those added to a file as it is updated over time, all have a block size of 8 kilobytes.

See mkfs_vxfs(1M) for an explanation of each field in the output.

You can also run mkfs -m on an HFS file system, but the output is less friendly, lacking the labels. dumpfs, with grep for the parameter you’re interested in, is better; see “Checking NFS Server/Client Block Size” for an example.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 2008 Hewlett-Packard Development Company, L.P.