The solution was to zero the disk first (disklabel -z) of the copy-to-drive.
After that dd went fine.
Thank you for all the responses!
Aaron
From: Jean Dubois <j_dubois_at_analog.ca>
Subject: Re: cloning drives for OSF 3.2
Aaron,
We use this procedure all the time to clone 3.2A or 3.2C disks. The
important thing
to do before you start your DD is to zap the destination label (disklabel -z
rz??).
Of course you can only use identical disks to do this because the label is
copied over.
If you need to clone different disks, making new file system and piping a
VDUMP to
a VRESTORE works good (see the vrestore man page).
P.S.: Using a bs-1024k on the dd will save you a lot of time
Have fun,
/jean
----------------------------------------------------------------------------
-----------
From: Larry Church <lchurch_at_postman.ncube.com>
use dump/restore (or vdump/vrestore). see the (v)restore man page...
.
.
.
RESTORE(8) MAINTENANCE COMMANDS RESTORE(8)
f dump-file
Use dump-file instead of /dev/rmt? as the file to
restore from. If dump-file is specified as `-',
restore reads from the standard input. This allows,
dump(8) and restore to be used in a pipeline to dump
and restore a file system:
example# dump 0f - /dev/rxy0g | (cd /mnt; restore xf
-)
If the name of the file is of the form machine:device
the restore is done from the specified machine over the
network using rmt(8C). Since restore is normally run
by root, the name of the local machine must appear in
the .rhosts file of the remote machine. If the file is
specified as user_at_machine:device, restore will attempt
to execute as the specified user on the remote machine.
The specified user must have a .rhosts file on the
remote machine that allows root from the local machine.
.
.
.
This is from a sunos man page, DU is similar
larry
ID </afs/andrew.cmu.edu/usr20/ar2h/Mailbox/okxOzlW00UddNZLU5A>;
From: Dan Stromberg - OAC-DCS <strombrg_at_hydra.acs.uci.edu>
You might try seeking past the bootblock, before starting to write.
Might be able to do this with "skip" on dd, might have to write a
little C/perl/python/&c.
In message <AkxLLUK00YUq8dqF9X_at_andrew.cmu.edu>you write:
>Here is the situation that I am in at the present time:
>
>I have a system up and running with OSF 3.2 on it. I tried to clone another
>disk off this one by using dd. dd comes back with an error saying that
>the first block is read-only (my guess is the boot block). When I take the
>cloned disk to another machine it runs throught the initialization but will
>not boot. Could somebody tell me another way in which I can clone the two
>drives, and/or point out my mistake in the previous way that I did it. Sorry,
>about the choppy English.
>
>Thank you,
>A. Riccitelli
>
>
Dan Stromberg - OAC/DCS strombrg_at_uci.edu
Return-path: <sarasin_at_yosemite.cop.dec.com>
From: sarasin_at_yosemite.cop.dec.com
Subject: Re: cloning drives for OSF 3.2
In-Reply-To: Your message of "Thu, 11 Jan 96 15:41:04 EST."
<AkxLLUK00YUq8dqF9X_at_andrew.cmu.edu>
Date: Fri, 12 Jan 96 02:52:44 -0500
Hello,
Yeu need to use disklabel -z to clear the disklabel on the target drive
before you run dd to do a disk clone. If the target disk has a disklabel
block zero is write protected. Here is an example of how to use dd to clone
rz0 to rz1. Note that the clone will get a new disklabel from the source
drive.
disklabel -z /dev/rrz1c
dd if=/dev/rrz0c of=/dev/rrz1c bs=512k
I just used the above to clone 65 4gig disks with no problems. It took
~20min per disk.
Hope this is of help,
Sam Sarasin
From: Jon Buchanan <Jonathan.Buchanan_at_ska.com>
Subject: Re: cloning drives for OSF 3.2
<AkxLLUK00YUq8dqF9X_at_andrew.cmu.edu>
Date: Fri, 12 Jan 96 11:47:58 +0100
Hello Aaron,
I would use dump / restore to clone. In fact, the following script will do the
whole job for you. Hope the comments are explicit enough.
Regards,
Jon Buchanan, Zuerich, Switzerland
[ Jonathan.Buchanan_at_ska.com ]
#!/sbin/sh
# Backup / and /usr partitions to reserve partitions. Best to run in
# single user mode.
# IMPORTANT! Make sure the reserve disk is labelled first!
#
# The procedure looks for root2 and usr2 partitions in /etc/fstab, which
# may be either uncommented OR COMMENTED entries. Entries which are
# uncommented take priority over commented entries; for multiple commented
# entries, the last takes priority over the first.
#
# If found, the reserve partitions are unmounted if mounted, then
# re-initialised using newfs. The copy is done using dump, and a fsck
# performed.
#
# After copying the partitions, /root2 is mounted. /root2/etc/fstab,
# /root2/etc/rc.config, and /root2/sbin/swapdefault (if present) are then
# automatically edited in order to allow root2 to be used for booting the
# machine if required.
#
# J R Buchanan 12/4/94
# Look for entries in fstab for root2 and usr2
# root2: look for uncommented entry first
# Tag on X to result in case a null string is returned
root2_dev=`grep -v "^#" /etc/fstab | awk '$2=="/root2" {print $1}'`X
# If no entry found, look for commented entry
[ "$root2_dev" = "X" ] && \
root2_dev=`awk '$2=="/root2" {print $1}' /etc/fstab | \
# Only interested in last line if many commented entries
tail -1 | \
# A commented line may have more than one # at the start, so pipe result into
# another awk and print last field using # as separator
awk -F\# '{print $NF}'`X
# If no entry for /root2 found, complain and exit
[ "$root2_dev" = "X" ] && { echo "/root2 not found in /etc/fstab"; exit; }
# Now look for /usr2 in the same way:
usr2_dev=`grep -v "^#" /etc/fstab | awk '$2=="/usr2" {print $1}'`X
# If no entry found, look for commented entry
[ "$usr2_dev" = "X" ] && \
usr2_dev=`awk '$2=="/usr2" {print $1}' /etc/fstab | \
tail -1 | \
awk -F\# '{print $NF}'`X
# If no entry for /usr2 found, complain and exit
[ "$usr2_dev" = "X" ] && { echo "/usr2 not found in /etc/fstab"; exit; }
# Strip the X off the end of the device names
root2_dev=`echo $root2_dev | sed 's/X$//'`
usr2_dev=`echo $usr2_dev | sed 's/X$//'`
# Also get raw device names
root2_raw=`echo $root2_dev | sed 's:/dev/rz:/dev/rrz:'`
usr2_raw=`echo $usr2_dev | sed 's:/dev/rz:/dev/rrz:'`
# Print what we found and sleep 30 secs to allow Ctrl/C to be pressed!
echo ""
echo " / will be copied onto $root2_dev (/root2),"
echo "/usr will be copied onto $usr2_dev (/usr2)"
echo ""
echo "You have 30 seconds to press Ctrl/C or switch off if you want to abort!"
sleep 30
echo "OK, here we go..."
echo ""
echo "/ /root2 $root2_dev $root2_raw\n/usr /usr2 $usr2_dev $usr2_raw" | \
# Loop for both filesystem / and /usr
while read fs res_fs dev raw
do
# Unmount the reserve partitions if they are mounted
[ `mount -e | grep -c "^$dev "` -eq 0 ] || {
echo "Unmounting $dev..."
umount -v $dev
[ $? = 0 ] || { echo "Unmount failed - aborting"; exit; }
}
echo "Re-initialising $res_fs ($dev) using newfs..."
newfs $raw
[ $? = 0 ] || { echo "newfs failed - aborting"; exit; }
echo "Mounting $res_fs..."
# Make the necessary mount-point directory if not there
[ -d $res_fs ] || mkdir $res_fs
mount -w -v -t ufs $dev $res_fs
[ $? = 0 ] || { echo "mount failed - aborting"; exit; }
echo "Dumping $fs to $res_fs"
dump -0 -b 64 -f - $fs | (cd $res_fs; restore -r -b 64 -f -)
echo "Unmounting $res_fs again..."
umount -v $res_fs
[ $? = 0 ] || { echo "umount failed - aborting"; exit; }
# Now do a fsck on the new copy
echo "Doing fsck on new $res_fs..."
fsck -p $raw
echo ""
done
# Mount /root2 again in order to edit some files
echo "Mounting /root2 again..."
mount -w -v -t ufs $root2_dev /root2
[ $? = 0 ] || { echo "mount failed - aborting"; exit; }
# Edit the copied version of /etc/fstab.
# The devices for / and /root2 need to switch, and also for /usr and /usr2.
# Keep a backup copy
cp /root2/etc/fstab /root2/etc/fstab.orig
# Get the present devices for / and /usr
root_dev=`mount -e | grep 'on / ' | awk '{print $1}'`
usr_dev=`mount -e | grep 'on /usr ' | awk '{print $1}'`
# Use stream editor to replace root_dev with DuMmY in copied fstab
echo "Editing /root2/etc/fstab:"
echo "switching devices for / and /root2, and /usr and /usr2..."
cat /root2/etc/fstab | sed "s;$root_dev;DuMmY;" | \
# ...and to replace root2_dev with root_dev
sed "s;$root2_dev;$root_dev;" > /tmp/fstab.tmp
# Now replace DuMmY with root2_dev
cat /tmp/fstab.tmp | sed "s;DuMmY;$root2_dev;" > /root2/etc/fstab
# Repeat for usr_dev and usr2_dev
cat /root2/etc/fstab | sed "s;$usr_dev;DuMmY;" | \
sed "s;$usr2_dev;$usr_dev;" > /tmp/fstab.tmp
cat /tmp/fstab.tmp | sed "s;DuMmY;$usr2_dev;" > /root2/etc/fstab
# If the swap space is on the same disk as the original / and /usr,
# and /root2 and /usr2 are also on the same disk as each other with
# the same partition letters as the original / and /usr, then assume
# the swap space will match too.
# Only bother thinking about it if fstab contains only one line with swap in it
if [ `grep -v "^#" /etc/fstab | grep -c swap` -ne 1 ]
then echo "More than 1 line referring to swap in /etc/fstab"
echo "Giving up on the changes for the swap partition"
else swap_dev=`grep -v "^#" /etc/fstab | grep swap | awk '{print $1}'`
# Strip off /dev/ from the device names before comparing them
root_dev=`echo $root_dev | cut -d/ -f3`
root2_dev=`echo $root2_dev | cut -d/ -f3`
usr_dev=`echo $usr_dev | cut -d/ -f3`
usr2_dev=`echo $usr2_dev | cut -d/ -f3`
swap_dev=`echo $swap_dev | cut -d/ -f3`
# Check partitions correspond, and in both cases / and /usr are on the same
# disk. Here we use a very crude comparison, using tr to delete the characters
# from one string which appear in the other string. This is by no means
# foolproof, but works quite well for typical OSF/1 device names like
# rz[0-9][a-g].
# (Indentation lost, sorry.)
if [ `echo $root_dev|tr -d "$root2_dev"`X = `echo $usr_dev|tr -d "$usr2_dev"`X -a
`echo $root_dev|tr -d "$usr_dev"`X = `echo $root2_dev|tr -d "$usr2_dev"`X ]
# Get the device numbers of the old and new disks if check went OK
then old_disk=`echo $root_dev|tr -d "$root2_dev"`
new_disk=`echo $root2_dev|tr -d "$root_dev"`
# Substitute old for new in swap device
new_swap=`echo $swap_dev | sed "s/$old_disk/$new_disk/"`
# For safety, check such a device exists and is not already in new /etc/fstab
if [ -b /dev/$new_swap -a `grep -c "^/dev/$new_swap" /root2/etc/fstab`
-eq 0 ]
then echo "changing swap partition..."
echo " (assuming backup swap partition is /dev/$new_swap)"
# Apply change to fstab
cat /root2/etc/fstab | \
sed "s;/dev/$swap_dev;/dev/$new_swap;" > /tmp/fstab.tmp
cp /tmp/fstab.tmp /root2/etc/fstab
# Now update rc.config, which defines the swap location
echo "Editing swap location in /root2/etc/rc.config..."
cp /root2/etc/rc.config /root2/etc/rc.config.orig
cat /root2/etc/rc.config | \
sed "s;$swap_dev;$new_swap;" > /tmp/rc.config.tmp
cp /tmp/rc.config.tmp /root2/etc/rc.config
# Also change symbolic link /root2/sbin/swapdefault, if present
[ -e /root2/sbin/swapdefault ] && \
{ echo "Updating /root2/sbin/swapdefault symbolic link..."
mv /root2/sbin/swapdefault /root2/sbin/swapdefault.orig
ln -s /dev/$new_swap /root2/sbin/swapdefault ;}
else echo "Can't work out where to put backup swap device, sorry"
fi
else echo "Can't work out where to put backup swap partition, sorry"
fi
fi
# Done the edits - display the changes
echo ""
echo "Differences between original /etc/fstab and new version as follows:"
diff /root2/etc/fstab.orig /root2/etc/fstab | more
echo ""
echo "Differences between original /etc/rc.config and new version as follows:"
diff /root2/etc/rc.config.orig /root2/etc/rc.config | more
[ -e /root2/sbin/swapdefault ] && \
{ echo ""
echo "/sbin/swapdefault symbolic links now as follows:"
ls -l /root2/sbin/swapdefault* ;}
echo ""
# All done, unmount /root2 again
echo "Unmounting /root2 again..."
umount -v /root2
echo "Finished"
Date: Tue, 16 Jan 1996 12:22:07 +0100
From: Hellebo Knut <Knut.Hellebo_at_nho.hydro.com>
Subject: Re: cloning drives for OSF 3.2
Regards,
Did you first try to initialize the clone by doing a 'disklabel' command on
it ? (see 'man disklabel').
--
******************************************************************
* Knut Helleboe | DAMN GOOD COFFEE !! *
* Norsk Hydro a.s | (and hot too) *
* Phone: +47 55 996870, Fax: +47 55 996342 | *
* Pager: +47 96 500718 | *
* E-mail: Knut.Hellebo_at_nho.hydro.com | Dale Cooper, FBI *
******************************************************************
From: Jim Neeland <neeland_at_madmax.hrl.hac.com>
Subject: Re: cloning drives for OSF 3.2
Cc: neeland_at_madmax.hrl.hac.com
Well, this may not be exactly what you want to do....
To duplicate a partition from one disk to another, such that the result is
also bootable, I do the following (my partitions are advfs, system is on
a 2100):
I have the same size partitions on both disks, but that shouldn't
matter as long as the target partition is big enough.
1.) Clear out target partion via:
umount /root1
rmfset root1_domain root1
mkfset root1_domain root1
mount /root1
2.) clone the the root filesystem for copying via:
clonefset root3_domain root3 root_clone
mount -r -t advfs root3_domain#root_clone /clone
3.) copy all of root3 onto root1 via:
#NOTE: while this is running (~1 minute) not much else will run
vdump -0f - /clone | vrestore -xf - -D /root1
4.) cleanup via:
umount /clone
rmfset root3_domain root_clone
Obviously the cloning, etc are not relevant for UFS filesystems,
but as I understand it, vdump can be used to do the copying between
filesystems.
I can then boot the new disk by changing the appropriate BOOT
flags at the console in monitor mode.
Jim Neeland
Hughes Research Labs
Date: Thu, 11 Jan 1996 18:15:21 -0500 (EST)
From: "Craig I. Hagan" <hagan_at_ttgi.com>
To: Aaron Todd Riccitelli <ar2h+_at_andrew.cmu.edu>
Subject: Re: cloning drives for OSF 3.2
get a PC and boot linux, use the linux dd with the raw scsi device.
-- craig
___ ____ __ Craig I. Hagan, Pencom System Administration
| _ \/ __/| \ Pencom Office: hagan_at_psa.pencom.com
| _/\__ \| \ \ At home: hagan_at_cih.com
|_|__/___/|_|__\ "True hackers don't die, their ttl expires"
________________________________________________________
Return-path: <alan_at_nabeth.cxo.dec.com>
From: alan_at_nabeth.cxo.dec.com
Subject: Re: cloning drives for OSF 3.2
Actually, it is the label that is not writeable. The
boot block is in the same neighborhood, bit may use
space after the label.
The correct boot block is file system dependent; Advfs
uses a different boot block from UFS. If the label was
not written to specifically use the correct one, then
part of it may have been wrong. You may be slightly
better off creating the file systems and then using
dump or vdump to backup and restore the data. For
UFS use newfs to create a file system for each file
to be moved and then:
# mount /dev/whatever /mnt
# dump 0f - / | ( cd /mnt ; restore rf - )
# umount /mnt
Then repeat for each file system on the disk to be moved.
For Advfs, use vdump and vrestore. The setup of the file
system will be different; mkdfmn and mkfset.
With dd(1) you have to worry about the label being writable,
copying the page/swap space that isn't used, getting the block
size right to copy all the data in the file system, etc.
Subject: Re: cloning drives for OSF 3.2
From: "Dave Golden" <golden_at_falcon.invincible.com>
You must zero the disklabel with the command:
disklabel -z /dev/rrzXc where "x" is the scsi id of the destination drive
then do the dd
I think this is in the dd man page.
Dave
--
Dave Golden golden_at_invincible.com
Invincible Technologies Corporation
Received on Tue Jan 16 1996 - 18:18:13 NZDT