Chinaunix首页 | 论坛 | 博客
  • 博客访问: 357836
  • 博文数量: 34
  • 博客积分: 2236
  • 博客等级: 大尉
  • 技术积分: 476
  • 用 户 组: 普通用户
  • 注册时间: 2006-02-25 14:36
文章分类

全部博文(34)

文章存档

2016年(2)

2014年(1)

2012年(2)

2011年(3)

2010年(3)

2009年(5)

2008年(9)

2007年(3)

2006年(6)

分类:

2008-08-20 13:55:44

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*  
[~]# strings /etc/lvmtab
/dev/vg00
/dev/dsk/c1t6d0
/dev/dsk/c2t6d0
[~]# 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
[~]# 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
阅读(1690) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~