Solved

Upgrade internal disks to higher size

Posted on 2007-03-19
5
1,365 Views
Last Modified: 2013-12-27
# uname -a
SunOS xxxxx 5.9 Generic_118558-27 sun4u sparc SUNW,Sun-Fire-V210
#format
AVAILABLE DISK SELECTIONS:
       0. c1t0d0 <SUN36G cyl 24620 alt 2 hd 27 sec 107>
          /pci@1c,600000/scsi@2/sd@0,0
       1. c1t1d0 <SUN36G cyl 24620 alt 2 hd 27 sec 107>
          /pci@1c,600000/scsi@2/sd@1,0

We are trying to perform a disk upgrade on this box running Solaris 9. Currently there are two 36GB internal disks which are mirrored and host the root partition.

We are planning to upgrade these two disks to 146Gb, so we intend to break the existing mirrors, pull out one 36GB disk and swap it with a new 146GB disk. We want to create a partition 0 that is similar to the one on the 36GB disk and mirror it to host root. Though we are unable to achieve the same cylinder/block size, we are planning to create the 0 partition of same size as on the 36GB disk and mirror both the slices (36GB disk slice 0 and 146Gb disk slice 0).

If the mirroring works and the data from 36Gb slice 0 is syncs to 146GB slice 0, we will copy the boot block from the boot disk to the slice 0 on 146Gb using install boot and then test the system if it boots fine. If the system boots up with the 146GB slice 0 mirror, then we will swap out the other 36GB disk with 146GB disk and perform a similar plan on the new 146GB disk.

We are concerned cylindwhether we can mirror two slices with different er/block sizes, but same size (in this case slice 0 of 36gb disk which is 26.03GB and slice 0 of 146Gb disk which is 26.04GB).

Is there any other easier way of performing the root disk upgrade?
0
Comment
Question by:sriniajay
  • 3
  • 2
5 Comments
 
LVL 38

Accepted Solution

by:
yuzh earned 500 total points
Comment Utility
The easier way to do this job, is to break the mirror first (remember
to modify your /etc/vfstab file), add the new hard disk in, partion the
new harddisk the way you wanted, then use ufsdump/ufsrestore to
transfer your data accross to the new hard disk, run installboot to make the new harddisk bootable (if your disk layout is differ from the
original one, you need to adjust /etc/vfstab in  the new harddisk).

shutdown the system, make the new HD as the primary disk, and put
the other new harddisk in. boot up the system, setup the disk mirror for the new HDs.

If the number of partions are the same for the new hard disk (same disk layout, differ in size, you need to make sure the partion is big enough for the exsiting data), you can use the following script to clone the disk (feel free to modify the script):

#!/bin/ksh
#
# this script will clone the primary disk to the target disk
# usage: clonedisk t-disk
#
# Written by: Greg Yu
# Version 1.0
 
#set -x
 
if [ "$#" != 1 ] ; then
    echo "usage: $0 t-disk"
    echo "where: t-disk is the target disk (e.g. c0t1d0)"
    echo "Note:  Please ignore the slice numbers!"
    exit 1
fi
 
format</dev/null | grep "\.[      ]$1" >/dev/null 2>&1 && T=$1
 
if [ -z "$T" ] ; then
   echo "ERROR: Target disk $1 does not exist -- exit!" ; exit 2
fi
 
clear ; echo "
  ATTENTION: This script will copy the whole prinmary disk to $T
             If this is NOT what you intended to do, abort
             by pressing Ctrl-C now!
                      Are you ready now [N] ? \c"
                      read ans
                      if [ "$ans" != "Y" -a "$ans" != "y" ] ; then
                         exit 1
                      fi
 
# copy VTOC:
# You manually partion your new HD, since they are differ in size
# prtvtoc /dev/rdsk/c0t0d0s2 | fmthard -s - /dev/rdsk/${T}s2
 
#Now copy the filesystem slice by slice
 
df -Fufs | grep c0t0d0 | tr -d "()" | awk '{print $1," ", $2 }' >/tmp/myfstab
 
exec 0</tmp/myfstab
 
while read  fs  sl ; do
    SD=`basename $sl | cut -c7-`
    echo "the current filesystem is $fs, target disk slice is /dev/rdsk/${T}${SD
}"
    newfs /dev/rdsk/${T}${SD}
    cd /
    mount /dev/dsk/${T}${SD} /mnt

    # check if the slice is mounted
    if [[ "$?" -ne 0 ]] ; then
       echo " failed to mount /dev/dsk/${T}${SD} on /mnt !!!"
       exit 3
    fi
 
    cd /mnt
    echo "copying data to /dev/dsk/${T}${SD} ..."
    ufsdump 0f - $fs | ufsrestore rvf -
    rm restoresymtable
    cd /
    umount /mnt
    sleep 1
done
 
rm /tmp/myfstab
 
# make the target disk bootable:
  /usr/sbin/installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk \
   /dev/rdsk/${T}s0
 
  echo "clone disk c0t0d0 to $T completed, thank you!"
 
exit
#End of Script

# I assume you know how to break/setup disk mirroring.


0
 
LVL 27

Expert Comment

by:Nopius
Comment Utility
>  The easier way to do this job, is to break the mirror first (remember
> to modify your /etc/vfstab file), add the new hard disk in, partion the
> new harddisk the way you wanted, then use ufsdump/ufsrestore to
> transfer your data accross to the new hard disk, run installboot to make the new harddisk bootable (if your disk layout is differ from the
> original one, you need to adjust /etc/vfstab in  the new harddisk).

yuzh: I dont' think it's easier it's almost the same :-). But ufsdump/ufsrestore takes longer then attaching second half of the mirror and synchronizing it.

 sriniajay: I guess your way is the best. If you are running Solaris Volume Manager
1) don't forget to remove metadb replica from drive being detached
2) don't forget to create metadb on a new drive
3) create partition 0 slightly bigger (say 37Gb) then on original drive, but it's OK to mix drives with different c/h/s geometry.
4) wait until entire partition will by in sync before rebooting
0
 
LVL 38

Expert Comment

by:yuzh
Comment Utility
>>yuzh: I dont' think it's easier it's almost the same :-). But ufsdump/ufsrestore takes longer then attaching second half of the mirror and synchronizing it.

You need to break/setup the disk mirror twice (I know tey all work).
0
 
LVL 27

Expert Comment

by:Nopius
Comment Utility
> You need to break/setup the disk mirror twice (I know tey all work).
With your method, I need to ufsdump/ufsrestore once and setup/attach a mirror once (synchronize). It's almost the same as break mirror twice :-)
0
 
LVL 27

Expert Comment

by:Nopius
Comment Utility
In mean in V210 there are only 2 disk slots (which are already busy) and we must break mirror anyway...
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now