11 月 302012
 

解压缩后移动并重命名
[root@monitor ~]# mv awstats-7.0 /usr/local/awstats

查看程序目录结构
[root@monitor ~]# cd /usr/local/awstats/
[root@monitor awstats]# ls
docs README.TXT tools wwwroot

查看脚本配置工具
[root@monitor awstats]# cd tools/
[root@monitor tools]# ls
awstats_buildstaticpages.pl awstats_exportlib.pl geoip_generator.pl logresolvemerge.pl

urlaliasbuilder.pl xslt
awstats_configure.pl awstats_updateall.pl httpd_conf maillogconvert.pl webmin

创建统计数据存储目录 (AWStats database)
#mkdir /usr/local/awstats/lib
配置文件DirData参数指定,默认/var/lib/awstats

#mkdir /usr/local/awstats/etc
定义配置文件路径时指定,默认/etc/awstats

#mkdir /usr/local/awstats/logs
配置文件LogFile参数指定

执行安装配置脚本

[root@monitor tools]# perl awstats_configure.pl

—– AWStats awstats_configure 1.0 (build 1.9) (c) Laurent Destailleur —–
This tool will help you to configure AWStats to analyze statistics for
one web server. You can try to use it to let it do all that is possible
in AWStats setup, however following the step by step manual setup
documentation (docs/index.html) is often a better idea. Above all if:
– You are not an administrator user,
– You want to analyze downloaded log files without web server,
– You want to analyze mail or ftp log files instead of web log files,
– You need to analyze load balanced servers log files,
– You want to ‘understand’ all possible ways to use AWStats…
Read the AWStats documentation (docs/index.html).

—–> Running OS detected: Linux, BSD or Unix

—–> Check for web server install

首次安装需指定Apache配置文件路径,再次配置时选择none选项跳过
Enter full config file path of your Web server.
Example: /etc/httpd/httpd.conf
Example: /usr/local/apache2/conf/httpd.conf
Example: c:\Program files\apache group\apache\conf\httpd.conf
Config file path (‘none’ to skip web server setup):
> /etc/httpd/conf/httpd.conf

—–> Check and complete web server config file ‘/etc/httpd/conf/httpd.conf’
Add ‘Alias /awstatsclasses “/usr/local/awstats/wwwroot/classes/”‘
Add ‘Alias /awstatscss “/usr/local/awstats/wwwroot/css/”‘
Add ‘Alias /awstatsicons “/usr/local/awstats/wwwroot/icon/”‘
Add ‘ScriptAlias /awstats/ “/usr/local/awstats/wwwroot/cgi-bin/”‘
Add ‘<Directory>’ directive
AWStats directives added to Apache config file.

—–> Update model config file ‘/usr/local/awstats/wwwroot/cgi-bin/awstats.model.conf’
File awstats.model.conf updated.

定义一个配置文件
—–> Need to create a new config file ?
Do you want me to build a new AWStats config/profile
file (required if first install) [y/N] ? y

定义配置文件名称
—–> Define config file name to create
What is the name of your web site or profile analysis ?
Example: www.mysite.com
Example: demo
Your web site, virtual server or profile name:
> gup.com

定义配置文件路径
—–> Define config file path
In which directory do you plan to store your config file(s) ?
Default: /etc/awstats
Directory path to store config file(s) (Enter for default):
>

—–> Create config file ‘/etc/awstats/awstats.gup.com.conf’
Config file /etc/awstats/awstats.gup.com.conf created.

—–> Add update process inside a scheduler
Sorry, configure.pl does not support automatic add to cron yet.
You can do it manually by adding the following command to your cron:
/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=gup.com
Or if you have several config files and prefer having only one command:
/usr/local/awstats/tools/awstats_updateall.pl now
Press ENTER to continue…

A SIMPLE config file has been created: /etc/awstats/awstats.gup.com.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for ‘gup.com’ with command:
> perl awstats.pl -update -config=gup.com
You can also build static report pages for ‘gup.com’ with command:
> perl awstats.pl -output=pagetype -config=gup.com

Press ENTER to finish…

[root@monitor tools]#

编辑配置文件
日志合并分析

加入计划任务
更新指定配置文件
#/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=gup.com
更新所有配置文件
#/usr/local/awstats/tools/awstats_updateall.pl now

生成静态页面
#awstats.pl -output=gup.html -config=gup.com > index.html

目录设置问题
[root@monitor logs]# perl ../wwwroot/cgi-bin/awstats.pl -update -config=gup.com
Error: AWStats database directory defined in config file by ‘DirData’ parameter

(/usr/local/awstats/lib) does not exist or is not writable.
Setup (‘/etc/awstats/awstats.gup.com.conf’ file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in ‘docs’ directory).

手工生成统计
[root@monitor logs]# perl ../wwwroot/cgi-bin/awstats.pl -update -config=gup.com
Create/Update database for config “/etc/awstats/awstats.gup.com.conf” by AWStats version 7.0 (build

1.971)
From data in log file “/usr/local/awstats/logs/app01_access_log.2012-11.txt”…
Phase 1 : First bypass old records, searching new record…
Searching new records from beginning of log file…
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)…
Jumped lines in file: 0
Parsed lines in file: 4
Found 0 dropped records,
Found 0 comments,
Found 0 blank records,
Found 0 corrupted records,
Found 0 old records,
Found 4 new qualified records.

实际地址
http://192.168.11.70/awstats/awstats.pl?config=gup.com

相关下载:
(1)AWStats 7.0

11 月 302012
 

在单一体系结构下同时安装32位和64位包
echo ‘multilib_policy=all’ >> /etc/yum.conf

指定体系结构

查看当前系统体系结构
[root@oracle ~]# uname -ar
Linux oracle 2.6.32-279.14.1.el6.x86_64 #1 SMP Tue Nov 6 23:43:09 UTC 2012 x86_64 x86_64 x86_64

GNU/Linux

查看系统当前安装的iptables包
[root@oracle ~]# rpm -q iptables
iptables-1.4.7-5.1.el6_2.x86_64

使用YUM在64位环境下指定安装iptables的32位包
[root@oracle ~]# yum install iptables.i686
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.163.com
* updates: mirrors.163.com
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package iptables.i686 0:1.4.7-5.1.el6_2 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================
Package Arch Version Repository Size
=================================================================================================
Installing:
iptables i686 1.4.7-5.1.el6_2 base 241 k

Transaction Summary
=================================================================================================
Install 1 Package(s)

Total download size: 241 k
Installed size: 702 k
Is this ok [y/N]:

指定版本

查看当前安装版本
[root@oracle ~]# rpm -q cups
cups-1.4.2-48.el6_3.1.x86_64

查看是否有新版本及版本号
[root@oracle ~]# yum update |grep cups
—> Package cups.x86_64 1:1.4.2-48.el6_3.1 will be updated
—> Package cups.x86_64 1:1.4.2-48.el6_3.3 will be an update
—> Package cups-libs.x86_64 1:1.4.2-48.el6_3.1 will be updated
—> Package cups-libs.x86_64 1:1.4.2-48.el6_3.3 will be an update
cups x86_64 1:1.4.2-48.el6_3.3 updates 2.3 M
cups-libs x86_64 1:1.4.2-48.el6_3.3 updates 316 k

[root@oracle ~]#

安装指定版本
[root@oracle ~]# yum install cups-1.4.2-48.el6_3.3
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.163.com
* updates: mirrors.163.com
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package cups.x86_64 1:1.4.2-48.el6_3.1 will be updated
—> Package cups.x86_64 1:1.4.2-48.el6_3.3 will be an update
–> Processing Dependency: cups-libs = 1:1.4.2-48.el6_3.3 for package: 1:cups-1.4.2-48.el6_3.3.x86_64
–> Running transaction check
—> Package cups-libs.x86_64 1:1.4.2-48.el6_3.1 will be updated
—> Package cups-libs.x86_64 1:1.4.2-48.el6_3.3 will be an update
–> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================
Package Arch Version Repository Size
=================================================================================================
Updating:
cups x86_64 1:1.4.2-48.el6_3.3 updates 2.3 M
Updating for dependencies:
cups-libs x86_64 1:1.4.2-48.el6_3.3 updates 316 k

Transaction Summary
=================================================================================================
Upgrade 2 Package(s)

Total download size: 2.6 M
Is this ok [y/N]:

11 月 302012
 

查看已安装包的文件及路径

[root@oracle ~]# rpm -lq mailx
/bin/mail
/bin/mailx
/etc/mail.rc
/usr/bin/Mail
/usr/bin/nail
/usr/share/doc/mailx-12.4
/usr/share/doc/mailx-12.4/AUTHORS
/usr/share/doc/mailx-12.4/COPYING
/usr/share/doc/mailx-12.4/README
/usr/share/man/man1/Mail.1.gz
/usr/share/man/man1/mail.1.gz
/usr/share/man/man1/mailx.1.gz
/usr/share/man/man1/nail.1.gz
[root@oracle ~]#

Continue reading »

11 月 302012
 

安装计划任务服务
#yum install crontabs

查看crond系统服务运行状态
[root@oracle ~]# service crond status
crond (pid 1918) is running…
[root@oracle ~]#

CentOS6.3最小化安装环境下的依赖包关系
Dependencies Resolved

===============================================================================

=
Package Arch Version Repository Size
===============================================================================

=
Installing:
crontabs noarch 1.10-33.el6 base 10 k
Installing for dependencies:
cronie x86_64 1.4.4-7.el6 base 70 k
cronie-anacron x86_64 1.4.4-7.el6 base 29 k
cyrus-sasl x86_64 2.1.23-13.el6 base 78 k
hesiod x86_64 3.1.0-19.el6 base 20 k
procmail x86_64 3.22-25.1.el6 base 163 k
sendmail x86_64 8.14.4-8.el6 base 717 k

Transaction Summary
===============================================================================

=
Install 7 Package(s)

限制用户使用计划任务

当cron.allow文件存在,列出的用户被允许使用,同时忽略cron.deny文件
当cron.allow文件不存在,在cron.deny中列出的用户都被禁止使用计划任务
每行一个用户,修改后必须重启crond服务
#ls /etc/cron.allow(CentOS6.3最小化安装默认不存在此文件)
#ls /etc/cron.deny

查看系统定义计划任务配置文件存储目录
[root@oracle ~]# ls /etc/cron.
cron.d/ cron.deny cron.monthly/
cron.daily/ cron.hourly/ cron.weekly/
[root@oracle ~]#

关于CenOS6.3中run-parts的说明
#man 4 crontabs
Historically the crontab file contained configuration which called run-parts on

files in cron.{daily,weekly,monthly} directories. These jobs are now run

indirectly through anacron to prevent conflicts between cron and anacron.

That means the anacron package has to be installed if the jobs in these

directories should be running. Refer to the anacron(8) how to limit the time of

day of the job execution.

以前包含在crontab文件中的用以配置cront.{daily,weekly,month}目录的run-parts配置

,已经改由anacron服务来管理,以此避免cron和anacron的冲突,这也就意味着,如果要

运行这些目录中的计划任务,就有必要安装anacron服务。

查看全局crontab配置文件
#cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# For details see man 4 crontabs

# Example of job definition:
# .—————- minute (0 – 59)
# | .————- hour (0 – 23)
# | | .———- day of month (1 – 31)
# | | | .——- month (1 – 12) OR jan,feb,mar,apr …
# | | | | .—- day of week (0 – 6) (Sunday=0 or 7) OR

sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed

用户级别计划任务设置
[root@oracle ~]# crontab -e

查看用户级别计划任务配置文件
[root@oracle ~]# ls /var/spool/cron/
root
[root@oracle ~]# cat /var/spool/cron/root
#Configuration for cron By Root
[root@oracle ~]#

列出当前计划任务
[root@oracle ~]# crontab -l

五个星号所代表的单位及可用值
*(分钟0-59) *(小时0-23) *(日1-31) *(月1-12) *(周0-6)

月可用英文简写
周日可用0或7代替,可用英文简写

示例
1 * * * *
每小时第一分钟

*/1 * * * *
每一分钟

* 1 * * *
每天1点钟

15 1 * * *
每天1点15分

* */1 * * *
每一小时

15 1 * * 1-5
每周一至周五的1点15分

英文月份与星期的全拼与简写
January Jan
February Feb
March Mar
April Apr
May May
June June
July July
August Aug
September Sept
October Oct
November Nov
December Dec

Monday Mon
Tuesday Tue
Wednesday Wed
Thursday Thur
Friday Fri
Saturday Sat
Sunday Sun

11 月 302012
 

使用fdisk列表磁盘设备

 [root@oracle ~]# fdisk -l
Disk /dev/sda: 107.4 GB, 107374182400 bytes
 255 heads, 63 sectors/track, 13054 cylinders
 Units = cylinders of 16065 * 512 = 8225280 bytes
 Sector size (logical/physical): 512 bytes / 512 bytes
 I/O size (minimum/optimal): 512 bytes / 512 bytes
 Disk identifier: 0x00013e83

Device Boot Start End Blocks Id System
 /dev/sda1 * 1 64 512000 83 Linux
 Partition 1 does not end on cylinder boundary.
 /dev/sda2 64 13055 104344576 8e Linux LVM

Disk /dev/sdb: 10.7 GB, 10737418240 bytes
 255 heads, 63 sectors/track, 1305 cylinders
 Units = cylinders of 16065 * 512 = 8225280 bytes
 Sector size (logical/physical): 512 bytes / 512 bytes
 I/O size (minimum/optimal): 512 bytes / 512 bytes
 Disk identifier: 0x00000000

Disk /dev/mapper/vg_oracle-lv_root: 53.7 GB, 53687091200 bytes
 255 heads, 63 sectors/track, 6527 cylinders
 Units = cylinders of 16065 * 512 = 8225280 bytes
 Sector size (logical/physical): 512 bytes / 512 bytes
 I/O size (minimum/optimal): 512 bytes / 512 bytes
 Disk identifier: 0x00000000

Disk /dev/mapper/vg_oracle-lv_swap: 4227 MB, 4227858432 bytes
 255 heads, 63 sectors/track, 514 cylinders
 Units = cylinders of 16065 * 512 = 8225280 bytes
 Sector size (logical/physical): 512 bytes / 512 bytes
 I/O size (minimum/optimal): 512 bytes / 512 bytes
 Disk identifier: 0x00000000

Disk /dev/mapper/vg_oracle-lv_home: 48.9 GB, 48930750464 bytes
 255 heads, 63 sectors/track, 5948 cylinders
 Units = cylinders of 16065 * 512 = 8225280 bytes
 Sector size (logical/physical): 512 bytes / 512 bytes
 I/O size (minimum/optimal): 512 bytes / 512 bytes
 Disk identifier: 0x00000000
[root@oracle ~]#

整块磁盘作为物理卷使用,必须清除已有分区表信息

创建物理卷

 [root@oracle ~]# pvcreate /dev/sdb
 Writing physical volume data to disk "/dev/sdb"
 Physical volume "/dev/sdb" successfully created
 [root@oracle ~]#

扫描用作物理卷的块设备

 [root@oracle ~]# lvmdiskscan
 /dev/ram0 [ 16.00 MiB]
 /dev/root [ 50.00 GiB]
 /dev/ram1 [ 16.00 MiB]
 /dev/sda1 [ 500.00 MiB]
 /dev/vg_oracle/lv_swap [ 3.94 GiB]
 /dev/ram2 [ 16.00 MiB]
 /dev/sda2 [ 99.51 GiB] LVM physical volume
 /dev/vg_oracle/lv_home [ 45.57 GiB]
 /dev/ram3 [ 16.00 MiB]
 /dev/ram4 [ 16.00 MiB]
 /dev/ram5 [ 16.00 MiB]
 /dev/ram6 [ 16.00 MiB]
 /dev/ram7 [ 16.00 MiB]
 /dev/ram8 [ 16.00 MiB]
 /dev/ram9 [ 16.00 MiB]
 /dev/ram10 [ 16.00 MiB]
 /dev/ram11 [ 16.00 MiB]
 /dev/ram12 [ 16.00 MiB]
 /dev/ram13 [ 16.00 MiB]
 /dev/ram14 [ 16.00 MiB]
 /dev/ram15 [ 16.00 MiB]
 /dev/sdb [ 10.00 GiB] LVM physical volume
 3 disks
 17 partitions
 1 LVM physical volume whole disk
 1 LVM physical volume
 [root@oracle ~]#

显示物理卷属性

 [root@oracle ~]# pvs
 PV VG Fmt Attr PSize PFree
 /dev/sda2 vg_oracle lvm2 a-- 99.51g 0
 /dev/sdb lvm2 a-- 10.00g 10.00g

显示物理卷详细参数
[root@oracle ~]# pvdisplay
— Physical volume —
PV Name /dev/sda2
VG Name vg_oracle
PV Size 99.51 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 25474
Free PE 0
Allocated PE 25474
PV UUID JdCNKZ-Rkhn-yU3I-b90L-PsBA-OeWh-eFKRxo

“/dev/sdb” is a new physical volume of “10.00 GiB”
— NEW Physical volume —
PV Name /dev/sdb
VG Name
PV Size 10.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID vXmWfe-qy80-PLkB-4OP1-XG7z-d2h5-XoMu7W

[root@oracle ~]# pvscan
PV /dev/sda2 VG vg_oracle lvm2 [99.51 GiB / 0 free]
PV /dev/sdb lvm2 [10.00 GiB]
Total: 2 [109.51 GiB] / in use: 1 [99.51 GiB] / in no VG: 1 [10.00 GiB]
[root@oracle ~]#

删除物理卷(如果物理卷已加入卷组,则需要先从卷组中删除此物理卷)
[root@oracle ~]# pvremove /dev/sdb
Labels on physical volume “/dev/sdb” successfully wiped

————————————————

创建卷组

 #vgcreate vg1 /dev/sdb /dev/sdc

在当前卷组中添加物理卷

 [root@oracle ~]# pvscan
 PV /dev/sda2 VG vg_oracle lvm2 [99.51 GiB / 0 free]
 PV /dev/sdb lvm2 [10.00 GiB]
 Total: 2 [109.51 GiB] / in use: 1 [99.51 GiB] / in no VG: 1 [10.00 GiB]
 [root@oracle ~]# vgextend vg_oracle /dev/sdb
 Volume group "vg_oracle" successfully extended
 [root@oracle ~]# pvscan
 PV /dev/sda2 VG vg_oracle lvm2 [99.51 GiB / 0 free]
 PV /dev/sdb VG vg_oracle lvm2 [10.00 GiB / 10.00 GiB free]
 Total: 2 [109.50 GiB] / in use: 2 [109.50 GiB] / in no VG: 0 [0 ]
 [root@oracle ~]#
查看卷组信息
 [root@oracle ~]# vgs
 VG #PV #LV #SN Attr VSize VFree
 vg_oracle 2 3 0 wz--n- 109.50g 10.00g
 [root@oracle ~]# vgdisplay
 --- Volume group ---
 VG Name vg_oracle
 System ID
 Format lvm2
 Metadata Areas 2
 Metadata Sequence No 5
 VG Access read/write
 VG Status resizable
 MAX LV 0
 Cur LV 3
 Open LV 3
 Max PV 0
 Cur PV 2
 Act PV 2
 VG Size 109.50 GiB
 PE Size 4.00 MiB
 Total PE 28033
 Alloc PE / Size 25474 / 99.51 GiB
 Free PE / Size 2559 / 10.00 GiB
 VG UUID O3uWt8-me7n-8vrZ-fcO2-5Z6b-SUse-e0llmJ

[root@oracle ~]#

从卷组中删除物理卷
[root@oracle ~]# vgreduce vg_oracle /dev/sdb
Removed “/dev/sdb” from volume group “vg_oracle”

[root@oracle ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 vg_oracle lvm2 a– 99.51g 0
/dev/sdb lvm2 a– 10.00g 10.00g
[root@oracle ~]# vgs
VG #PV #LV #SN Attr VSize VFree
vg_oracle 1 3 0 wz–n- 99.51g 0
[root@oracle ~]#

删除(不包含逻辑卷的)卷组
[root@oracle ~]# vgremove vg1-new
Volume group “vg1-new” successfully removed
[root@oracle ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 vg_oracle lvm2 a– 99.51g 0
/dev/sdb lvm2 a– 10.00g 10.00g
[root@oracle ~]#

分割卷组
[root@oracle ~]# vgsplit vg_oracle new_vg /dev/sdb
New volume group “new_vg” successfully split from “vg_oracle”
[root@oracle ~]# vgs
VG #PV #LV #SN Attr VSize VFree
new_vg 1 0 0 wz–n- 10.00g 10.00g
vg_oracle 1 3 0 wz–n- 99.51g 0
[root@oracle ~]#

合并卷组
[root@oracle ~]# vgmerge -v vg_oracle new_vg
Checking for volume group “new_vg”
Checking for volume group “vg_oracle”
Archiving volume group “new_vg” metadata (seqno 2).
Archiving volume group “vg_oracle” metadata (seqno 8).
Writing out updated volume group
Creating volume group backup “/etc/lvm/backup/vg_oracle” (seqno 9).
Volume group “new_vg” successfully merged into “vg_oracle”
[root@oracle ~]# vgs
VG #PV #LV #SN Attr VSize VFree
vg_oracle 2 3 0 wz–n- 109.50g 10.00g
[root@oracle ~]#

重命名卷组
[root@oracle ~]# vgcreate vg1 /dev/sdb
Volume group “vg1” successfully created
[root@oracle ~]# vgs
VG #PV #LV #SN Attr VSize VFree
vg1 1 0 0 wz–n- 10.00g 10.00g
vg_oracle 1 3 0 wz–n- 99.51g 0
[root@oracle ~]# vgrename vg1 vg1-new
Volume group “vg1” successfully renamed to “vg1-new”
[root@oracle ~]# vgs
VG #PV #LV #SN Attr VSize VFree
vg1-new 1 0 0 wz–n- 10.00g 10.00g
vg_oracle 1 3 0 wz–n- 99.51g 0
[root@oracle ~]#

————————————————

逻辑卷的三种类型:线性卷,条状卷,镜像卷

创建指定大小的逻辑卷分区
[root@oracle ~]# lvcreate -L 6G -n new_vg-lv_01 new_vg
Logical volume “new_vg-lv_01” created

查看创建的逻辑卷
#lvs
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
new_vg-lv_01 new_vg -wi-a— 6.00g
lv_home vg_oracle -wi-ao– 41.57g
lv_root vg_oracle -wi-ao– 50.00g
lv_swap vg_oracle -wi-ao– 3.94g
[root@oracle ~]#

对逻辑卷进行格式化
[root@oracle ~]# mkfs.ext4 /dev/new_vg/new_vg-lv_01
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
393216 inodes, 1572864 blocks
78643 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1610612736
48 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736

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

This filesystem will be automatically checked every 23 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@oracle ~]#

查看逻辑卷信息
[root@oracle ~]# lvscan
ACTIVE ‘/dev/new_vg/new_vg-lv_01’ [6.00 GiB] inherit
ACTIVE ‘/dev/vg_oracle/lv_root’ [50.00 GiB] inherit
ACTIVE ‘/dev/vg_oracle/lv_home’ [41.57 GiB] inherit
ACTIVE ‘/dev/vg_oracle/lv_swap’ [3.94 GiB] inherit
[root@oracle ~]#

查看逻辑卷参数信息
#lvdisplay

增大逻辑卷
[root@oracle ~]# lvextend -L +1G /dev/new_vg/new_vg-lv_01
Extending logical volume new_vg-lv_01 to 7.00 GiB
Logical volume new_vg-lv_01 successfully resized

增大逻辑卷后更新文件系统
[root@oracle ~]# resize2fs /dev/new_vg/new_vg-lv_01
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/new_vg/new_vg-lv_01 to 1835008 (4k) blocks.
The filesystem on /dev/new_vg/new_vg-lv_01 is now 1835008 blocks long.

[root@oracle ~]#

删除逻辑卷
[root@oracle ~]# lvremove /dev/new_vg/new_vg-lv_01
Do you really want to remove active logical volume new_vg-lv_01? [y/n]: y
Logical volume “new_vg-lv_01” successfully removed
[root@oracle ~]#

挂载逻辑卷
[root@oracle ~]# mount /dev/new_vg/new_vg-lv_01 /new/
[root@oracle ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_oracle-lv_root
50G 13G 35G 27% /
tmpfs 939M 492M 448M 53% /dev/shm
/dev/sda1 485M 54M 406M 12% /boot
/dev/mapper/vg_oracle-lv_home
45G 2.6G 41G 7% /home
/dev/mapper/new_vg-new_vg–lv_01
2.0G 67M 1.9G 4% /new
[root@oracle ~]#

自动挂载文件系统
#vi /etc/fstab
/dev/new_vg/new_vg-lv_01 /new ext4 default 0 0