hp-ux的lvm使用

lvm的使用
a 建立
1 pvcreate -f /dev/rdsk/c2t6d0 生成PV信息
2 mkdir /dev/vg01
3 mknod /dev/vg01/group c 64 0x010000 建立设备文件
4 vgcreate /dev/vg01 /dev/dsk/c2t6d0 创建卷组VG
5 lvcreate -L 17360 vg01 创建逻辑卷lv (18G硬盘)
6 newfs -F vxfs -o largefiles /dev/vg01/rlvol1
7 mkdir /w ; mount /dev/vg01/lvol1 /w
b 删除VG
1 lvdisplay /dev/vg01/lvol* 确定此VG中包含多少个LV
2 umount /w umount要移除的VG下的LV
3 lvremove /dev/vg01/lvol1 /dev/dsk/c2t6d0 删除LV
4 strings /etc/lvmtab 确定要移除的VG中只包含一个PV
5 vgreduce /dev/vg01 /dev/dsk/c2t6d0 删除多余的PV,vg中加入了c0t3d0,c0t4d0和c0t5d0三个硬盘,
这时候要移除多余的,剩下最后一个c0t3d0作为VG的载体。
6 vgremove /dev/vg01 删除VG
4 strings /etc/lvmtab;ll /dev/vg01
c 扩展文件系统
1 bdf
2 lvextend -L 17360 /dev/vg02/lvol1 扩大逻辑卷到17360M
3 umount /dev/vg02/lvol1
4 extendfs -F vxfs /dev/vg01/lvol2 扩大文件系统
5 mount /dev/vg01/lvol1 /w;bdf

d 移动逻辑卷lv(在不同硬盘)
这类操作很少用,在建立LV的时候,需要时连续的块空间,操作才会成功。
下面我们已加入一个新硬盘c2t6d0为例子,将lvol1从c2t6d0上移过去。操作如下:
1. #strings /etc/lvmconf/vg00.conf;pvcreate -f /dev/dsk/c2t6d0
2. #vgextend /dev/vg00 /dev/dsk/c2t6d0
3. #pvmove -n /dev/vg00/lvol1 /dev/dsk/c1t6d0 /dev/dsk/c2t6d0
4. #vgcfgbackup vg00;strings /etc/lvmconf/vg00.conf
??如何确认/dev/vg00/lvol1在/dev/dsk/c2t6d0上?
sam--disk&vg--lv--lvol1--Actions-View More Information
pvdisplay /dev/dsk/c1t6d0
e 缩小文件系统,文件和数据的要丢失
一般不建议缩小文件系统,因为这很可能造成一些文件和数据的丢失,如果非要进行此操作,请先考虑如下方案:
a). 到HP购买onlie-JFS软件
b). 操作前先进行备份
我们仍然用之前扩大的lvol1来作为例子讲解。按照如下步骤进行操作:
1. #fbackup -f /dev/rmt/0m -0vHi /vg01_lvol1
说明:这是先对此文件系统进行备份
2. #umount /dev/vg01/lvol1
3. # lvreduce -L 1700 /dev/vg01/lvol1 缩小到1700M
4. #newfs -F vxfs -o largefiles /dev/vg01/rlvol1
说明:就是这个操作,让此文件系统上的文件全部丢失,因此,一定要做好备份的动作!
5. #mount -a
6. #frecover -f /dev/rmt/0m
说明:这个恢复的操作可能会失败,原因在于如果将文件系统缩得太小,之前备份的文件大小可能要大于它。因此,在缩小文件系统之前 ,仔细用bdf命令看看。
7. #vgcfgbackup vg01
lvdisplay /dev/vg00/lvol*
--- Physical volumes ---
PV Name /dev/dsk/c1t6d0
PV Status available
Total PE 4340
Free PE 445
Autoswitch On
PV Name /dev/dsk/c2t6d0
PV Status available
Total PE 4340
Free PE 4340
Autoswitch On
lvremove /dev/vg00/rlvol8 /dev/dsk/c2t6d0
lvdisplay /dev/vg00/lvol*
[email=root@app]root@app[/email]
[~]# strings /etc/lvmtab
/dev/vg00
/dev/dsk/c1t6d0
/dev/dsk/c2t6d0
[email=root@app]root@app[/email]
[~]# vgreduce /dev/vg00 /dev/dsk/c2t6d0
Volume group "/dev/vg00" has been successfully reduced.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
[email=root@app]root@app[/email]
[~]# strings /etc/lvmtab
/dev/vg00
/dev/dsk/c1t6d0
strings /etc/lvmtab
vgreduce /dev/vg00 /dev/dsk/c2t6d0
strings /etc/lvmtab
整盘形式利用
newfs -F vxfs -o largefiles /dev/rdsk/c2t6d0
mount /dev/dsk/c2t6d0 /w
/dev/vg00/lvol7
# vgdisplay -v vg00
PV Name /dev/dsk/c1t0d0s2
PV Name /dev/dsk/c1t1d0
# lvcreate -L 8 -n mylv00 vg00[@more@] hp-ux的lvm使用

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

转载于:http://blog.itpub.net/12801008/viewspace-1023685/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值