分类目录归档:Linux

linux top命令详解

top命令是Linux下常用的性能分析工具,能够实时显示系统中各个进程的资源占用状况,类似于Windows的任务管理器。下面详细介绍它的使用方法。

top – 01:06:48 up 1:22, 1 user, load average: 0.06, 0.60, 0.48
Tasks: 29
total, 1 running, 28 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.3% us, 1.0% sy,
0.0% ni, 98.7% id, 0.0% wa, 0.0% hi, 0.0% si
Mem: 191272k total, 173656k
used, 17616k free, 22052k buffers
Swap: 192772k total, 0k used, 192772k free,
123988k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1379 root 16 0 7976
2456 1980 S 0.7 1.3 0:11.03 sshd
14704 root 16 0 2128 980 796 R 0.7 0.5
0:02.72 top
1 root 16 0 1992 632 544 S 0.0 0.3 0:00.90 init
2 root 34 19 0
0 0 S 0.0 0.0 0:00.00 ksoftirqd/0
3 root RT 0 0 0 0 S 0.0 0.0 0:00.00
watchdog/0

统计信息区
前五行是系统整体的统计信息。第一行是任务队列信息,同 uptime 命令的执行结果。其内容如下:

01:06:48 当前时间
up 1:22 系统运行时间,格式为时:分
1 user 当前登录用户数
load average:
0.06, 0.60, 0.48 系统负载,即任务队列的平均长度。
三个数值分别为 1分钟、5分钟、15分钟前到现在的平均值。

继续阅读

利用LVM为服务器实现扩容

作者:llk726  原始连接: http://llk726.blog.51cto.com/622293/166536
公司的FTP服务器经过几年的运行,现在出现了空间不足的情况,决定用LVM方式实现扩容工作。
思路:先拷贝数据,再购置一块大容量硬盘添加到服务器上,然后将己有的普通分区转换为物理卷,最后通过物理卷创建逻辑卷组来实现容量的扩充。
实现过程:
A、检查系统中是否安装了LVM工具,如果没有安装就下载安装。
[[email protected] ~]# rpm -qa | grep lvm
system-config-lvm-1.0.22-1.0.el5
lvm2-2.02.16-3.el5
B、 创建和管理LVM
1、创建或转换分区
[[email protected] ~]# fdisk /dev/sda
The number of cylinders for this disk is set to 1044.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p(查看分区情况)
Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 25 200781 83 Linux
/dev/sda2 26 535 4096575 83 Linux
/dev/sda3 536 854 2562367+ 83 Linux
/dev/sda4 855 1044 1526175 5 Extended
/dev/sda5 855 905 409626 82 Linux swap / Solaris
/dev/sda6 906 1044 1116486 83 Linux
Command (m for help): t (更改分区类型)
Partition number (1-6): 6 (将第6个分区转换成LVM)
Hex code (type L to list codes): 8e(将分区类型指定为“8e”就是LVM)
Changed system type of partition 6 to 8e (Linux LVM)
Command (m for help): w (保存)
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: 璁惧鎴栬祫婧愬繖.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.