From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Pappas, Bill" Newsgroups: gmane.os.tru64.managers Subject: using dd Date: Mon, 24 Mar 2003 13:29:09 -0600 Sender: tru64-unix-managers-owner@ornl.gov Message-ID: <4C53A11A9475D511826600034725155305FC8F69@sjmemexc1.stjude.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Trace: main.gmane.org 1048534180 18826 80.91.224.249 (24 Mar 2003 19:29:40 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 24 Mar 2003 19:29:40 +0000 (UTC) Original-X-From: tru64-unix-managers-owner-gotm-tru64-unix-managers=m.gmane.org@sws1.ctd.ornl.gov Mon Mar 24 20:29:38 2003 Return-path: Original-Received: from sws1.ctd.ornl.gov ([160.91.22.101]) by main.gmane.org with smtp (Exim 3.35 #1 (Debian)) id 18xXdZ-0004tB-00 for ; Mon, 24 Mar 2003 20:29:37 +0100 Original-Received: (qmail 6982 invoked by uid 5); 24 Mar 2003 19:29:31 -0000 Original-Followup-To: poster Precedence: bulk Original-Received: (qmail 6973 invoked by uid 49493); 24 Mar 2003 19:29:31 -0000 Original-Received: from Bill.Pappas@stjude.org by sws1 by uid 49491 with qmail-scanner-1.14 (clamscan: 0.54. spamassassin: 2.50-cvs. Clear:SA:0(-2.5/5.0):. Processed in 0.591435 secs); 24 Mar 2003 19:29:31 -0000 Original-Received: from unknown (HELO emroute1.cind.ornl.gov) (160.91.4.119) by 0 with SMTP; 24 Mar 2003 19:29:30 -0000 Original-Received: from emroute1.cind.ornl.gov (localhost [127.0.0.1]) by emroute1.cind.ornl.gov (PMDF V6.2 #30669) with ESMTP id <0HC9007RBQ52J1@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Mon, 24 Mar 2003 14:29:28 -0500 (EST) Original-Received: from gate2.stjude.org (gate2.stjude.org [192.55.208.12]) by emroute1.cind.ornl.gov (PMDF V6.2 #30669) with ESMTP id <0HC9001FOQ4RW8@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Mon, 24 Mar 2003 14:29:19 -0500 (EST) Original-Received: by gate2.stjude.org; (8.9.3/1.3/10May95) id NAA1154988; Mon, 24 Mar 2003 13:29:13 -0600 (CST) Original-Received: from somewhere by smtpxd Original-To: tru64-unix-managers@ornl.gov X-Mailer: Internet Mail Service (5.5.2653.19) Xref: main.gmane.org gmane.os.tru64.managers:3762 X-Report-Spam: http://spam.gmane.org/gmane.os.tru64.managers:3762 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? MY SCRIPT: #cat clonedisk.sh #!/bin/sh -x # #The may work only with disks using the same #geometry e.g the same models. # #1. initial steps # #- plug in the destination disk in the drive cage #- power on the machine #- with "show dev" you should see the master disk and the destination disk #- boot from the master disk # #2. the cloning # #- login and do the following # # hwmgr -view devices #(you should see both disks and the special-device files too) # # Here we begin: # # # Put the machine into single user mode and mount all disks init s echo "Wait for 60 seconds so that this machine can stop all related processes" sleep 60 mount -a sleep 4 # # # After booting in single-user (b -fl s) # make sure that the devicefiles for your destination disk # exists (ls -l /dev/rdisk) # echo "1 - modify root_domain usr_domain var_domain and home_domain" # cd /etc/fdmns/root_domain rm dsk6a ln -s /dev/disk/dsk5a . ls -l # cd /etc/fdmns/usr_domain rm dsk6b ln -s /dev/disk/dsk5b . ls -l # cd /etc/fdmns/var_domain/ rm dsk6g ln -s /dev/disk/dsk5g . ls -l # cd /etc/fdmns/home_domain/ rm dsk6h ln -s /dev/disk/dsk5h . ls -l # # # echo "modification correct? 5 seconds to go on! CTRL+C will break" sleep 5 echo "2 - clear the disklabel on the destination disk" disklabel -z /dev/rdisk/dsk5c sleep 2 echo "3 - clone the source disk to the destination disk" echo "this takes time ... please wait ..." sync ;sync dd if=/dev/rdisk/dsk6c of=/dev/rdisk/dsk5c bs=1024k echo "4 - resemble root_domain and usr_domain var_domain home_domain" # restore the old links! cd /etc/fdmns/root_domain rm dsk5a ln -s /dev/disk/dsk6a . # cd /etc/fdmns/usr_domain rm dsk5b ln -s /dev/disk/dsk6b . # cd /etc/fdmns/var_domain rm dsk5g ln -s /dev/disk/dsk6g . # cd /etc/fdmns/home_domain rm dsk5h ln -s /dev/disk/dsk6h . # sleep 2 echo "5 - Halt the system and boot from your cloned disk" echo "6 - run the script finishclonedd" init 3