Summary: How to mirror a boot hard drive without lsm

From: Kirkland, Mike # IHTUL (mike.kirkland@ndchealth.com)
Date: Fri Jun 07 2002 - 10:17:58 EDT


Thanks to everyone for your advice and techniques, including Dr. Tom Blinn,
A. Mahendra Rajah, alan@nabeth.cxo.cqpcorp.net, Peter Gergen, Alan Davis,
Derk Tegeler, David Hull, Douglas L. Thomas and Ohad Imer.

Several of the methods / advice were the same, so I will post the ones that
included to most detail. This way when others have a similar situation they
can gain some insight from your collective expertise.

> Hi everyone,
>
> I have a DS10 tru64 V5.1with 2 18g hard drive. The primary drive is
> going out. I have logged a call with compaq to have it replaced. I want
> to mirror the primary hard drive to the second hard drive. These drives
> need to be mirror-ed and I want to be able to boot off of the second
> hard drive, when the first fails or until I can replace it.
>
> We do not have a license for LSM and probably will not get a license.
> Any suggestions on how other sysadmins are doing this with products /
> scripts you used is appreciated.
>
> Mike Kirkland
> Unix System Administrator
> National Data Corporation
> Phone: (918) 481-2817
> Fax: (918) 481-4275
> mike.kirkland@ndchealth.com <mailto:mike.kirkland@ndchealth.com>
> NDC=AE| HEALTH
> 6100 South Yale Avenue
> Suite 1900
> Tulsa, OK 74136

If the two disks are typical of Compaq supplied disks, they are of
exactly the same size. If you zero the label on the second disk
and boot to single user mode, you should be able to "dd" the first
disk to the second ("dd if=/dev/disk/dsk0c of=/dev/disk/dsk1c bs=64k")
and then you can mount the second disk and go in and change the links
in the /etc/fdmns directories to correspond to the changed disk name,
and change the swap device assignment in the /etc/sysconfigtab file.
That's about all you need to do. Alternatively, you can label your
2nd disk, create file domains and filesets using the normal AdvFS
utilities, and copy the existing system filesets to the new disk by
using vdump and vrestore. Either way, you still need to fix up the
links in the /etc/fdmns directories and the swap device assignment
in the /etc/sysconfigtab file.

Note that neither of these methods "mirrors" the first disk. You
need to move the system to the second disk and then boot off of it
and stop using the disk you know is failing; if the primary disk
goes away, you are in trouble. Even with LSM, you might be hard
pressed to recover if you lose the primary boot disk (it should be
able to cope, but I wouldn't want to bet on it myself).

Tom

   Dr. Thomas P. Blinn + Tru64 UNIX Software + Hewlett-Packard Company
 Internet: tpb@zk3.dec.com, thomas.blinn@compaq.com, thomas.blinn@hp.com
  110 Spit Brook Road, MS ZKO3-2/W17 Nashua, New Hampshire 03062-2698
   Technology Partnership Engineering Phone: (603) 884-0646
     ACM Member: tpblinn@acm.org PC@Home: tom@felines.mv.net
================================

"I want to mirror the primary hard drive to the second hard
 drive. We do not have a license for LSM and probably will
 not get a license."

   We vdump /, /usr and /var partitions from the primary disk
   to the second disk every 6 hours.

   -- mahendra

===============================
alan@nbeth

        Are any of the file systems on the drive AdvFS? While it
        isn't mirroring, you can use addvol and rmvol (if you have
        *that* license) to migrate the file systems to a different
        disk without having to take the file systems out of service.
        This won't work for the root.

        Aside from that make sure your backup strategy can withstand
        the sudden loss of a disk.

        If you have the AdvFS utilities, you can migrate usr_domain
        easily enough. Swapon will let you add page/swap space
        dynamically, but you can't turn it off except by rebooting.
        Aside from /tmp, the root doesn't change much in my
        experience. Of course it depends on how often users
        change their passwords.

        The basic problem is that real mirroring, especially of
        the root file system requires close ties with the kernel.
        Even an ordinary device driver isn't enough because of
        the root. If the devices were behind an array controller,
        many of those allow turning a simple disk into a mirror
        set dynamicially. But, you just seem to have bare disks.

        Lacking real mirroring for you what, is basically some
        variation of backup. Sometimes a good, simple backup
        strategy, serves well enough.
====================================
This is not supported and I can see how it might not work in some
situations, but this is what we are doing in one of our systems (4.0F with
UFS file systems).

Every day, a cron job kicks off a script which does:

vdump -0f - / | vrestore -xf - -D /foobar
vdump -0f - /usr | vrestore -xf - -D /foobar/usr
awk '$0 !~ /foobar' /foobar/etc/fstab | sed 's/rz0/rz1/g' >
/foobar/etc/fstab.new
mv /foobar/etc/fstab.new /foobar/etc/fstab
rm /foobar/sbin/swapdefault
cd /sbin
ln -s ../dev/rz1b swapdefault

Note: For AdvFS file systems, you can move the domains rather than modify
fstab.

i.e.:
cd /foobar/etc/fdmns
mv root_domain tempdomain
mv foobar_domain root_domain
mv tempdomain foobar_domain
mv usr_domain tempdomain
mv foobarusr_domain usr_domain
mv tempdomain foobarusr_domain

Regards,
Mandell Degerness

===============================
If you don't have lsm, then there are two options:

1. Use a controller that does hardware mirroring and use it to mirror to the
second drive
2. have a second drive (same size(and model if possible) as the boot drive)
attached to the server
   then zap the disklabel if it has one with 4.0X: disklabel -z rzXX
or
                                             5.XX: disklabel -z dskXX
   then just use 4.0X: dd if=/dev/rrzXX of=/dev/rrzXY bs=100000K or
                 5.XX: dd if=/dev/disk/dskXX of=/dev/disk/dskXY
bs=100000K
   ** check the block size (bs) in the man page for dd is correct for you
system memory
   once this operation has completed, this disk is a duplicate of the first
disk
   If you never change the original boot disk, then the copied disk never
needs to be dd'ed
   This method is done best done in single user mode but can be done in
multi-user mode
   If you wanted to, you could setup a dd as an rc process that would run
every time the server is booted.
   If your boo disk dies then you can boot with this disk to single user
mode
     and if the usr file system wount mount then you probably will need to
modify the
     /etc/fdmns/usr_domain disk partition link.

Email me if you need more info.

Regards

Peter Gergen
=========================================
Alan Davis

There are a limited range of products that will allow you to configure an
AlphaServer boot drive as RAID1 (mirrored). There are a number of ways to
make a "warm standby" boot disk that will allow you to reboot to a close
approximation of the primary boot disk but it's /not/ a real mirror.

What I've recommended to a number of customers is to use a combination of a
nightly vdump/vrestore to a second disk and rsync for volatile data to the
backup drive during the day. If the primary disk fails the system can be
booted off of the secondary drive to single-user and mountroot will resolve
the new device paths. This copy of the disk will be, at most, as long out of
date as the time between rsync's.

The two tricky bits are making sure you have bootblocks on the second drive
if you are using ADVfs (disklabel -t advfs ... whenever you modify the
label) and using mountroot (new in v5.x) to fix the device naming databases
when booting from a cloned disk.

The SRM bootdef_dev variable should list both boot devices.
============================================

To Mirror the disk without LSM you will most likely need an array card and
perform it in the hardware, in which case the disks would need to be
re-initialized.

It appears that what you need is to replace the drive and that may not
require LSM or mirroring. If you are using ADVFS you may be able to
"addvol" partitions from the second disk to the file domains that contain
the first disk, this essentially creates a stripeset. You can then "rmvol"
the partitions from the first disk from the file domains.

You will also have to move your SWAP space, too. I have a tendency to
forget about SWAP, so...

For example:

Assuming dsk6 is the first disk and dsk7 is the second disk and the
disklabels are the same.

/usr/bin/X11 on tyche # df -k
Filesystem 1024-blocks Used Available Capacity Mounted on
root_domain#root 153600 123235 24408 84% /
/proc 0 0 0 100% /proc
usr_domain#usr 1177600 566043 513040 53% /usr
disk7a#all 1047736 99707 941592 10% /var

/ on tyche # showfdmn root_domain
                                                                          
               Id Date Created LogPgs Version Domain Name
3a1426d0.0000d1b0 Thu Nov 16 13:26:24 2000 512 4 root_domain
                                                                          
  Vol 512-Blks Free % Used Cmode Rblks Wblks Vol Name
   1L 307200 48816 84% on 128 128 /dev/disk/dsk6a

/ on tyche # addvol /dev/disk/dsk7a root_domain

This will roll dsk7a into the domain.

/ on tyche # rmvol /dev/disk/dsk6a root_domain

This will roll dsk6a out of the domain.

Follow the same method for any other filesystems, reconfig SWAP, reboot, and
you should be able to pop the drive out without causing a problem.

Douglas L. Thomas
=======================
no need for LSM lic to mirror root drive - included in os. Just use
volencap, and volrootmir (look at the man pages. Make sure that the
didklabel partitions of both are the same size.

Ohad



This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 10:48:43 EDT