[Summary] puzzle with cold mirror script

From: Chris Hoogendyk (choogend_at_library.umass.edu)
Date: 06/21/04

  • Next message: ******: "What is the interface???"
    Date: Mon, 21 Jun 2004 13:43:17 -0400
    To: Sun Managers <sunmanagers@sunmanagers.org>
    
    

    Bingo to Casper *** and Dan Astoorian. Also thanks to Darren Dunham.

    /etc/vfstab was messed up. Both Casper and Dan suggested this, and Dan
    hit it exactly with his example. His message is after my sig. My
    original message after that.

    Thank you very much.

    ---------------

    Chris Hoogendyk

    -
        O__ ---- Network Specialist & Unix Systems Administrator
       c/ /'_ --- Library Information Systems & Technology Services
      (*) \(*) -- W.E.B. Du Bois Library
    ~~~~~~~~~~ - University of Massachusetts, Amherst

    <choogend@library.umass.edu>

    ---------------

    -----------------------------------
    -------- Original Answer --------
    -----------------------------------
    Subject: Re: puzzle with cold mirror script
    Date: Mon, 21 Jun 2004 13:14:26 -0400
    From: Dan Astoorian <djast@cs.toronto.edu>
    To: Chris Hoogendyk <choogend@library.umass.edu>

    Check your /etc/vfstab file very carefully: I suspect you may find that
    the line for / looks something like
         /dev/dsk/c0t8d0s0 /dev/rdsk/c0t0d0s0 / ufs #[...]
                                              ^

    instead of
         /dev/dsk/c0t8d0s0 /dev/rdsk/c0t8d0s0 / ufs #[...]
                                              ^

    When certain filesystem tools are given a block device (/dev/dsk/*),
    they consult /etc/vfstab to find out the name of the corresponding raw
    device (/dev/rdsk/*).

    If this is in fact your problem, then note that ufsdump uses a similar
    algorithm: any backups you've made could be of the wrong device.

    Good luck,

    -- 
    Dan Astoorian               People shouldn't think that it's better to have
    Sysadmin, CSLab             loved and lost than never loved at all.  It's
    djast@cs.toronto.edu        not, it's better to have loved and won.  All
    www.cs.toronto.edu/~djast/  the other options really suck.    --Dan Redican
    -----------------------------------
    -------- Original Question --------
    -----------------------------------
    Subject: puzzle with cold mirror script
    Date: Mon, 21 Jun 2004 12:56:07 -0400
    From: Chris Hoogendyk <choogend@library.umass.edu>
    To: Sun Managers <sunmanagers@sunmanagers.org>
    Either this is really weird or I'm just blanking out and missing
    something obvious. This is the mirror script from BigAdmin modified just
    a bit so that it works for me.
    I first set it up on a netra t1 that runs my proxy server. Worked.
    Then I set it up on an E250 that is my web server. Worked.
    Then I set it up on an E250 that is my failover. It tried to newfs my
    root boot drive. I killed it (I Was running it manually to test before
    putting it on cron). I cannot see why it would do what it did, unless
    there is some weird residual from once having done a disksuite mirror.
    Currently, if I do a metastat or metadb, I get: "there are no existing
    databases". Ok. cool. go ahead with cold mirror script.
    After setting it up, I ran it manually and got:
    /export/home/.backup/bin# ls -l
    total 6
    -rw-r--r--   1 root     other        632 Jun 21 11:43 crontab
    -rwx------   1 root     other       1766 Jun 21 11:36 mirror
    /export/home/.backup/bin# ./mirror
    ====================================
    Disk Copy script started Mon Jun 21 11:46:27 EDT 2004
    fmthard:  New volume table of contents now in place.
    newfs: /dev/rdsk/c0t0d0s0 last mounted as /
    newfs: construct a new file system /dev/rdsk/c0t0d0s0: (y/n)? n
    mount: /dev/dsk/c0t8d0s0 is not this fstype.
       DUMP: Writing 32 Kilobyte records
       DUMP: Date of this level 0 dump: Mon Jun 21 11:47:02 2004
       DUMP: Date of last level 0 dump: the epoch
       DUMP: Dumping /dev/rdsk/c0t0d0s0 (pollux:/) to standard output.
       DUMP: Mapping (Pass I) [regular files]
       DUMP: Mapping (Pass II) [directories]
       DUMP: Estimated 1484034 blocks (724.63MB).
       DUMP: Dumping (Pass III) [directories]
    ^C  DUMP: Interrupt received.
       DUMP: NEEDS ATTENTION: Do you want to abort dump?: ("yes" or "no")
    ufsrestore interrupted, continue? [yn] y
       DUMP: "yes" or "no"?
       DUMP: NEEDS ATTENTION: Do you want to abort dump?: ("yes" or "no") yes
       DUMP: The ENTIRE dump is aborted.
    cannot find directory inode 4
    abort? [yn] y
    dump core? [yn] y
    Abort - core dumped
    Note that the newfs refers to c0t0d0, which is supposed to be SRC. But
    in the script, it clearly says DEST in the newfs line. The mount
    properly lists c0t8d0, which is DEST, and the ufsdump says it is dumping
    c0t0d0, which is correctly SRC.
    Why would the script get confused like this? I just can't see how it is
    possible. Seems like a human sort of thing. I didn't even edit those
    lines, because the E250 I copied it from was configured identically, and
    on that computer it worked.
    Anyway, all the disk information and a listing of the script follows.
    Any ideas at all would be appreciated, inluding "you idiot, you have a
    typo in line 15!" (if that's true)  ;-)
    TIA
    ---------------
    Chris Hoogendyk
    -
        O__  ---- Network Specialist & Unix Systems Administrator
       c/ /'_ --- Library Information Systems & Technology Services
      (*) \(*) -- W.E.B. Du Bois Library
    ~~~~~~~~~~ - University of Massachusetts, Amherst
    <choogend@library.umass.edu>
    ---------------
    /export/home/chris# metadb
    metadb: pollux: there are no existing databases
    /export/home/chris# df -k
    Filesystem            kbytes    used   avail capacity  Mounted on
    /dev/dsk/c0t0d0s0    2053605  712802 1279195    36%    /
    /proc                      0       0       0     0%    /proc
    fd                         0       0       0     0%    /dev/fd
    mnttab                     0       0       0     0%    /etc/mnttab
    /dev/dsk/c0t0d0s4    1016122  684000  271155    72%    /var
    swap                 2083416      16 2083400     1%    /var/run
    swap                 2084184     784 2083400     1%    /tmp
    /dev/dsk/c0t0d0s5    1016122  252174  702981    27%    /opt
    /dev/dsk/c0t0d0s7    10234046 6223132 3908574    62%    /export/home
    /dev/dsk/c0t0d0s3    18580778 11102624 7292347    61%    /usr/local
    /dev/dsk/c0t0d0s6    1016122  324929  630226    35%    /usr/openwin
    /export/home/chris# format
    Searching for disks...done
    AVAILABLE DISK SELECTIONS:
            0. c0t0d0 <SUN36G cyl 24620 alt 2 hd 27 sec 107>
               /pci@1f,4000/scsi@3/sd@0,0
            1. c0t8d0 <SUN36G cyl 24620 alt 2 hd 27 sec 107>
               /pci@1f,4000/scsi@3/sd@8,0
            2. c0t9d0 <SUN36G cyl 24620 alt 2 hd 27 sec 107>
               /pci@1f,4000/scsi@3/sd@9,0
    Specify disk (enter its number): 1
    selecting c0t8d0
    [disk formatted]
    format> verify
    Primary label contents:
    Volume name = <        >
    ascii name  = <SUN36G cyl 24620 alt 2 hd 27 sec 107>
    pcyl        = 24622
    ncyl        = 24620
    acyl        =    2
    nhead       =   27
    nsect       =  107
    Part      Tag  Flag     Cylinders     Size            Blocks
       0       root  wm       0 -  1451    2.00GB    (1452/0/0)   4194828
       1       swap  wm    1452 -  2177    1.00GB    (726/0/0)    2097414
       2     backup  wm       0 - 24619   33.92GB    (24620/0/0) 71127180
       3        usr  wm    2178 - 15244   18.00GB    (13067/0/0) 37750563
       4        var  wm   15245 - 15970    1.00GB    (726/0/0)    2097414
       5 unassigned  wm   15971 - 16696    1.00GB    (726/0/0)    2097414
       6        usr  wm   16697 - 17422    1.00GB    (726/0/0)    2097414
       7       home  wm   17423 - 24619    9.91GB    (7197/0/0)  20792133
    format> disk
    AVAILABLE DISK SELECTIONS:
            0. c0t0d0 <SUN36G cyl 24620 alt 2 hd 27 sec 107>
               /pci@1f,4000/scsi@3/sd@0,0
            1. c0t8d0 <SUN36G cyl 24620 alt 2 hd 27 sec 107>
               /pci@1f,4000/scsi@3/sd@8,0
            2. c0t9d0 <SUN36G cyl 24620 alt 2 hd 27 sec 107>
               /pci@1f,4000/scsi@3/sd@9,0
    Specify disk (enter its number)[1]: 0
    selecting c0t0d0
    [disk formatted]
    Warning: Current Disk has mounted partitions.
    format> verify
    Primary label contents:
    Volume name = <        >
    ascii name  = <SUN36G cyl 24620 alt 2 hd 27 sec 107>
    pcyl        = 24622
    ncyl        = 24620
    acyl        =    2
    nhead       =   27
    nsect       =  107
    Part      Tag  Flag     Cylinders     Size            Blocks
       0       root  wm     726 -  2177    2.00GB    (1452/0/0)   4194828
       1       swap  wu       0 -   725    1.00GB    (726/0/0)    2097414
       2     backup  wm       0 - 24619   33.92GB    (24620/0/0) 71127180
       3        usr  wm    2178 - 15244   18.00GB    (13067/0/0) 37750563
       4        var  wm   15245 - 15970    1.00GB    (726/0/0)    2097414
       5 unassigned  wm   15971 - 16696    1.00GB    (726/0/0)    2097414
       6        usr  wm   16697 - 17422    1.00GB    (726/0/0)    2097414
       7       home  wm   17423 - 24619    9.91GB    (7197/0/0)  20792133
    /export/home/chris# more mirror
    #!/bin/sh
    # Original Script written by Constantin Ionescu
    # Modified by Carlo Cosolo
    # Modified by Peter Baer Galvin
    # Modified by John West
    # Use and distribute freely
    # acquired from Sun BigAdmin June 2004, cgh
    # fixed and adapted to our systems June 2004, cgh
    # Define variables for use in the script
    # ! Important, these must be set correctly !
    # The root disk to duplicate (leave off slice numbers and path)
    SRC=c0t0d0
    # The empty disk to duplicate it to (leave off slice numbers and path)
    DEST=c0t8d0
    # The directory to mount destination partitions on while duplicating
    MOUNTDIR=/mirror
    # file name for this script, to rename it on $DEST and avoid execution
    SCRIPT=/.backup/bin/mirror
    # The slices that should be copied
    SLICES="s0 s3 s4 s5 s6 s7"
    echo ====================================
    echo Disk Copy script started `date`
    echo
    # Make sure the mount point for duplicate partitions exists
    if [ ! -d $MOUNTDIR ]; then
       mkdir $MOUNTDIR
       chmod 700 $MOUNTDIR
    fi
    # Partition the duplicate disk, make filesystems, make it bootable
    prtvtoc /dev/rdsk/${SRC}s2 > /tmp/vtoc
    fmthard -s /tmp/vtoc /dev/rdsk/${DEST}s2
    installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/${DEST}s0
    rm /tmp/vtoc
    # Modify the following loop to handle any special cases
    for fs in $SLICES
    do
       newfs /dev/dsk/${DEST}${fs};
    #  newfs /dev/dsk/${DEST}${fs} < /dev/null;
       mount /dev/dsk/${DEST}${fs} ${MOUNTDIR};
       ufsdump 0f - /dev/dsk/${SRC}${fs} | (cd ${MOUNTDIR}; ufsrestore rf -);
       if [ $fs = "s0" ]; then
         sed "s/${SRC}/${DEST}/g" /etc/vfstab > ${MOUNTDIR}/etc/vfstab;
       fi
       if [ $fs = "s7" ]; then
         mv ${MOUNTDIR}${SCRIPT} ${MOUNTDIR}${SCRIPT}.DONTRUN;
       fi
       umount ${MOUNTDIR}
    done
    cp /dev/null /export/home/.backup/mirror-timestamp
    echo
    echo Disk Copy script ended `date`
    echo ====================================
    echo
    /export/home/chris#
    _______________________________________________
    sunmanagers mailing list
    sunmanagers@sunmanagers.org
    http://www.sunmanagers.org/mailman/listinfo/sunmanagers
    -- 
    ---------------
    Chris Hoogendyk
    -
        O__  ---- Network Specialist & Unix Systems Administrator
       c/ /'_ --- Library Information Systems & Technology Services
      (*) \(*) -- W.E.B. Du Bois Library
    ~~~~~~~~~~ - University of Massachusetts, Amherst
    <choogend@library.umass.edu>
    ---------------
    _______________________________________________
    sunmanagers mailing list
    sunmanagers@sunmanagers.org
    http://www.sunmanagers.org/mailman/listinfo/sunmanagers
    

  • Next message: ******: "What is the interface???"