{"id":42,"date":"2009-06-09T11:58:52","date_gmt":"2009-06-09T16:58:52","guid":{"rendered":"http:\/\/www.hpux.ws\/?p=42"},"modified":"2009-06-09T11:59:58","modified_gmt":"2009-06-09T16:59:58","slug":"system-mirroring-scrip","status":"publish","type":"post","link":"http:\/\/www.hpux.ws\/?p=42","title":{"rendered":"System mirroring script"},"content":{"rendered":"<p>This was taken off of itrc forums. It may need some adjustment.<\/p>\n<p>#!\/bin\/ksh<\/p>\n<p>PARTITION_FILE=\/var\/tmp\/partition_file<\/p>\n<p># define primary and mirror disks<\/p>\n<p># the format is:<br \/>\n# PRI_DISK=cXtXdX<br \/>\n# PRI_DISK=cXtXdX<\/p>\n<p>PRI_DISK=c2t1d0<br \/>\nMIR_DISK=c3t0d0<\/p>\n<p>echo<br \/>\necho &#8220;PRIMARY DISK = \/dev\/dsk\/$PRI_DISK&#8221;<br \/>\necho &#8220;MIRROR\u00a0 DISK = \/dev\/dsk\/$MIR_DISK&#8221;<br \/>\necho<br \/>\necho If the above is correct, hit enter to continue echo If not correct, hit control-C to quit echo<\/p>\n<p>echo<br \/>\necho &#8220;Creating partition file \/tmp\/$PARTITION_FILE&#8221;<br \/>\necho<\/p>\n<p>cat &lt;&lt;EOF &gt; $PARTITION_FILE<br \/>\n3<br \/>\nEFI 500MB<br \/>\nHPUX 100%<br \/>\nHPSP 400MB<br \/>\nEOF<\/p>\n<p># create system, OS and\u00a0 service partitions<\/p>\n<p>echo<br \/>\necho idisk -wf $PARTITION_FILE \/dev\/rdsk\/$MIR_DISK echo<\/p>\n<p>idisk -wf $PARTITION_FILE \/dev\/rdsk\/$MIR_DISK<\/p>\n<p># Create device files needed for the new partitions<\/p>\n<p>insf -eC disk<\/p>\n<p># Verify the parition table<\/p>\n<p>echo idisk \/dev\/rdsk\/$MIR_DISK<br \/>\nidisk \/dev\/rdsk\/$MIR_DISK<\/p>\n<p># Initialize the EFI partition for use<\/p>\n<p>echo efi_fsinit -d \/dev\/rdsk\/${MIR_DISK}s1 efi_fsinit -d \/dev\/rdsk\/${MIR_DISK}s1<\/p>\n<p># Populate the \/efi\/hpux directory in the new EFI system partition<\/p>\n<p>echo mkboot -e -l \/dev\/rdsk\/$MIR_DISK<br \/>\nmkboot -e -l \/dev\/rdsk\/$MIR_DISK<\/p>\n<p># Changing the auto file for the mirror to boot without quorum # Note: Using s1<\/p>\n<p>echo &#8220;boot vmunix -lq&#8221;<br \/>\necho &#8220;boot vmunix -lq&#8221;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &gt; \/tmp\/AUTO.lq<br \/>\nefi_cp -d \/dev\/rdsk\/${MIR_DISK}s1\u00a0 \/tmp\/AUTO.lq\u00a0\u00a0 \/EFI\/HPUX\/AUTO<\/p>\n<p># Verify the contents of the auto file on the primary and the mirror.<br \/>\n# Note: Using s1<\/p>\n<p>echo\u00a0 Verify the contents of the auto file on the primary and the mirror.<br \/>\necho<br \/>\nefi_cp -d \/dev\/rdsk\/${PRI_DISK}s1 -u\u00a0 \/EFI\/HPUX\/AUTO\u00a0 \/tmp\/AUTO.pri efi_cp -d \/dev\/rdsk\/${MIR_DISK}s1 -u\u00a0 \/EFI\/HPUX\/AUTO\u00a0 \/tmp\/AUTO.alt<\/p>\n<p>echo cat \/tmp\/AUTO.pri<br \/>\necho<br \/>\ncat \/tmp\/AUTO.pri<\/p>\n<p>echo cat \/tmp\/AUTO.alt<br \/>\necho<br \/>\ncat \/tmp\/AUTO.alt<\/p>\n<p># add the new paritition to vg00<br \/>\n# Note: Using s2<\/p>\n<p>echo\u00a0 add the new paritition to vg00<br \/>\necho\u00a0 Note: Using s2<\/p>\n<p>echo pvcreate\u00a0 -B \/dev\/rdsk\/${MIR_DISK}s2<\/p>\n<p>pvcreate\u00a0 -B \/dev\/rdsk\/${MIR_DISK}s2<\/p>\n<p>#pvcreate\u00a0 -fB \/dev\/rdsk\/${MIR_DISK}s2<\/p>\n<p>vgextend vg00 \/dev\/dsk\/${MIR_DISK}s2<\/p>\n<p># Add the new disk to \/stand\/bootconf<br \/>\n# Note: Using s2<\/p>\n<p>echo\u00a0 &#8220;Add the mirror disk $MIR_DISK to \/stand\/bootconf&#8221;<br \/>\necho &#8220;l\u00a0 \/dev\/dsk\/${MIR_DISK}s2&#8221; &gt;&gt; \/stand\/bootconf<\/p>\n<p>echo\u00a0 Mirroring all Logical Volumes in \/dev\/vg00, lvol1 &#8211; lvol8 echo echo<\/p>\n<p>echo &#8220;Mirroring \/stand&#8221;<br \/>\necho lvextend -m 1 \/dev\/vg00\/lvol1\u00a0 \/dev\/dsk\/${MIR_DISK}s2<br \/>\nlvextend -m 1 \/dev\/vg00\/lvol1\u00a0 \/dev\/dsk\/${MIR_DISK}s2 echo<\/p>\n<p>echo &#8220;Mirroring swap&#8221;<br \/>\necho lvextend -m 1 \/dev\/vg00\/lvol2\u00a0 \/dev\/dsk\/${MIR_DISK}s2<br \/>\nlvextend -m 1 \/dev\/vg00\/lvol2\u00a0 \/dev\/dsk\/${MIR_DISK}s2 echo<\/p>\n<p>echo &#8220;Mirroring root&#8221;<br \/>\necho lvextend -m 1 \/dev\/vg00\/lvol3\u00a0 \/dev\/dsk\/${MIR_DISK}s2<br \/>\nlvextend -m 1 \/dev\/vg00\/lvol3\u00a0 \/dev\/dsk\/${MIR_DISK}s2 echo<\/p>\n<p>echo &#8220;Mirroring \/home&#8221;<br \/>\necho lvextend -m 1 \/dev\/vg00\/lvol4\u00a0 \/dev\/dsk\/${MIR_DISK}s2<br \/>\nlvextend -m 1 \/dev\/vg00\/lvol4\u00a0 \/dev\/dsk\/${MIR_DISK}s2 echo<\/p>\n<p>echo &#8220;Mirroring \/opt&#8221;<br \/>\necho lvextend -m 1 \/dev\/vg00\/lvol5\u00a0 \/dev\/dsk\/${MIR_DISK}s2<br \/>\nlvextend -m 1 \/dev\/vg00\/lvol5\u00a0 \/dev\/dsk\/${MIR_DISK}s2 echo<\/p>\n<p>echo &#8220;Mirroring \/tmp&#8221;<br \/>\necho lvextend -m 1 \/dev\/vg00\/lvol6\u00a0 \/dev\/dsk\/${MIR_DISK}s2<br \/>\nlvextend -m 1 \/dev\/vg00\/lvol6\u00a0 \/dev\/dsk\/${MIR_DISK}s2 echo<\/p>\n<p>echo &#8220;Mirroring \/usr&#8221;<br \/>\necho lvextend -m 1 \/dev\/vg00\/lvol7\u00a0 \/dev\/dsk\/${MIR_DISK}s2<br \/>\nlvextend -m 1 \/dev\/vg00\/lvol7\u00a0 \/dev\/dsk\/${MIR_DISK}s2 echo<\/p>\n<p>echo &#8220;Mirroring \/var&#8221;<br \/>\necho lvextend -m 1 \/dev\/vg00\/lvol8\u00a0 \/dev\/dsk\/${MIR_DISK}s2<br \/>\nlvextend -m 1 \/dev\/vg00\/lvol8\u00a0 \/dev\/dsk\/${MIR_DISK}s2 echo<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This was taken off of itrc forums. It may need some adjustment. #!\/bin\/ksh PARTITION_FILE=\/var\/tmp\/partition_file # define primary and mirror disks # the format is: # PRI_DISK=cXtXdX # PRI_DISK=cXtXdX PRI_DISK=c2t1d0 MIR_DISK=c3t0d0 echo echo &#8220;PRIMARY DISK = \/dev\/dsk\/$PRI_DISK&#8221; echo &#8220;MIRROR\u00a0 DISK = \/dev\/dsk\/$MIR_DISK&#8221; echo echo If the above is correct, hit enter to continue echo If not [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"_kadence_starter_templates_imported_post":false,"footnotes":""},"categories":[7,8],"tags":[],"class_list":["post-42","post","type-post","status-publish","format-standard","hentry","category-lvm","category-sysadmin"],"_links":{"self":[{"href":"http:\/\/www.hpux.ws\/index.php?rest_route=\/wp\/v2\/posts\/42"}],"collection":[{"href":"http:\/\/www.hpux.ws\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.hpux.ws\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.hpux.ws\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.hpux.ws\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=42"}],"version-history":[{"count":3,"href":"http:\/\/www.hpux.ws\/index.php?rest_route=\/wp\/v2\/posts\/42\/revisions"}],"predecessor-version":[{"id":45,"href":"http:\/\/www.hpux.ws\/index.php?rest_route=\/wp\/v2\/posts\/42\/revisions\/45"}],"wp:attachment":[{"href":"http:\/\/www.hpux.ws\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=42"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.hpux.ws\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=42"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.hpux.ws\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=42"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}