---
title: "hp-ux创建lv实例"
author: "andyniu"
date: "2013-08-28T09:20:36Z"
tags: []
categories: ["操作系统"]
slug: "hp-ux-lv"
draft: false
lastmod: "2013-08-28T10:18:58Z"
id: 1931906
url: "https://andyniu.iteye.com/blog/1931906"
---

hp-ux创建lv实例

 

1\. vgdisplay查看卷组

 

\[root@jcsrv2:/]# vgdisplay

--- Volume groups ---

VG Name                     /dev/vg00

VG Write Access             read/write     

VG Status                   available                 

Max LV                      255    

Cur LV                      8      

Open LV                     8      

Max PV                      16     

Cur PV                      3      

Act PV                      3      

Max PE per PV               4350         

VGDA                        6   

PE Size (Mbytes)            8               

Total PE                    13020   

Alloc PE                    12825   

Free PE                     195     

Total PVG                   0        

Total Spare PVs             0              

Total Spare PVs in use      0                    

VG Name                     /dev/vg\_jc

VG Write Access             read/write     

VG Status                   available                 

Max LV                      255    

Cur LV                      24     

Open LV                     24     

Max PV                      16     

Cur PV                      2      

Act PV                      2      

Max PE per PV               1600         

VGDA                        4   

PE Size (Mbytes)            128             

Total PE                    2398    

Alloc PE                    1929    

Free PE                     469     

Total PVG                   0        

Total Spare PVs             0              

Total Spare PVs in use      0                    

 

2\.  在vg00卷组中  创建  一个10M的 名字 为xyy的逻辑卷

 

\[root@jcsrv2:/]# l[vc](http://www.2cto.com/kf/ware/vc/)reate -L 10  -n xyy /dev/vg00/xyy

lvcreate: Volume group "/dev/vg00/xyy" does not exist in the "/etc/lvmtab" file.

\[root@jcsrv2:/]# lvcreate -L 10  -n xyy /dev/vg00

Warning: rounding up logical volume size to extent boundary at size "16" MB.

Logical volume "/dev/vg00/xyy" has been successfully created with

character device "/dev/vg00/rxyy".

Logical volume "/dev/vg00/xyy" has been successfully extended.

Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf

 

3.查看是否存在 xyy  逻辑卷

 

\[root@jcsrv2:/]# lvdisplay  /dev/vg00/xyy

--- Logical volumes ---

LV Name                     /dev/vg00/xyy

VG Name                     /dev/vg00

LV Permission               read/write   

LV Status                   available/syncd           

Mirror copies               0            

Consistency Recovery        MWC                 

Schedule                    parallel     

LV Size (Mbytes)            16              

Current LE                  2         

Allocated PE                2           

Stripes                     0       

Stripe Size (Kbytes)        0                   

Bad block                   on           

Allocation                  strict                    

IO Timeout (Seconds)        default      

 

 

4.为  /dev/vg00/xyy 逻辑卷 创建文件[系统](http://www.2cto.com/os/)

newfs -F vxfs /dev/vg00/rxyy

 

5\. mkdir /xyy    //创建一个挂载点

 

6\. mount   /dev/vg00/xyy         /xyy                           //挂载新创建的文件系统

 

7.bdf                   //进行查看

\[root@jcsrv2:/]# bdf

Filesystem          kbytes    used   avail %used Mounted on

/dev/vg00/lvol3    2048000  513552 1522760   25% /

/dev/vg00/lvol1     497584   74360  373464   17% /stand

/dev/vg00/lvol8    3072000 1020760 2035576   33% /var

/dev/vg00/lvol7    5120000 1685792 3407448   33% /usr

/dev/vg00/lvol6    3072000  406376 2645760   13% /tmp

/dev/vg00/lvol5    12288000 7919968 4343296   65% /opt

/dev/vg00/lvol4     516096   15544  496712    3% /home

/dev/vg00/xyy        16384    1117   14320    7% /xyy

\[root@jcsrv2:/]#

vi /etc/fstab   --让其开机生效 

/dev/vgbak/lv\_data2 /data2  vxfs  delaylog 0 2

8.umount     /xyy           //取消挂载

 

9\. lvremove   /dev/vg00/xyy       //删除   /dev/vg00/xyy 逻辑卷

 

\[root@jcsrv2:/]# lvremove  /dev/vg00/xyy

The logical volume "/dev/vg00/xyy" is not empty;

do you really want to delete the logical volume (y/n) : y

Logical volume "/dev/vg00/xyy" has been successfully removed.

Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf

 

10\.  \[root@jcsrv2:/]# lvdisplay /dev/vg00/xyy

lvdisplay: "/dev/vg00/xyy": No such file or directory                                  

//发现已经不存在了  
 1、--创建3T的LV，名字:lv\_data2  
lvcreate -L 3000000  -n lv\_data2 /dev/vgbak

2、--创建文件系统  
newfs -F vxfs  /dev/vgbak/rlv\_data2

3、--创建挂载点  
mkdir /data2

4、--将文件系统挂载到LV上  
mount   /dev/vgbak/lv\_data2    /data2

5、--设置开机自动挂载  
vi /etc/fstab

6、--在最下面添加如下：  
/dev/vgbak/lv\_data2   /data2   vxfs   delaylog   0   2