not using dd

From: J.A. Gutierrez (spd@shiva.cps.unizar.es)
Date: Tue Mar 25 2003 - 05:29:32 EST


    Sorry for replying to the list, but since I'm adding questions
    more than giving answers...

On Mon, Mar 24, 2003 at 01:29:09PM -0600, Pappas, Bill wrote:
> I found a great script for cloning a disk, but I was wondering...is there a
> way to automate the cloning via crontab?
> Here is what I would like to see happen automatically....
> 1. From multiuser mode with networking (init 3) goto single user mode.
> 2. Mount the disks you need
> 3. Perform the clonedisk script shown at MY SCRIPT.
> 4. When dome with #3 go back to init 3
>
> The problem I am having is with step 1. As I dive into single user mode, my
> script is killed as are other processes.
> Therefoe, I never reach step 2
>
> Any suggestions on how I could automate this?

    I wouldn't use dd in the first place.
    I don't think you can easily automate nothing which requires
    single user. (well, maybe modifying inittab; but anyway,
    if you could hack it, single user won't make dd good for
    cloning the startup disk, since it is still mounted)

    I'd use dump/tar/cpio for that purpose; I have a script
    for linux and solaris; but I still don't know how to do
    some tasks:

    - Read partition table from original disk:

        SunOS: prtvtoc -h ${ORIG}2
        Linux: fdisk -ul $ORIG
        Tru64: disklabel -r ????

    - Create a new partition table

        SunOS: fmthard -s - ${RDEST}2
        Linux: sfdisk $DEST
        Tru64: disklabel -R ????
            (would "disklabel -r $ORIG | disklabel -R $DEST" work?)

    - Setting swap

        SunOS: not needed
        Linux: mkswap `fdisk -l $DEST | awk '/swap$/ {print $1}'`
        Tru64: not needed?

    - Creating boot loader

        SunOS: /usr/sbin/installboot \
               /usr/platform/`uname -i`/lib/fs/ufs/bootblk ${RDEST}0
        Linux: lilo -v -r /new/1 -b $DEST
        Tru64: ????

    Problems:
        I'm not sure about how advfs work; and in my script
        I need to mount the destination filesytems in order to
        copy contents.
        So, if I have, for instance:

        /dev/disk/dsk0a root_domain

        and I need to mount /dev/disk/dsk1a, I guess I should
        create a new domain (mkfdmn /dev/disk/dsk1a root_domain2)
        then a fileset (mkfset root_domain2 root)

        Question: this domain/fileset procedure will modify
        dsk1 or is just at OS level? i.e., if I physically
        disconnect dsk0 and boot from dsk1 (now dsk0), it's
        partitions will be part of "root_domain" or of "root_domain2" ?

        Once cloned, if I remove "root_domain2", dsk1a contents
        will be lost?

    BTW; you can find the script at
    http://giga.cps.unizar.es/~spd/src/system/do_mirror

    I'd like to add Tru64 support, but I'm not sure when I will be
    able to test it (I have a single DS10 host, and by now both
    disks are in use)

-- 
finger spd@shiva.cps.unizar.es for PGP      /
.mailcap tip of the day:                   /             La vida es una carcel
application/ms-tnef; cat '%s' > /dev/null /           con las puertas abiertas
text/x-vcard; cat '%s' > /dev/null       /            (A. Calamaro)


This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 10:49:13 EDT