SOLARIS - ufsdump and ufsrestore a root filesystem under VERITAS Volume
Autor: VixPS | Publicado: 2009-07-01T11:07:00-03:00

Procedimento muito útil, quem usa Veritas fatalmente irá fazer isso um dia:Step-by-step procedure for ufsdump and ufsrestore of VM encapsulated root disk Document Body: PROCEDURE FOR UFSDUMP AND RESTORE OF VM ENCAPSULATED ROOT DISK assumptions: 1. /etc/vx/reconfig.d/disk.d/cxtxdx/vtoc has been recorded. OR: 2. A copy of the pre-encapsulation partition map has been recorded. 3. There is a local tape drive 4. Partitions are: / 0 swap 1 /usr 5 /var 6 /opt 7 Dump all filesystems to a single tape: Boot into single-user mode ok> boot -s As root: # ufsdump 0uf /dev/rmt/0n / # ufsdump 0uf /dev/rmt/0n /usr # ufsdump 0uf /dev/rmt/0n /var # ufsdump 0uf /dev/rmt/0 /opt The above commands will create four ufsdump files on the tape. SECTION 1- RESTORING FILESYSTEMS FROM TAPE IN THE EVENT OF A CATASTROPHIC ROOT DISK FAILURE USE THE FOLLOWING TO RESTORE THE FILESYSTEMS AND BOOT THE SYSTEM. The following is a quick routine for restoring your file system. This procedure assumes that you saved your root file system using ufsdump. This document also assumes that your root filesystem is on c0t3d0s0. 1. Load your Solaris CD-ROM into your CD-ROM player. 2. Boot the CDROM in single-user mode:    ok  boot cdrom -sw 3. When you get the Bourne shell prompt, repartition your root file system using the previously saved pre-encapsulation partition map.    a. use "format" to partition your drive as it was before encapsulation /etc/vx/reconfig.d/disk.d/cxtxdx/vtoc holds this information    b. use "newfs" to create a file system on c0t3d0s0 example" newfs /dev/rdsk/c0t3d0s0 4. Check your new root file system:    # fsck /dev/rdsk/c0t3d0s0 5. Mount the root file system at your /a mount point:    # mount /dev/dsk/c0t3d0s0 /a   6. Start your restore, but first change directory to the new root file system:    a.  cd /a    b.  ufsrestore rvf /dev/rmt/0    b. vxrestore -crvf /dev/rmt/0 7. When the restore has completed, remove the restore symbol table and    unmount the new root partition:    a. rm restoresymtable    b. cd /    c. umount /a 8. Check the new root partition one more time:    # fsck /dev/rdsk/c0t3d0s0 9. Install the boot block:       # For Solaris 2.5, 2.5.1, 2.6, 7, or 8      a. cd /usr/platform//lib/fs/ufs      b. To get  type uname -i.  Or to make things even         easier, embed it in the cd command like this:         * cd /usr/platform/`uname -i`/lib/fs/ufs         * Make sure you are using back quotes around the command.      c. installboot bootblk /dev/rdsk/c0t3d0s0      To restore other filesystem partitions ( usr, var, etc...), follow steps 3.b-8 SECTION 2 - USING THE MT COMMAND TO FIND THE APPROPRIATE FILES ON TAPE: TO ACCESS EACH FILE ON THE TAPE YOU MUST ISSUE THE FOLLOWING COMMANDS WITH THE *n* (no rewind) SWITCH   to access the second file: # mt -f /dev/rmt/0n fsf 1 (this skips the first file and stops at the bennining of the second file)   # mt -f /dev/rmt/0 rewind (to rewind tape to the beginning) I rewind after each restore so that I don't lose track of which data I am accessing. # mt -f /dev/rmt/0n fsf 2 (to access the third file...and so on) Restore and check each filesystem      DO NOT REBOOT YET! SECTION 3 - REMOVE THE FILESYSTEMS FROM VOLUME MANAGER CONTROL Unencapsulate the newly restored disk Still booted from cdrom...... # mount /dev/dsk/c0t3d0s0 /a # vi /a/etc/system remove all rootdev statements # touch /a/etc/vx/reconfig.d/state.d/install-db # rm /a/etc/vx/reconfig.d/state/root-done # cp /a/etc/vfstab.prevm /a/etc/vfstab VERIFY THAT THE PARTITION MAP IS THE ORIGINAL PRE-ENCAPSULATION MAP AND THAT /ETC/VFSTAB IS CORRECT. # umount /a # fsck /dev/rdsk/c0t3d0s0 REBOOT # reboot SECTION 4 - RE-ENCAPSULATE THE ROOT DISK THEN RE-MIRROR Procedure for encapsulating the rootdisk without going through the sometimes lengthy process of running 'vxinstall'. This procedure should NOT be used if you have an existing rootdg diskgroup that you want to preserve, since this procedure creates a *new* rootdg diskgroup containing only the encapsulated root disk. Document Body: Top MANUALLY ENCAPSULATING THE ROOT DISK - FROM THE COMMAND LINE # vxiod set 10 For ver 3.2 you will need to modload vxdmp:   # modload /kernel/drv/vxdmp  or   # modload /kernel/drv/sparcv9/vxdmp # vxconfigd -m disable -k # vxdctl init # vxdg init rootdg # /usr/lib/vxvm/bin/vxencap rootdisk=c#t#d# * If there was another disk in rootdg, use fmthard to remove the   public and private regions (be very careful with fmthard):   # fmthard -d 4:0:0:0:0 /dev/rdsk/c#t#d#s2   # fmthard -d 3:0:0:0:0 /dev/rdsk/c#t#d#s2 # init 0 * Make sure your boot-device is set correctly ok boot ------------------------------------------------------------------------------------------------------------------------------------------------------------- SOLARIS - opções do boot (ok) - SPARC ok> boot    -> boot normal no disco default de root ok> boot -r -> reconfiguração dos devices (/dev e /devices) ok> boot -x -> boot fora do modo de cluster ok> boot -a -> boot interativo ok> boot -v -> boot em modo verbose ok> boot -m verbose -> mostra passo-a-passo os processos iniciados pelo SMF Essas opções podem ser combinadas: boot -arvm verbose