HPunix common system management commands

Source: Internet
Author: User
HP-UX hard disk resources logical volume management HP-UX management hard disk storage resources are managed by logical volume method, to clarify the entire mechanism, first introduce several concepts: physical volume PhysicalVolume, PV: refers to the physical hard disk. a hard disk is a PV. the logical volume group LogicalVolumeGroup, known as VG: a VG contains an integer PV

Logical Volume Management for hard disk resources for HP-UX

HP-UX management of hard disk storage resources is the use of logical volumes to manage, to clarify the entire mechanism, first to introduce several concepts:

Physical Volume, called PV: refers to the Physical hard disk, a hard disk is a PV. logical Volume Group (VG): a VG contains an integer PV, which can be considered as a large hard disk.

Logical Volume, called LV: it is equivalent to a Logical partition of a large hard disk. a VG can contain several LV.

File System: on the basis of logical volumes, you can create a File System and MOUNT it to a directory. in this way, you can use this hard disk by means of File access.

Of course, you can also directly use LV as a bare device without creating a file system to access data in TRUNK mode. many databases use this method to access data.

According to the above introduction, the sequence of correct use of hard disks in HPUX and the corresponding commands are as follows:

1. create a physical volume first:
# Pvcreate-f/dev/rdsk/cCdDtT
The hard drive character device file must be used here

2. create another logical volume group:
# Mkdir/dev/vg0X X: 0 ~ F, logical volume group name
# Mknod/dev/vg0X/group c 64 0x0X0000
# Vgcreate vg0X/dev/dsk/cCdDtT

3. Divide the logical volume:
# Lvcreate-L size vg0X size: logical volume size

4. create a file system on LV:
# Newfs-F file_system_type/dev/vg0X/rlvolY
File_system_type: file system type, including hfs and vxfs. Note that the character device file of the logical volume is used at this time.

5. Mount the file system to a directory:
# Mkdir/directory
# Mount/dev/vg0X/lvolY/directory
So far, you can use this hard disk. Sometimes you may need to add or delete logical volumes or expand the file system in an existing environment. We can do this:

6. add a logical volume
1) add a file system volume. For example, add a M file system volume to vg01 and mount the volume to the directory/sample.
A. create A logical volume and enter the following command at the system prompt:
# LV create-L 200-n data/dev/vg01
B. create a file system on logical volume data:
# Newfs-F hfs/dev/vg01/rdata
Note: For a vxfs file system, use
# Newfs-F vxfs/dev/vg01/rdata
C. create a directory/sample and mount the logical volume data to/sample.
# Mkdir sample"
# Mount/dev/vg01/data/sample
D. run the bdf Command to mount/dev/vg01/data to/sample.
2) add a non-file system volume (raw data volume ). Same as above.
A. create A logical volume and enter the following command at the system prompt:
# LV create-L 200-n data/dev/vg01
B. create a directory/sample and mount the logical volume data to/sample.
# Mkdir sample
# Mount/dev/vg01/data/sample
C. run the bdf Command to mount/dev/vg01/data to/sample.

7. delete a logical volume
For example, delete the logical volume named data in vg01 and mount it to/sample.
1) uninstall the logical volume to be deleted:
A. run the umount command to unmount the logical volume data from/sample:
# Umount/sample
B. If the system prompts that the device is busy and cannot be uninstalled, type the following command at the root directory system prompt to enter a single user:
# Shutdown-y 0
Under a single user, mount all logical volumes and enter the following command:
# Mount-
Run the bdf Command to check whether the logical volume is mounted. if the logical volume is mounted, type the following command:
# Umount/sample
2) delete the logical volume/dev/vg01/data by running the following command:
# Lvremove/dev/vg01/data

8. expand the file system
1) to expand the file system, you must first find the logical volume corresponding to the file system. only by first expanding the logical volume and giving the file system an extended space can you expand the file system.
2) to expand the logical volume, run the following command at the root directory system prompt:
# Shutdown-y 0
3) after entering a single user, mount all the file systems and enter the following command:
# Mount-
4) run the bdf Command to check whether the file system is mounted. if it is mounted, run the command # umount file system name umount to check whether the file system is mounted. For example, to expand "/usr" to 500 M, type the command:
# Umount/usr
5) run the following command:
# Lvextend-L 500/dev/vg00/lvol4
Assume that/usr corresponds to/dev/vg00/lvol4.
6) run the following command:
# Extendfs/dev/vg00/lvol4 expand the file system.
Note: For a vxfs file system, use
# Extendfs-F vxfs/dev/vg00/lvol4
7) run the following command:
# Mount/dev/vg00/lvol4/usr
Mount the file system to/usr
In this way, the file system "/usr" is expanded,
8) run the following command:
# Init 3 enters the original multi-user running level.

UNIX file system
A unix file system is a tree structure that generally refers to a collection of files on a logical volume. Starting from the root, the file system looks like a whole on the surface, but in fact, the file system can be divided into different parts, occupying a separate logical volume, which is a file system.

11. how do I change the hostname and IP address?

A:
# Set_parms

It can be:
Hostname (change host name)
Ip_address (change IP address)

How can I check what software is installed in the system?

A: To view the software installed in the system, run the following command:

# Swlist

What if a super user forgets the password?

* Restart the machine. after the self-check is completed, the line "To discontinue, press any key in 10 seconds" will appear. press any key and the system will stop the startup and enter the Main Menu.

* Type "bo" and ask "Interact with IPL (Y or N?)?" in the system ?)?", Enter "y ".

* Enter "hpux-is" after the ISL> prompt, and the system enters the single-user status.

* Type "passwd" and enter a new password.

* Type "init 3" to restore normal system operation.

How to add and delete logical volumes

1. add a logical volume

1) add a file system volume. For example, add a M file system volume to vg01 and mount the volume to the directory/sample.

A. create A logical volume and enter the following command at the system prompt:
"Lvcreate-L 200-n data/dev/vg01"

B. create a file system on logical volume data:
"Newfs-F hfs/dev/vg01/rdata"
Note: For a vxfs file system, use "newfs-F vxfs
/Dev/vg01/rdata"

C. create a directory/sample and mount the logical volume data to/sample.
"Mkdir sample"
"Mount/dev/vg01/data/sample"

D. run the bdf Command to mount/dev/vg01/data to/sample.

2) add a non-file system volume (raw data volume ). Same as above.

A. create A logical volume and enter the following command at the system prompt:
"Lvcreate-L 200-n data/dev/vg01"

B. create a directory/sample and mount the logical volume data to/sample.
"Mkdir sample"
"Mount/dev/vg01/data/sample"

C. run the bdf Command to mount/dev/vg01/data to/sample.

2. delete a logical volume

For example, delete the logical volume named data in vg01 and mount it to/sample.

1) uninstall the logical volume to be deleted:
A. run the umount command to unmount the logical volume data from/sample:
"Umount/sample"

B. If the system prompts that the device is busy and cannot be uninstalled, enter
Run the following command to enter a single user:
"Shutdown-y 0"
Under a single user, mount all logical volumes and enter the following command:
"Mount-"
Run the bdf Command to check whether the logical volume is mounted. if the logical volume is mounted, type the following command:
"Umount/sample"

2) delete the logical volume/dev/vg01/data by running the following command:
"Lvremove/dev/vg01/data"

What command can be used to view the network devices in the host?

Run the lanscan command to view the Nic in the host. For example:
# Lanscan
Hardware Station Crd Hdw Net-Interface nm mac HP-DLPI DLPI
Path Address In # State NamePPA ID Type Support Mjr #
10/4/8 0x00108318E6E8 0 UP lan0 snap0 1 ETHER Yes 119
10/12/6 0x0060B0C44462 1 UP lan1 snap1 2 ETHER Yes 119

The preceding command shows that there are three NICs in the host. their related parameters are as follows:
The Hardware addresses are 10/4/8 and 10/4/12 respectively (Hardware Path)
Nic names are lan0 and lan1 (Net-Interface Name columns)
The NMID of each network adapter is 1 and 2 (NMID column)
The working statuses of each network adapter are UP, DOWN, and UP (Hdw state columns)
The MAC Address of each Nic is the column corresponding to the Station Address.

To enable a network adapter to work normally, the network-Interface name must be UP.
Run the ifconfig command to view the IP address of the NIC. For example:

# Ifconfig lan0
Lan0: flags = 863
Inet 15.85.114.14 netmask fffff800 broadcast 15.85.119.255

The IP address on the LAN 0 is 15.85.114.14 (inet), the subnet mask is ffff800, and the broadcast address is 15.85.119.255.

/Etc/hosts
The host name resolution file that corresponds to the host name and IP address.

2./etc/passwd
Password file with the following content:
Logon username: Encrypted password: User ID: group ID: RETAIN: initial working directory: shell path

3./etc/group
Content:
Group name: Encrypted password: group ID: all users in the group.

4./etc/profile
If this file exists, each user will execute this file upon logon. This file is generally used to set some common environment variables. if the. profile file exists in the user's home directory, the user's. profile file will be executed after/etc/profile is executed.

5./etc/inittab
After internal initialization, the system starts the deamon process/etc/init so that the/etc/init process has control over the boot sequence. The init process obtains instructions from the file/etc/inittab (init table, initialization table). the content of this file controls all the init states, and also controls the regeneration of dead processes.

6./etc/fstab
Information of the file system that can be mounted in the system.

7./etc/lvmtab
Run the following command:
# Strings/etc/lvmtab; View system VG and disk information.

8./etc/rc. config. d/netconf
Contains the system name and network configuration information, such as the IP address, subnet mask, and route information.

9./stand/system
Contains the system driver and subsystem information, kernel device information, and some system adjustable parameter information.

Log file monitoring and file cleanup

Common log files:

File name content monitoring method

/Etc/rc. log/etc/rc running records read text files,

/Var/adm/syslog. log note the prompt information and corresponding

/Var/adm/sw/*. log software installation log date, analyze related problems.

/Var/adm/wtmp user logon information can be viewed using the last command

/Var/adm/btmp user logon failure information can be viewed using the lastb command

/Var/sam/log/samlog SAM log

/Var/spool/mqueue/syslogSendmailLogs

/Etc/shutdownlog shutdown information

/Usr/adm/diag/LOGxxx

/Var/adm/nettl. LOG * network logs are handled by HP engineers

/Var/adm/crash core dump file is cleaned by HP engineers

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.