How to mirror rootdisk ? - Veritas Volume Manager

This is a discussion on How to mirror rootdisk ? - Veritas Volume Manager ; Hello Friends, I have 2 internal 18GB disks c0t0d0 & c0t1d0 on Sun E420 solaris 2.6. The present Disk Partitioning and the volume Manger Status c0t1d0 Part Tag Flag Cylinders Size Blocks 0 unassigned wm 0 0 (0/0/0) 0 1 ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: How to mirror rootdisk ?

  1. How to mirror rootdisk ?


    Hello Friends,
    I have 2 internal 18GB disks c0t0d0 & c0t1d0 on Sun E420 solaris 2.6. The
    present Disk Partitioning and the volume Manger Status c0t1d0
    Part Tag Flag Cylinders Size Blocks
    0 unassigned wm 0 0 (0/0/0) 0
    1 unassigned wm 0 0 (0/0/0) 0
    2 backup wm 0 - 7505 16.86GB (7506/0/0) 35368272
    3 - wu 0 - 0 2.30MB (1/0/0) 4712
    4 - wu 1 - 7505 16.86GB (7505/0/0) 35363560
    5 unassigned wm 0 0 (0/0/0) 0
    6 unassigned wm 0 0 (0/0/0) 0
    7 unassigned wm 0 0 (0/0/0) 0
    c0t0d0
    Part Tag Flag Cylinders Size Blocks
    0 root wm 870 - 3043 4.88GB (2174/0/0) 10243888
    1 swap wu 0 - 869 1.95GB (870/0/0) 4099440
    2 backup wm 0 - 7505 16.86GB (7506/0/0) 35368272
    3 - wu 0 - 7505 16.86GB (7506/0/0) 35368272
    4 - wu 7505 - 7505 2.30MB (1/0/0) 4712
    5 swap wu 3044 - 3913 1.95GB (870/0/0) 4099440
    6 unassigned wm 0 0 (0/0/0) 0
    7 unassigned wm 0 0 (0/0/0) 0
    # vxprint -ht -g rootdg
    dm disk01 c0t1d0s2 sliced 4711 35363560 -
    dm rootdisk c0t0d0s2 sliced 4711 35363560 -
    v rootvol root ENABLED ACTIVE 10243888 ROUND -
    pl rootvol-01 rootvol ENABLED ACTIVE 10243888 CONCAT - RW
    sd rootdisk-03 rootvol-01 rootdisk 4099439 10243888 0 c0t0d0 ENA

    v swapvol swap ENABLED ACTIVE 4099440 ROUND -
    pl swapvol-01 swapvol ENABLED ACTIVE 4099440 CONCAT - RW
    sd rootdisk-B0 swapvol-01 rootdisk 35363559 1 0 c0t0d0 ENA
    sd rootdisk-02 swapvol-01 rootdisk 0 4099439 1 c0t0d0 ENA

    v swapvol2 swap ENABLED ACTIVE 4099440 ROUND -
    pl swapvol2-01 swapvol2 ENABLED ACTIVE 4099440 CONCAT - RW
    sd rootdisk-01 swapvol2-01 rootdisk 14343327 4099440 0 c0t0d0 ENA

    Now the partioning is different on the 2 disks. So do I need to make the
    partitioning exactly same before mirroring by the command vxdiskadm option
    6 ? Is the 2.30 MB partition 3 on c0t1d0 a VM partition or something ? Can
    I change its location to partition 4 as on c0t0d0 ? Do I need to change that
    partition from partition no. 3 to no. 4 on the c0t1d0 and make other partitions
    and their partition numbers exactly same as c0t0d0 on running system and
    then use the vxdiskadm option 6 ?
    Awaiting your valuable suggestions.
    Thanks & Best Regards.
    Mantosh

  2. Re: How to mirror rootdisk ?

    Hi Mantosh,

    You should never touch the partitions on a disk under VM control. The c0t0d0 disk
    is the encapsulated root disk and the other is a normal initialized disk. If you
    select option 6 in vxdiskadm you have to specify the source disk (rootdisk) and
    the target disk (disk01) and VM will fix the rest.

    Regarding the partitions:

    VM normally uses partition 3 and 4 for the private and the public region. The
    private region stores info about the virtual objects and the public region contain
    all the data. VM knows where in the public region the data is located.

    Good luck.

    Regards,
    Peter Sevborn


    Mantosh Kharkar wrote:

    > Hello Friends,
    > I have 2 internal 18GB disks c0t0d0 & c0t1d0 on Sun E420 solaris 2.6. The
    > present Disk Partitioning and the volume Manger Status c0t1d0
    > Part Tag Flag Cylinders Size Blocks
    > 0 unassigned wm 0 0 (0/0/0) 0
    > 1 unassigned wm 0 0 (0/0/0) 0
    > 2 backup wm 0 - 7505 16.86GB (7506/0/0) 35368272
    > 3 - wu 0 - 0 2.30MB (1/0/0) 4712
    > 4 - wu 1 - 7505 16.86GB (7505/0/0) 35363560
    > 5 unassigned wm 0 0 (0/0/0) 0
    > 6 unassigned wm 0 0 (0/0/0) 0
    > 7 unassigned wm 0 0 (0/0/0) 0
    > c0t0d0
    > Part Tag Flag Cylinders Size Blocks
    > 0 root wm 870 - 3043 4.88GB (2174/0/0) 10243888
    > 1 swap wu 0 - 869 1.95GB (870/0/0) 4099440
    > 2 backup wm 0 - 7505 16.86GB (7506/0/0) 35368272
    > 3 - wu 0 - 7505 16.86GB (7506/0/0) 35368272
    > 4 - wu 7505 - 7505 2.30MB (1/0/0) 4712
    > 5 swap wu 3044 - 3913 1.95GB (870/0/0) 4099440
    > 6 unassigned wm 0 0 (0/0/0) 0
    > 7 unassigned wm 0 0 (0/0/0) 0
    > # vxprint -ht -g rootdg
    > dm disk01 c0t1d0s2 sliced 4711 35363560 -
    > dm rootdisk c0t0d0s2 sliced 4711 35363560 -
    > v rootvol root ENABLED ACTIVE 10243888 ROUND -
    > pl rootvol-01 rootvol ENABLED ACTIVE 10243888 CONCAT - RW
    > sd rootdisk-03 rootvol-01 rootdisk 4099439 10243888 0 c0t0d0 ENA
    >
    > v swapvol swap ENABLED ACTIVE 4099440 ROUND -
    > pl swapvol-01 swapvol ENABLED ACTIVE 4099440 CONCAT - RW
    > sd rootdisk-B0 swapvol-01 rootdisk 35363559 1 0 c0t0d0 ENA
    > sd rootdisk-02 swapvol-01 rootdisk 0 4099439 1 c0t0d0 ENA
    >
    > v swapvol2 swap ENABLED ACTIVE 4099440 ROUND -
    > pl swapvol2-01 swapvol2 ENABLED ACTIVE 4099440 CONCAT - RW
    > sd rootdisk-01 swapvol2-01 rootdisk 14343327 4099440 0 c0t0d0 ENA
    >
    > Now the partioning is different on the 2 disks. So do I need to make the
    > partitioning exactly same before mirroring by the command vxdiskadm option
    > 6 ? Is the 2.30 MB partition 3 on c0t1d0 a VM partition or something ? Can
    > I change its location to partition 4 as on c0t0d0 ? Do I need to change that
    > partition from partition no. 3 to no. 4 on the c0t1d0 and make other partitions
    > and their partition numbers exactly same as c0t0d0 on running system and
    > then use the vxdiskadm option 6 ?
    > Awaiting your valuable suggestions.
    > Thanks & Best Regards.
    > Mantosh



  3. Re: How to mirror rootdisk ?


    Here are some scripts I wrote ....

    Script 1 (configure_rootdisk):
    Installs your veritas keys and encapsulates the root disk.

    Script 2 (initdisks):
    We have like 18 gig disks in these servers. We allocate general partitions
    on the disks (/, /opt, /var, /export/home) and leave the rest for Veritas.
    My script allocates two vxfs file systems. The first one of 7G called /apps
    and the 2nd of 3G called /logs .. I run this on freashly installed systems
    .. I install from a Jumpstart Image and then run these scripts .. so be carefull
    with them and make sure they are okay for your environment. They work for
    me.. =)

    ---------- configure_rootdisk ------------
    #!/bin/sh

    #
    # Script to configure veritas and encapsulate root disk
    #

    get_license()
    {
    echo ""
    echo "Enter Veritas License: \c"
    read LICENSE
    echo "$LICENSE" | /usr/sbin/vxlicense -c
    echo ""
    echo ""
    }

    while [ X ]; do
    get_license
    echo "Enter Another? [y/n]: \c"
    read YN
    if [ "$YN" = "n" ] || [ "$YN" = "N" ]; then
    break
    fi
    done

    #Get veritas in a mode that we can use it
    /sbin/vxconfigd -k -m disable
    /usr/sbin/vxdctl init
    vxdg init rootdg
    # /usr/sbin/vxdctl enable
    rootdisk=`/etc/vx/bin/vxdevlist | head -2 | tail -1 | awk '{print $1}'`
    /etc/vx/bin/vxencap -g rootdg -c rootdisk=${rootdisk}

    echo ""
    echo ""
    echo "Reboot for the changes to take place."
    echo "Once the system comes backup run /opt/install/scripts/initdisks script."
    echo ""
    echo ""
    echo ""


    ----------- snip ----------


    ----------- initdisks ----------
    # create the mount points if they do not exist for /logs and /apps
    if [ ! -d /logs ]; then
    echo "-> Making /logs"
    mkdir /logs
    else
    echo "-> /logs already exists, moving on ..."
    fi

    if [ ! -d /apps ]; then
    echo "-> Making /apps"
    mkdir /apps
    else
    echo "-> /apps already exists, moving on ..."
    fi

    # Get the 2nd disk and put it into veritas control in the rootdg
    CHECK=`/etc/vx/bin/vxdevlist | head -3 | tail -1 | awk '{print $2}'`
    if [ "${CHECK}" != "rootdisk" ]; then
    SecondDisk=`/etc/vx/bin/vxdevlist | head -3 | tail -1 | awk '{print
    $1}'`
    if [ "${SecondDisk}" ]; then
    echo "-> Adding second disk to rootdg ${SecondDisk}"
    /usr/lib/vxvm/bin/vxdisksetup -n ${SecondDisk}
    /usr/sbin/vxdisk online ${SecondDisk}
    /usr/sbin/vxdisk -f init ${SecondDisk}
    /usr/sbin/vxdg -g rootdg adddisk disk01=${SecondDisk}
    else
    echo "-> Warning: Can not determine second disk"
    fi
    fi

    # Create the appsvol and filesystem
    CHECK=""
    CHECK=`vxprint | grep "^v" | grep " appsvol " | awk '{print $7}'`
    if [ "$CHECK" ]; then
    echo "-> Warning: appsvol already exists in veritas ..."
    else
    echo "-> Creating /apps file system of 7gigs"
    /usr/sbin/vxassist -g rootdg make appsvol 7g layout=nostripe alloc="rootdisk"
    # This just makes sure vxassist worked
    if [ "$?" = 0 ]; then
    /usr/sbin/mkfs -F vxfs /dev/vx/rdsk/rootdg/appsvol 14680064
    /usr/lib/fs/vxfs/fsadm -o largefiles /dev/vx/rdsk/rootdg/appsvol
    grep "^/dev/vx/dsk/rootdg/appsvol " /etc/vfstab > /dev/null
    if [ "$?" = 1 ]; then
    echo "-> Putting in /apps vfstab entry"
    echo "/dev/vx/dsk/rootdg/appsvol /dev/vx/rdsk/rootdg/appsvol
    /apps vxfs 3 yes -" >> /etc/vfstab
    else
    echo "-> Warning: /apps already in vfstab, moving
    on"
    fi
    echo "-> Mounting /apps"
    mount /apps
    else
    echo "-> ERROR: appsvol (/apps) filesystem could not be created"
    fi
    fi

    # Create the logvol and filesystem
    CHECK=""
    CHECK=`vxprint | grep "^v" | grep " logvol " | awk '{print $7}'`
    if [ "$CHECK" ]; then
    echo "-> Warning: logvol already exists in veritas ..."
    else
    MAXSIZE=`/usr/sbin/vxassist -g rootdg maxsize layout=nostripe alloc=rootdisk
    | awk '{print $4}'`
    echo "-> Creating /logs file system"
    /usr/sbin/vxassist -g rootdg make logvol $MAXSIZE layout=nostripe
    alloc=rootdisk
    if [ "$?" = 0 ]; then
    /usr/sbin/mkfs -F vxfs /dev/vx/rdsk/rootdg/logvol $MAXSIZE
    /usr/lib/fs/vxfs/fsadm -o largefiles /dev/vx/rdsk/rootdg/logvol
    grep "^/dev/vx/dsk/rootdg/logvol " /etc/vfstab > /dev/null
    if [ "$?" = 1 ]; then
    echo "-> Putting in /logs vfstab entry"
    echo "/dev/vx/dsk/rootdg/logvol /dev/vx/rdsk/rootdg/logvol
    /logs vxfs 3 yes -" >> /etc/vfstab
    else
    echo "-> Warning: /logs already in vfstab, moving
    on"
    fi
    echo "-> Mounting /logs"
    mount /logs
    else
    echo "-> ERROR: logsvol (/logs) filesystem could not be created"
    fi
    fi

    # Mirror rootdiks to disk01
    echo "-> Starting Mirror Process in 10 seconds or press ^C to abort ..."
    sleep 10
    nohup /etc/vx/bin/vxmirror -g rootdg rootdisk disk01 &


    ------------- snip ------------


+ Reply to Thread