免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 50035 | 回复: 2

HP-UX LVM学习笔记 [复制链接]

论坛徽章:
0
发表于 2009-06-02 15:43 |显示全部楼层

系统环境:
  1)HP-UX 11.00
  2)Model: 9000/715/D
   此次笔记包含的内容为:LVM的建立,扩文件系统,缩小文件系统,移动LVM,删除VG
   一、建立LVM
   假设我们有两个硬盘:c0t3d0和c0t4d0,要建立vg02,里面包含这两个硬盘,可以操作如下:
   1.生成PV信息
       #pvcreate -f /dev/rdsk/c0t3d0
       #pvcreate -f /dev/rdsk/c0t4d0
       说明:如果此硬盘包含了其它LVM的信息,此操作可能会报错,此时,可以将硬盘盘头的相关信息去掉,命令如下:
           #dd if=/dev/zero of=/dev/rdsk/c0t3d0 bs=1024 count=1024
       然后再重新用以上命令创建PV信息。
   2. #mkdir /dev/vg02
   3. #mknod /dev/vg02/group c 64 0x020000
       说明:这条命令是用来建立设备文件,其中c表明建立的是字符设备,64代表的是设备驱动号,这两项都是不可改变的。0x020000的格式是,总是0x开头,02对应的是vg02——其实也可以不对应,只是为了以后方便,大部分时候,我们都是做成对应的,最后接0000。
   4. #vgcreate /dev/vg02 /dev/dsk/c0t3d0 /dev/dsk/c0t4d0
       说明:这条命令的含义是,创建VG02,并将c0t3d0和c0t4d0这两个硬盘包含在内,当然,也可以先包含一个硬盘,以后需要的时候再扩第二个硬盘,操作如下:
           #vgcreate /dev/vg02 /dev/dsk/c0t3d0
           #vgextend /dev/vg02 /dev/dsk/c0t4d0(此命令就是将第二个硬盘扩到VG02当中)
   5. lvcreate -L 100 vg02
       说明:建立了VG信息以后(也就是卷组信息),就可以用lvcreate命令来创建逻辑卷了。这条命令的含义是,建立一个大小为100M,包含在卷组vg02中的逻辑卷。并且,默认的名字是lvol1。第二次用这条命令,默认产生的名称是lvol2,以此类推。
       当然,我们有时候为了工作的方便,也可以自己给创建的逻辑卷命名,例子如下:
           #lvcreate -L 100 n my_lvol1 vg02
       这样,我们就用n参数来定义了逻辑卷的名称。如果我们不用-L参数来指定逻辑卷的大小,默认产生的大小就是0M,这有的时候会给我们的工作带来方便,比如做Mirror的时候,先指定逻辑卷的大小为0,这样做同步的速度就会很快,同步以后再来扩大逻辑卷。至于怎么扩,后面咱们会讲到。
   6. newfs -F vxfs -o largefiles /dev/vg02/rlvol1
       说明:-F参数指定文件系统类型,这里的vxfs文件系统其实就是我们常说的JFS文件系统,-o用来指定文件系统支持大格式文 件,即支持单个文件大于2G的文件系统,否则,将来随着文件——特别是数据库文件——的增大,很可能会出现问题。而且,如果数据库文件采用裸文件的话,就不要进行这一步操作!
   7. mkdir /vg02_lvol1
   8. mount /dev/vg02/lvol1 /vg02_lvol1
   9. vgcfgbackup vg02
       说明:这条命令产生的备份文件会存放在/etc/lvmconf/vg02.conf文件中。同理,vgcfgbackup
vg**产生的备份文件就是存放在/etc/lvmconf/vg**.conf文件中。(好像是用strings命令,而不是用more命令来查看此文件)
   二、扩展文件系统
   扩展文件系统的目的,是为了扩大某个文件系统的可用空间。一般的,当某个文件系统的使用率超过了90%的时候,我们就应该予以格外的关注,因为使用率继续降低,将可能大大降低系统性能。此时,我们就以通过删除一些临时文件来增大可用空间,当然,也可以用下面将要讲到的扩大文件系统的方法。
   我们仍然跟着上面的例子,比如上面我们在vg02中创建了100M的lvol1文件系统,现在我们来将其扩大到200M:
   1. #lvextend -L 200 /dev/vg02/lvol1
   2. #umount /dev/vg02/lvol1
   3. #extendfs -F vxfs /dev/vg01/lvol2
       说明,用了第一步的逻辑卷扩大以后,一定要记得使用这个扩大文件系统的操作,否则,将来系统是用sam来查看到的文件系统大小,和用bdf命令查看出来的大小,就会不一样,并且,其实扩大的那部分空间,其实是还不能使用的!
   4. #mount -a
       说明:做extendfs之前已经umount了,因此扩了文件系统以后,要记得重新mount上去
   5. #vgcfgbackup vg02
       说明,因为我们对文件系统进行了改动,因此不要忘记备份相关信息文件。
   三、缩小文件系统(慎用!)
   一般不建议缩小文件系统,因为这很可能造成一些文件和数据的丢失,如果非要进行此操作,请先考虑如下方案:
   a. 到HP购买onlie-JFS软件
   b. 操作前先进行备份
   我们仍然用之前扩大的lvol1来作为例子讲解。按照如下步骤进行操作:
   1. #fbackup -f /dev/rmt/0m -0vHi /vg02_lvol1
       说明:这是先对此文件系统进行备份
   2. #umount /dev/vg02/lvol1
   3. #lvreduce -L 100 /dev/vg02/lvol1
   4. #newfs -F vxfs -o largefiles /dev/vg02/rlvol1
       说明:就是这个操作,让此文件系统上的文件全部丢失,因此,一定要做好备份的动作!
   5. #mount -a
   6. #frecover -f /dev/rmt/0m
       说明:这个恢复的操作可能会失败,原因在于如果将文件系统缩得太小,之前备份的文件大小可能要大于它。因此,在缩小文件系统之前 ,仔细用bdf命令看看。
   7. #vgcfgbackup vg02
   四、移动逻辑卷(LV)
   这类操作实际上很少用到,而且建立LV的时候,需要时连续的块空间,操作才会成功。下面我们已加入一个新硬盘c0t5d0为例子,将lvol1从c0t3d0上移过去。操作如下:
   1. #pvcreate -f /dev/rdsk/c0t5d0
   2. #vgextend /dev/vg02 /dev/dsk/c0t5d0
   3. #pvmove -n /dev/vg02/lvol1 /dev/dsk/c0t3d0 /dev/dsk/c0t5d0
   4. #vgcfgbackup vg02
   五、移除VG
   有的时候我们不需要某个卷组了,就可以将其移除。下面我们以移除vg02为例子,操作如下:
   1. 当然是将其中的信息和文件进行必要的备份了,至于是用fbackup、cpio还是tar命令,就看自己的选择了
   2. 确定此VG中包含多少个LV
       #lvdisplay /dev/vg02/lvol*
       说明:同样的,我们看vg**中包含多少个lv,还可以用lvdisplay
/dev/vg**/lvol*来确定。更可靠的,为了防止用户自己定义了名字,可以用lvdisplay /dev/vg**/*来查看。
   3. umount要移除的VG下的LV
       #cd /
       #umount /dev/vg02/lvol1
       说明:因为上面的例子中,我们只创建了lvol1,否则,要一个个都umount。有的时候,这条命令不起作用,我们可以用fuser
-ku /dev/vg**/lvol*下所存在的进程kill掉,然后重新umount就行了。
   4. 移除LV
       #lvremove /dev/vg02/lvol1
       说明:同理,如果存在多个LV,要一个个移除掉。
   5. 查看/etc/lvmtab文件,确定此要移除的VG中只包含一个PV了
       #strings /etc/lvmtab
       说明:此文件是用strings命令查看,如果PV有多个,就要一个个移除,剩下最后一个作为VG的载体
   6. 移除多余的PV
       #vgreduce /dev/vg02 /dev/dsk/c0t5d0
       #vgreduce /dev/vg02 /dev/dsk/c0t4d0
       说明:在上面的例子中,我们在vg02中加入了c0t3d0,c0t4d0和c0t5d0三个硬盘,因此,这时候要移除多余的,剩下最后一个作为VG的载体??
   7. 移除VG
       #vgremove /dev/vg02


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/97963/showart_1952560.html

论坛徽章:
0
发表于 2012-11-01 09:56 |显示全部楼层
对我很有帮助啊,分享了

论坛徽章:
0
发表于 2014-03-30 17:17 |显示全部楼层
本帖最后由 fulerul 于 2014-03-30 17:18 编辑

new dump,www.eliteguides.cn,HP0-J66 - HP Storage Migration
new dump,www.eliteguides.cn,HP0-J67 - Architecting Multi-site HP Storage Solutions
new dump,www.eliteguides.cn,HP0-J70 - Implementing HP 3PAR StoreServ Solutions
new dump,www.eliteguides.cn,HP0-J71 - Implementing HP Converged Storage Solutions
new dump,www.eliteguides.cn,HP0-J72 - Implementing HP SAN Solutions
new dump,www.eliteguides.cn,HP0-J73 - Foundations of HP Storage Solutions
new dump,www.eliteguides.cn,HP0-M33 - HP Operations Orchestration 9.x Software
new dump,www.eliteguides.cn,HP0-M34 - HP Server Automation 9.x Software
new dump,www.eliteguides.cn,HP0-M35 - Implementing HP TRIM 7.x Software
new dump,www.eliteguides.cn,HP0-M40 - HP Network Automation 9.x Software
new dump,www.eliteguides.cn,HP0-M43 - HP Service Manager 9.x Software
new dump,www.eliteguides.cn,HP0-M44 - HP SiteScope 11.x Software
new dump,www.eliteguides.cn,HP0-M45 - HP BSM Platform and End User Management 9.x Software
new dump,www.eliteguides.cn,HP0-M46 - HP Application Lifecycle Management 11.x Software
new dump,www.eliteguides.cn,HP0-M47 - HP Functional Testing 11.x Software
new dump,www.eliteguides.cn,HP0-M48 - HP LoadRunner 11.x Software
new dump,www.eliteguides.cn,HP0-M49 - HP Virtual User Generator 11.x Software
new dump,www.eliteguides.cn,HP0-M50 - HP BSM Operations Manager i 9.x Software
new dump,www.eliteguides.cn,HP0-M51 - HP BSM Network Node Manager i 9.x Software
new dump,www.eliteguides.cn,HP0-M52 - HP BSM Operations Manager on UNIX and Linux 9.x Software
new dump,www.eliteguides.cn,HP0-M53 - HP BSM Operations Manager on Windows 9.x Software
new dump,www.eliteguides.cn,HP0-M54 - ArcSight ESM Security Analyst
new dump,www.eliteguides.cn,HP0-M55 - ArcSight ESM Administrator
new dump,www.eliteguides.cn,HP0-M57 - HP Project and Portfolio Management Center 9.x Software
new dump,www.eliteguides.cn,HP0-M58 - HP Software Testing Foundation 11
new dump,www.eliteguides.cn,HP0-M59 - HP Asset Manager 9.x Software
new dump,www.eliteguides.cn,HP0-M60 - HP ITPS Executive Scorecard 9.x Software
new dump,www.eliteguides.cn,HP0-M61 - HP Storage Essentials 9.x Software
new dump,www.eliteguides.cn,HP0-M62 - HP Client Automation Enterprise 8.x Software
new dump,www.eliteguides.cn,HP0-M63 - HP Cloud Service Automation 3.x Software
new dump,www.eliteguides.cn,HP0-M64 - Technical Introduction to HP ArcSight Information Security Solutions
new dump,www.eliteguides.cn,HP0-M65 - Technical Introduction To HP Fortify Security
new dump,www.eliteguides.cn,HP0-M66 - HP Data Protector 7.x Software

100% guaranteed pass ,Once failed 100%refund
The Fastest and Guaranteed Way to CertifyNow
http://www.eliteguides.cn
certification,certify,certified,braindumps,braindump,dumps,exam,exams,studyguides,studyguide,test,tests,testing,training,free
,book,pdf,question,questions

new dump,www.eliteguides.cn,HP0-M68 - ArcSight ESM v6 Security Administrator
new dump,www.eliteguides.cn,HP0-M70 - HP Universal Discovery 10.x Software
new dump,www.eliteguides.cn,HP0-M71 - HP Universal CMDB 10.x Software
new dump,www.eliteguides.cn,HP0-P17 - HP-UX 11iv3 Security Administration
new dump,www.eliteguides.cn,HP0-P19 - HP-UX High Availability using Serviceguard v18
new dump,www.eliteguides.cn,HP0-P20 - HP-UX 11iv3 System Administration
new dump,www.eliteguides.cn,HP0-P21 - HP-UX 11iv3 Advanced System Administration
new dump,www.eliteguides.cn,HP0-P23 - Architecting HP Superdome 2 Server Solutions
new dump,www.eliteguides.cn,HP0-P24 - HP-UX 11iv3 System Administration
new dump,www.eliteguides.cn,HP0-P25 - HP-UX 11iv3 Advanced System Administration
new dump,www.eliteguides.cn,HP0-S27 - Implementing HP BladeSystem Solutions
new dump,www.eliteguides.cn,HP0-S30 - Design and Implementation of HP SIM and HP Insight Control
new dump,www.eliteguides.cn,HP0-S31 - Managing Windows and Linux Server Systems
new dump,www.eliteguides.cn,HP0-S32 - HP BladeSystem Networking
new dump,www.eliteguides.cn,HP0-S33 - Advanced Integration and Management of HP Server Solutions
new dump,www.eliteguides.cn,HP0-S34 - Implementing HP Rack and Tower Server Solutions
new dump,www.eliteguides.cn,HP0-S35 - Implementing HP BladeSystem Solutions
new dump,www.eliteguides.cn,HP0-S36 - Architecting HP Server Solutions
new dump,www.eliteguides.cn,HP0-S39 - BladeSystem Networking
new dump,www.eliteguides.cn,HP0-Y27 - Deploying HP Enterprise Wireless Networks
new dump,www.eliteguides.cn,HP0-Y30 - Implementing HP Networking Technologies
new dump,www.eliteguides.cn,HP0-Y32 - Designing & Troubleshooting Open Standards Networks
new dump,www.eliteguides.cn,HP0-Y36 - Deploying HP Enterprise Networks
new dump,www.eliteguides.cn,HP0-Y37 - Migrating and Troubleshooting HP Enterprise Networks
new dump,www.eliteguides.cn,HP0-Y43 - Implementing HP Network Infrastructure Solutions
new dump,www.eliteguides.cn,HP0-Y44 - Implementing and Troubleshooting HP Wireless Networks
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP