VxVM-Cheat-Sheet-EMC |
Written by Administrator |
Friday, 03 October 2008 14:17 |
Veritas Volume Manager Cheat Sheet:The Setup: an Oracle database supporting an application called ABC, and given the following: Assuming that we need to create filesystems intended for Oracle and: we are using a SID of 'ABC' we have nine disks, c0t0d1 through c0t0d9 we will be creating six volumes: /u01/oradata/ABC ( 4gb ), /u02/oradata/ABC (4gb ), /u03/oradata/ABC (8gb ), /u04/oradata/ABC ( 4gb ), /u01/app/oracle/product/8.0.5_ABC ( 4gb ), and /u01/admin/ABC ( 4gb ). We added these disks to Volume Manager Control during installation with vxinstall, or later with vxdiskadd(1m). Both vxinstall and vxdiskadd can add either initialize a previously unused disk, or 'encapsulate' a disk already containing data, but not under Volume Manager control. we could take the following steps to set up our filesystems. Adding an EMC disk to VeritasUse the inq utility to see if you have SCSI visibility to the disk Use vxdisk -o alldgs list to see if Veritas has seen the disk if not, try the following, and then repeat the previous step: devfsadm vxdctl initdmp vxdctl enable
Creating a Disk Group in Volume Manager:Create a vxvm disk group for the Oracle SID using vxdg(1m). It's important that all of the disks/filesystems necessary for the ABC database to run are included in the disk group, otherwise the database could not be moved to another system. The easiest way to do this is to use vxdiskadd Doing it the hard way: This would create a disk group called ABCdg containing one physical disk, c0t0d1, which will be referred to by it's name within vxvm, ABCdg01. You cannot initiate a disk group without specifying at least one disk as a member of the group. You should not include any disks destined to be part of an Oracle Database in the default vxvm group, rootdg. This allows you to use the vxdg 'deport' and 'import' commands to migrate an entire vxvm disk group to another host. Now that we've create the disk group for our database, we can add the rest of our disks to it: vxdg -g ABCdg adddisk ABCdg02=c0t0d2 vxdg -g ABCdg adddisk ABCdg09=c0t0d9
Creating Volumes With vxassistvxassist(1m) is a vxvm command that acts as a front-end to other vxvm commands, much as newfs(1m) acts as a simpler-to-use front-end to mkfs(1m). Using vxassist with it's -v flag will display the actual vxvm commands used during volume construction. vxassist also front-ends vxfs commands and normal UNIX utilities during volume construction. An example of this is using a single vxassist command to set up a volume. Using vxassist simplifies many vxvm tasks, but you should pay careful attention to the defaults you will inherit when setting up volumes using this tool. Understanding the contents of the /etc/default/vxassist file is important, especially when striping disks. To make our 8gb /u03/oradata/ABC volume, we could use the following command line: vxassist -g ABCdg make ABC01 8g Breaking it down into it's component parts: vxassist -g ABCdg # this volume will belong to the ABCdg disk group make # tells vxassist that we are creating a new volume ABC01 # name the volume 8g # specify the size of the volume Here we create the other five volumes: vxassist -g ABCdg make ABC02 8g vxassist -g ABCdg make ABC03 8g vxassist -g ABCdg make ABC04 8g vxassist -g ABCdg make ABC05 8g vxassist -g ABCdg make ABC06 8g
Creating a File System:We now lay filesystems down on our newly created volumes. We assume here that you've agreed with the Oracle DBA's to use a block size of 8192 for our filesystems. Not specifying a block size allow Veritas to dynamically assign one for you based upon the size of the volume. Our volumes would default to 1024 for a block size on our 4 GB volumes, and 2048 for our 8GB volume. We will specify the largefiles option, because the mkfs_vxfs(1m) command uses nolargefiles as a default, unlike mkfs_ufs(1m) on Solaris 2.6 or greater, which uses largefiles as a default. If we forgot to do so, we could use fsadm ( fsadm_vxfs(1m) ) to set the largefiles bit on. fsadm can also query a mounted filesystem for the current setting of this flag. Be certain that whatever flags you set during file system creation or modification are reflect in vfstab, or the resulting file system may be un-mount-able. mkfs -F vxfs -o bsize=8192,largefiles /dev/vx/rdsk/ABCdg/ABC01
Mounting a File System:Creating and mounting filesystems go hand in hand. You must be certain that any special flags set at creation time are reflected in /etc/vfstab, or on the command line if there is no entry in vfstab for your filesystem. mount -F vxfs -o largefiles /dev/vx/dsk/ABCdg/ABC01 /u03/oradata/ABC
Resizing a mounted volume and file system:/etc/vx/bin/vxresize -g rootdg -F vxfs archive 16g
Recovering disks under VM control:(if you want to live dangerously, try looking at dfwset01:/root/progs/hose_vx_dg.pl) Pre-reqs
Procedure 2) umount the volume 3) stop it: 4) remove it: 5) remove the disk(s) the volume was on from the disk group ( up to the last disk ) 6) Remove the the disk(s) from VXVM control 7) If you wish do get rid of the disk group ( in order to recover the last disk ), you must destroy the disk group: 8) remove the last disk 9) If you're removing the disks from the EMC port, be sure to clean up:
10) Freak out and realize you whacked the wrong thing, use /root/eotw to recover.
Renaming a VM Disk:Since names like "ABCdg10" are not as descriptive as they could be, you can rename it to something more useful. vxedit rename ABCdg10 ABCdg_hot_spare Using long disk names can be more descriptive, but will make using vxva trickier, as it will truncate your disk name somewhat if it is too long.
Moving a Disk Group to Another System:1) umount the disks: umount /u01/app/oracle/product/8.0.5_ABC umount /u01/admin/ABC umount /u01/oradata/ABC umount /u02/oradata/ABC umount /u03/oradata/ABC umount /u04/oradata/ABC 2) Stop the volumes: vxvol -g ABCdg stopall 3) deport the disk group from one system: vxdg deport ABCdg 4) import them on another system: vxdg import ABCdg 5) Start all of the volumes on the new system and resync mirrors in the background: vxrecover -g ABCdg -sb 6) mount the filesystems mount /u01/app/oracle/product/8.0.5_ABC mount /u01/admin/ABC mount /u01/oradata/ABC mount /u02/oradata/ABC mount /u03/oradata/ABC mount /u04/oradata/ABC This
procedure assumes that the second system can see the disks, and also
that you have commented the file systems out of vfstab on the old
system. Rename a Disk Group /root dfwns19 # umount /u01/app/oracle/admin/REPORTS dfwns19 # vxvol -g reportsdg stopall dfwns19 # vxdg deport reportsdg dfwns19 # vxdg -n nclproddg import reportsdg dfwns19 # vxdg list Mirroring and then breaking mirrors# make an sd from your dm ( use the -g, or it won't work. The book is wrong ) NAME STATE ID nclproddg enabled 949356971.2501.dfwns19 Renaming a disk group and volumebansecdbdg -> secproddg used as an example # Unmount all volumes in the bansecdbdg disk group. Resizing a disk, while specifying the disk# Resize volume u11, and only use disk dev20dg23 Moving a volume off of a particluar disk# Move u11 off of dm dev20dg20 |
Last Updated ( Friday, 03 October 2008 14:19 ) |