re-partition drives that are mirrored using DiskSuite

From: Ellen Davis (ellen.davis@UC.Edu)
Date: Fri Aug 15 2003 - 08:13:08 EDT


I am preparing a system that will be used by the faculty, staff and
students of University of Cincinnat. The primary use is hosting personal
webpages. Users also have shell access. SAS will also be available. This
system is not yet in production, but will in September.

I have a SunFire 280R running Solaris 8 with 4G of memory and two disk
drives with / and swap mirrored using DiskSuite.

I want to change the layout of the drives. I want to limit /var (put it on
its own slice), and create a /root/work which would contain non-OS stuff -
like downloads of packages such as pine, apache. I also want to increase
the size of slice 7 for the metastat replicas.

HAVE WANT
         67G / slice 0
mirrored 40G / slice 0 mirrored
         500M swap slice
1mirrored 4G swap slice 1 mirrored
         9M metastat replicas slice
7 10G /var slice 3 mirrored
                                                         14G /root/work
slice 4
                                                         500M replicas slice 7
Root current:
# metastat d2
d2: Mirror
     Submirror 0: d0 c1t0d0s0
       State: Okay
     Submirror 1: d1 c1t1d0s0
       State: Okay

Swap current:
# metastat d5
d5: Mirror
     Submirror 0: d3 c1t0d0s1
       State: Okay
     Submirror 1: d4 c1t1d0s1
       State: Okay

The guy who originally setup the machine is not working here anymore, and I
have not worked much with DiskSuite. I emailed SUN and she gave me the
general steps I needed - but not each command.

Can anyone comment on my procedure?

1. complete backup of /

2. backout Solstice DiskSuite
PHASE I: Preparations
=================================

Get copies of the SDS configuration files.

    # cp /kernel/drv/md.conf /kernel/drv/md.conf.orig
    # cp r /etc/lvm /etc/lvm.orig

Get copies of

# cp r /dev/dsk /dev/dsk.orig
# cp r /devices /devices.orig
# cp /etc/path_to_inst /etc/path_to_inst.orig

Get locations of all known replicas and command line syntax of how
    each metadevice was created.

   # metastat -p > /etc/lvm/md.orig.tab
   # metadb > /etc/lvm/metadb.orig

Save copies of /etc/vfstab and /etc/system files.

        # cp /etc/vfstab /etc/vfstab.orig
        # cp /etc/system /etc/system.orig

Phase II: Unmirroring OS Filesystems
====================================

1) metaroot c1t0d0s0

    This command returns root entry in /etc/vfstab to original underlying
    physical device, for root only.

2) Edit

    /etc/vfstab:

return swap to underlying physical devices

/dev/dsk/c1t0d0s1 - - swap - no -
/dev/dsk/c1t0d0s0 /dev/dsk/c1t1d0s0 / ufs 1 no -

    /etc/system:

    c) remove bootlist state replica lines.

set md:mddb_bootlist1="ssd:7:16 ssd:15:16 ssd:7:1050 ssd:7:2084 ssd:15:1050"
set md:mddb_bootlist2="ssd:15:2084"

3) Rename the DiskSuite startup files so they are no longer initialized
    at boot time.

    # cd /etc/rcS.d; mv S35lvm.init s35lvm.init
    # cd /etc/rc2.d; mv S95lvm.sync s95lvm.sync
    # cd /etc/rc3.d; mv S25mdlogd s25mdlogd

    These links will be added later by reinstalling DiskSuite

4) Convert the root mirror to a one-way mirror with the metadetach
    command. We remove the primary sub-mirror because if something were to
    go wrong; we could use the secondary sub-mirror to boot
    from and get back to our original config.

    #metadettach d2 d0 (where d0 contain boot disk c1t0d0)

5) Copy /etc/vfstab, /etc/system and startup files back. This is done on
c1t1d0, the secondary sub-mirror since the primary sub-mirror was detached.
If something happens ,
    we can always boot from sub-mirror c1t0d0 which would have original SDS
config.

    a) cp /etc/vfstab.orig /etc/vfstab
    b) cp /etc/system.orig /etc/system
    c) cd /etc/rcS.d; mv s35lvm.init S35lvm.init
    d) cd /etc/rc2.d; mv s95lvm.sync S95lvm.sync
    e) cd /etc/rc3.d; mv s25mdlogd S25mdlogd

6) Go to single-user mode

# init S

7) Reboot system

# reboot

system should come up on the bootdisk c1t0d0, without sds, solaris slices
should
be mounted.

Phase III: Removing SDS
=======================

Verify that no metadevices are in use:

     #df -kl

  Backout SDS related patches

         # patchrm 108693-06 DiskSuite 4.2.1 product patch
  Remove SDS packages:

    # /usr/sbin/pkgrm SUNWmdg SUNWmdnr SUNWmdr SUNWmdu SUNWmdx

    You have successfully backed out DiskSuite.

  reboot off the bootdisk c1t0d0, make sure you come up cleanly

# init 0
boot

3- copy all OS data over to the mirror disk c1t1d0 from the original
bootdisk c1t0d0

                 # mount /dev/dsk/c1t1d0s0 /mnt

                 # cd /
                 # ufsdump 0f - /dev/rdsk/c1t0d0s0 | ( cd /mnt; ufsrestore
rf -)
                 # rm /mnt/restoresymtable

install the bootblock:

           # installboot /usr/platform/`uname
-i`/lib/fs/ufs/bootblk /dev/rdsk/c1t1d0s0

         # umount /mnt

                 # fsck /dev/rdsk/c1t1d0s0

4 - boot off the mirror disk c1t1d0 , make sure you have a valid copy of
your data on the mirror disk.

# ls -l /dev/rdsk/c1t1d0s0
lrwxrwxrwx 1 root root 74 Dec 4 2002 /dev/rdsk/c1t1d0s0 ->
../../devices/pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w21000004cfa641fb,0:a,raw
# init 0
OK nvalias boot_disk1
/pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w21000004cfa641fb,0:a,raw
OK boot boot_disk1

5 - repartition original bootdisk c1t0d0, newfs new partitions.

# format
format>
0. c1t0d0
format> partition
partition> 0 (/)
       Enter partition id tag[unassigned]:
       Enter partition permission flags[wm]:
       Enter new starting cyl[0]: 0
       Enter partition size[164304b, 163c, 80.23mb, 0.08gb]: 40G
partition> 1 (swap)
       Enter partition id tag[unassigned]:
       Enter partition permission flags[wu]:
       Enter new starting cyl[0]: 0
       Enter partition size[164304b, 163c, 80.23mb, 0.08gb]: 4G
partition> 3 (/var)
       Enter partition id tag[unassigned]:
       Enter partition permission flags[wm]:
       Enter new starting cyl[0]: 0
       Enter partition size[164304b, 163c, 80.23mb, 0.08gb]: 10G
partition> 4 (/root/work)
       Enter partition id tag[unassigned]:
       Enter partition permission flags[wm]:
       Enter new starting cyl[0]: 0
       Enter partition size[164304b, 163c, 80.23mb, 0.08gb]: 14G
partition> 7 (meta replicas)
       Enter partition id tag[unassigned]:
       Enter partition permission flags[wm]:
       Enter new starting cyl[0]: 0
       Enter partition size[164304b, 163c, 80.23mb, 0.08gb]: 500M

partition> print
         add all cylinders to see if same as slice 2
partition> label
partition> quit
format> quit

         newfs /dev/rdsk/c1t0d0s0 # / on slice 0
         newfs /dev/rdsk/c1t0d0s3 # /var on slice 3
         newfs /dev/rdsk/c1t0d0s4 # /root/work on slice 4
                                         swap on slice 1

6 - copy your data from the mirror c1t1d0 over to newly partitioned
bootdisk c1t0d0

(still mutli-user mode, boot from c1t1d01)

RESTORE DATA from c1t1d0 (secondary drive, still old fomat) to c1t0d0
(primary drive, newly reformatted)

         mkdir /root2
         mkdir /var2
         mkdir /root/work2

         mount -o logging /dev/dsk/c1t0d0s0 /root2
         mount -o logging /dev/dsk/c1t0d0s3 /var2
         mount -o logging /dev/dsk/c1t0d0s4 /root/work2

COPY / FILES

         /root/work/fastfs /root2 fast

         # ufsdump 0f - /dev/rdsk/c1t1d0s0 | (cd /root2; ufsrestore xf -)

         rm restoresymtable
         cd /usr/platform/`uname -i`/lib/fs/ufs
         /usr/sbin/installboot bootblk /dev/rdsk/c1t0d0s0

         rm r /root2/var
         rm r /root2/root/work

         /root/work/fastfs /root2 slow

COPY /var FILES

         # /root/work/fastfs /var2 fast
         # cd /var
         # tar cfp - . | ( cd /var2 ; tar xfp - )
         # /root/work/fastfs /var2 slow

COPY /root/work FILES

         # /root/work/fastfs /root/work2 fast
         # cd /root/work
         # tar cfp - . | ( cd /root/work2 ; tar xfp - )

         # /root/work/fastfs /root/work2 slow

EDIT /etc/vfstab for / /var /root/work

/dev/dsk/c1t0d0s0 /dev/rdsk/c1t0d0s0 / ufs 1 yes -
/dev/dsk/c1t0d0s3 /dev/rdsk/c1t0d0s3 /var ufs 1 yes -
/dev/dsk/c1t0d0s4 /dev/rdsk/c1t0d0s0
/root/work ufs 1 yes -
/dev/dsk/c1t0d0s1 - - swap - no -

7 - boot off the newly partitioned bootdisk c1t0d0, make sure it comes up
clean (if you have any problems, you have a good copy of your os on the
mirror drive.)

# init 0
OK boot

8 - install the disksuite packages and patch for your version of solaris.

on Solaris 8 it's on the install cd 2 of 2 under the
/cdrom/../Solaris/EA/ directory SUNWmdg SUNWmdnr SUNWmdr SUNWdmu SUNWmdx

patchadd /root/work/patches/108693-16

9 - reboot the system.

# reboot

10 - copy the label from the bootdisk c1t0d0 over to the mirror disk c1t1d0
using prtvtoc and fmthard command.

# prtvtoc /dev/rdsk/c1t0d0s2 > /var/adm/doc/vtoc
# fmthard -s /var/adm/doc/vtoc /dev/rdsk/c1t1d0s2

11 - recreate db replicas and mirrors

CREATE REPLICAS

May need to use f on add (-a)

# metadb -a -f -l 8192 -c3 c1t0d0s7 c1t1d0s7
# metadb

MIRROR root

# metainit -f d11 1 1 c1t0d0s0 # create submirror d11 on c1t0d0s0
(primary)
d11: Concat/Stripe is setup
# metainit d12 1 1 c1t1d0s0 # create submirror d12 on
c1t1d0s0 (secondary)
d12: Concat/Stripe is setup
# metainit d1 -m d11 # create mirror d1 with
submirror d11
d1: Mirror is setup
# metaroot d1 # edits the
/etc/vfstab and /etc/system
# lockfs -fa
# reboot
...
# metattach d1 d12 # attach submirror d12
(files are copied)
d1: Submirror d12 is attached
# ls -l /dev/rdsk/c1t1d0s0
lrwxrwxrwx 1 root root 74 Dec 4 2002 /dev/rdsk/c1t1d0s0 ->
../../devices/pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w21000004cfa641fb,0:a,raw

MIRROR swap

# metainit -f d21 1 1 c1t0d0s1 # create submirror d21 on c1t0d0s1
(primary)
d21: Concat/Stripe is setup
# metainit d22 1 1 c1t1d0s1 # create submirror d22 on
c1t1d0s1 (secondary)
d22: Concat/Stripe is setup
# metainit d2 -m d21 # create mirror d2 with
submirror d21
d2: Mirror is setup

(Edit the /etc/vfstab file so that swap references the mirror)
/dev/dsk/c1t0d0s1 - - swap - no -
should be changed to:
/dev/md/dsk/d2 - - swap - no

# dumpadm (check to make sure dumps on /dev/md/dsk/d2 now)

# reboot
...
# metattach d2 d22 # attach submirror d22
(files are copied)
d2: Submirror d22 is attached

MIRROR var

# metainit -f d31 1 1 c1t0d0s3 # create submirror d31 on c1t0d0s3
(primary)
d31: Concat/Stripe is setup
# metainit d32 1 1 c1t1d0s3 # create submirror d32 on
c1t1d0s3 (seconardy)
d32: Concat/Stripe is setup
# metainit d3 -m d31 # create mirror d3 with
submirror d31
d3: Mirror is setup

(Edit the /etc/vfstab file so that the file system references the mirror)
Add line for /var
/dev/md/dsk/d3 /dev/md/rdsk/d3 /var ufs 2 yes logging

# metattach d3 d32 # attach submirror d32
(files are copied)
d3: Submirror d32 is attached

LOGGING

Add logging to UFS partitions edit /etc/vfstab to add logging option to
lines for

/
/var
/export/home

12 boot from mirror

# init 0
# boot

13 full dump of / /var and /root/work

  Ellen Davis
  Ellen.Davis@uc.edu
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:26:56 EDT