ITPub博客

首页 > Linux操作系统 > Linux操作系统 > HPUX/LINUX/AIX下VG操作

HPUX/LINUX/AIX下VG操作

原创 Linux操作系统 作者:bluesshadow 时间:2012-11-05 15:46:48 0 删除 编辑
Normal 0 7.8 磅 0 2 false false false EN-US ZH-CN X-NONEHPUX/LINUX/AIXVG操作


 

HP UX

将存储磁盘映射到HP UX主机

使用ioscan命令扫描新增加的磁盘:

#ioscan -fnCdisk

如果是多路径的放,使用以下命令查看磁盘名与物理路径对应关系

#ioscan -m dsf

确定新建VG的磁盘:

VG(建议使用聚合后盘符,不要使用物理路径)

1. pv

pvcreate /dev/rdsk/disk314

或者

nodeA#[/]pvcreate /dev/rdisk/disk314

Physical volume "/dev/rdisk/disk314" has been successfully created.

nodeA#[/]pvcreate /dev/rdisk/disk315

Physical volume "/dev/rdisk/disk315" has been successfully created.

nodeA#[/]pvcreate /dev/rdisk/disk316

Physical volume "/dev/rdisk/disk316" has been successfully created.

nodeA#[/]pvcreate /dev/rdisk/disk317

Physical volume "/dev/rdisk/disk317" has been successfully created.

nodeA#[/]pvcreate /dev/rdisk/disk318

Physical volume "/dev/rdisk/disk318" has been successfully created.

2.vg

nodeA#[/]mkdir /dev/vgdata

nodeA#[/]mknod /dev/vgdata/group c 64 0x020000

nodeA#[/]mknod /dev/vgdata/group c 64 0x020000

nodeA#[/]vgcreate -s 32 /dev/vgdata /dev/disk/disk314 /dev/disk/disk315 /dev/disk/disk316 /dev/disk/disk317 /dev/disk/disk318

Increased the number of physical extents per physical volume to 6400.

Volume group "/dev/vgdata" has been successfully created.

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

3.lv

lv指定的空间大于VG所有空间时会报错,例如:

nodeA#[/]lvcreate -L 1048500 -i 5 -I 1024 -n lvdata1  /dev/vgdata

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

Warning: rounding up logical volume size to extent boundary at size "1048640" MB for striping.

Logical volume "/dev/vgdata/lvdata1" has been successfully created with

character device "/dev/vgdata/rlvdata1".

lvcreate: Not enough free physical extents available.

Logical volume "/dev/vgdata/lvdata1" could not be extended.

Run the "lvextend" command to create space on the Logical Volume.

删除:

nodeA#[/]lvremove /dev/vgdata/lvdata1

Logical volume "/dev/vgdata/lvdata1" has been successfully removed.

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

减少lv的空间,重新建立:

nodeA#[/]lvcreate -L 1000000 -i 5 -I 1024 -n lvdata1  /dev/vgdata

Logical volume "/dev/vgdata/lvdata1" has been successfully created with

character device "/dev/vgdata/rlvdata1".

Logical volume "/dev/vgdata/lvdata1" has been successfully extended.

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

 

4.建文件系统,格式化

nodeA#[/]newfs -F vxfs -o largefiles /dev/vgdata/rlvdata1

    version 6 layout

    1024000000 sectors, 1024000000 blocks of size 1024, log size 16384 blocks

    largefiles supported

5.mount文件系统

 

nodeA#[/]mkdir /appdata1

nodeA#[/]mount /dev/vgdata/lvdata1 /appdata1

 

nodeA#[/]bdf

Filesystem          kbytes    used   avail %used Mounted on

/dev/vg00/lvol3    1048576  327808  715200   31% /

/dev/vg00/lvol1    1048576  307168  735696   29% /stand

/dev/vg00/lvol8    8388608 1172536 7159976   14% /var

/dev/vg00/lvol7    8388608 6943256 1434248   83% /usr

/dev/vg00/lvol6    2097152 1153240  936792   55% /tmp

/dev/vg00/lv_ora   12582912 10942475 1555179   88% /oracle

/dev/vg00/lvol5    8388608 5200968 3162784   62% /opt

/dev/vg00/lvol4    1048576  109560  931744   11% /home

/dev/vgdata/lvdata1

                   1024000000  268065 959748697    0% /appdata1

 

 

扩展空间:

 

使用ioscan命令扫描新增加的磁盘:

ioscan -fnCdisk

 

查看磁盘名与物理路径对应关系

ioscan -m dsf

 

确定需要扩展到VG的磁盘:

1.新建pv

nodeA#[/]pvcreate /dev/rdsk/disk319

Physical volume "/dev/rdsk/disk319" has been successfully created.

nodeA#[/]pvcreate /dev/rdsk/disk320

Physical volume "/dev/rdsk/disk320" has been successfully created.

nodeA#[/]pvcreate /dev/rdsk/disk321

Physical volume "/dev/rdsk/disk321" has been successfully created.

nodeA#[/]pvcreate /dev/rdsk/disk322

Physical volume "/dev/rdsk/disk322" has been successfully created.

nodeA#[/]pvcreate /dev/rdsk/disk323

Physical volume "/dev/rdsk/disk323" has been successfully created.

 

2.pv加入到vg

nodeA#[/]vgextend vgdata /dev/dsk/disk319

Volume group "vgdata" has been successfully extended.

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

 

查看是否正确加入到lvmtab表里

nodeA#[/]strings /etc/lvmtab

/dev/vg00

/dev/disk/disk3_p2

/dev/disk/disk5_p2

/dev/vgdata

/dev/disk/disk314

/dev/disk/disk315

/dev/disk/disk316

/dev/disk/disk317

/dev/disk/disk318

/dev/dsk/disk319

 

nodeA#[/]vgextend vgdata /dev/dsk/disk320

vgextend vgdata /dev/dsk/disk321

vgextend vgdata /dev/dsk/disk322

vgextend vgdata /dev/dsk/disk323Volume group "vgdata" has been successfully extended.

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

nodeA#[/]vgextend vgdata /dev/dsk/disk321

Volume group "vgdata" has been successfully extended.

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

nodeA#[/]vgextend vgdata /dev/dsk/disk322

Volume group "vgdata" has been successfully extended.

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

nodeA#[/]vgextend vgdata /dev/dsk/disk323

Volume group "vgdata" has been successfully extended.

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

nodeA#[/]strings /etc/lvmtab              

/dev/vg00

/dev/disk/disk3_p2

/dev/disk/disk5_p2

/dev/vgdata

/dev/disk/disk314

/dev/disk/disk315

/dev/disk/disk316

/dev/disk/disk317

/dev/disk/disk318

/dev/dsk/disk319

/dev/dsk/disk320

/dev/dsk/disk321

/dev/dsk/disk322

/dev/dsk/disk323

 

3.扩展lv

nodeA#[/]bdf

Filesystem          kbytes    used   avail %used Mounted on

/dev/vg00/lvol3    1048576  327808  715200   31% /

/dev/vg00/lvol1    1048576  307168  735696   29% /stand

/dev/vg00/lvol8    8388608 1172536 7159976   14% /var

/dev/vg00/lvol7    8388608 6943256 1434248   83% /usr

/dev/vg00/lvol6    2097152 1153240  936792   55% /tmp

/dev/vg00/lv_ora   12582912 10942475 1555179   88% /oracle

/dev/vg00/lvol5    8388608 5200968 3162784   62% /opt

/dev/vg00/lvol4    1048576  109560  931744   11% /home

/dev/vgdata/lvdata1

                   1024000000  268065 959748697    0% /appdata1

 

nodeA#[/]umount /appdata1

nodeA#[/]bdf

Filesystem          kbytes    used   avail %used Mounted on

/dev/vg00/lvol3    1048576  327808  715200   31% /

/dev/vg00/lvol1    1048576  307168  735696   29% /stand

/dev/vg00/lvol8    8388608 1172536 7159976   14% /var

/dev/vg00/lvol7    8388608 6943256 1434248   83% /usr

/dev/vg00/lvol6    2097152 1153240  936792   55% /tmp

/dev/vg00/lv_ora   12582912 10942475 1555179   88% /oracle

/dev/vg00/lvol5    8388608 5200968 3162784   62% /opt

/dev/vg00/lvol4    1048576  109560  931744   11% /home

 

 

原来lv大小为1T,现在扩展到2T

nodeA#[/]lvextend -L 2000000 /dev/vgdata/lvdata1

Logical volume "/dev/vgdata/lvdata1" has been successfully extended.

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

nodeA#[/]extendfs /dev/vgdata/rlvdata1

nodeA#[/]mount /dev/vgdata/rlvdata1 /appdata1

 

查看:

nodeA#[/]bdf

Filesystem          kbytes    used   avail %used Mounted on

/dev/vg00/lvol3    1048576  327808  715200   31% /

/dev/vg00/lvol1    1048576  307168  735696   29% /stand

/dev/vg00/lvol8    8388608 1172536 7159976   14% /var

/dev/vg00/lvol7    8388608 6943256 1434248   83% /usr

/dev/vg00/lvol6    2097152 1153240  936792   55% /tmp

/dev/vg00/lv_ora   12582912 10942475 1555179   88% /oracle

/dev/vg00/lvol5    8388608 5200968 3162784   62% /opt

/dev/vg00/lvol4    1048576  109560  931744   11% /home

/dev/vgdata/lvdata1

                   2000000000  268065 959748697    0% /appdata1

 

Linux

 

 

使用HDS命令扫描新增加的磁盘:

fdisk -l

查看磁盘名与物理路径对应关系

/opt/DynamiclinkManager/bin/dlnkmgr view -lu

确定需要扩展到VG的磁盘

1.建立pv

[root@nodeA /]# pvcreate /dev/sddlmaa

  Physical volume "/dev/sddlmaa" successfully created

[root@nodeA /]# pvcreate /dev/sddlmab

  Physical volume "/dev/sddlmab" successfully created

查看pv

[root@nodeA /]# pvscan

  PV /dev/sda2      VG VolGroup00   lvm2 [135.84 GB / 0    free]

  PV /dev/sddlmaa                   lvm2 [200.00 GB]

  PV /dev/sddlmab                   lvm2 [200.00 GB]

  Total: 3 [535.85 GB] / in use: 1 [135.84 GB] / in no VG: 2 [400.00 GB]

 

2.建立vg

[root@nodeA /]# vgdisplay

  --- Volume group ---

  VG Name               VolGroup00

  System ID            

  Format                lvm2

  Metadata Areas        1

  Metadata Sequence No  3

  VG Access             read/write

  VG Status             resizable

  MAX LV                0

  Cur LV                2

  Open LV               2

  Max PV                0

  Cur PV                1

  Act PV                1

  VG Size               135.84 GB

  PE Size               32.00 MB

  Total PE              4347

  Alloc PE / Size       4347 / 135.84 GB

  Free  PE / Size       0 / 0  

  VG UUID               pAzEmt-m3Fh-NdoE-pqWM-Q12W-Y40h-Y0gdzt

 

[root@nodeA /]# vgcreate vgdata /dev/sddlmaa /dev/sddlmab

  Volume group "vgdata" successfully created

4.建立lv

[root@nodeA /]# lvcreate -L 400000  -i 2 -I 1024 -n lvdata1  /dev/vgdata

  Logical volume "lvdata1" created

 

5.格式化文件系统

[root@nodeA /]# mkfs.ext3 /dev/vgdata/lvdata1

mke2fs 1.39 (29-May-2006)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

51200000 inodes, 102400000 blocks

5120000 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=4294967296

3125 block groups

32768 blocks per group, 32768 fragments per group

16384 inodes per group

Superblock backups stored on blocks:

        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,

        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968

 

Writing inode tables: done                           

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done

 

This filesystem will be automatically checked every 38 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.

 

6.挂载文件系统

mkdir /zhdata1

mount /dev/vgdata/lvdata1 /appdata1

 

AIX

AIX下多用smitty(略)

 

VG导入导出

1.导出VG信息,并生成TXT文件方便查看

vgexport -p -v -s -m vgdata.map -f vgdata.txt vgdata

注:VG信息导入后之前建立的LV或者祼设备权限会重置为root权限,如果有数据库等其它应用时应该在备份VG信息前将权限信息导出备份。

 

2.删除VG信息

停用VG:

#vgchange -a n vgdata

从逻辑卷列表中删除VG信息:

#vgexport vgdata

查看:

#strings /etc/lvmtab

 

3.导入VG信息:

#vgimport -v -s -m vgdata.map vgdata

Beginning the import process on Volume Group "vgdata".

Logical volume "/dev/vgdata/lvdata1_1g" has been successfully created

with lv number 1.

Logical volume "/dev/vgdata/lvdata2_1g" has been successfully created

with lv number 2.

Logical volume "/dev/vgdata/lvdata3_1g" has been successfully created

with lv number 3.

......

 

激活VG:

#vgchange -a y vgdata

 

停用VG

#vgchange -a n vgdata

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24668589/viewspace-748370/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2010-09-27

  • 博文量
    34
  • 访问量
    139708