Thanks to everyone who replied! Many useful scripts and tips but as usual
(what I like about this list) I got more information than necessary! NOT
a complaint at all.
Really what I was concerned with is if I use 'dd' to dump the disk to a
file, will it require the 'bs=xxxxx' argument? I'd rather not waste a
disk to retain a copy of this OS installation because it may never be used.
We're keeping some form of the install (preferably in a file) because it's
an environment that an old version of our software was built on and just in
case we need to make an emergency patch for a big customer that hasn't
upgraded to our latest software, we'll need the environment again.
I am going to test it to make sure but 'dd' the whole disk (slice #2) to a
file with no 'bs' argument and restore it to an identical disk and see if
the system boots okay (partition table identical of course). If it works,
I'll post another summary stating so.
Individual answers listed below! Thanks again!
-Steve
My original question:
>
>I know this question had been asked before because I found it in the
>archives at:
>
>http://scorpion.latech.edu/cgi-bin/SFgate?language=English&verbose=0&listenv=DL&application
>&convert=Mail&converthl=&refinequery=&formintern=&formextern
>
=&multiple=0&descriptor=scorpion.latech.edu%2fsun-managers-summary%7c398%7c2506%7cJose%20Luis>%20Delgado%20%3cj%20SUMMARY:%20Cloning%20a%20disk%21%21%7cTEXT%7cscorpion:210%7c%2finfo%2fwai>s%2findexes%2fsun-managers-summary%7c242446%20244952%20%2finfo%2fwais%2fdata%2fsun-managers%2>f%2fsum.09.97>Question is: I need to dump the contents of a system disk into a file or
>to a disk of the same exact type. I know to use the 'dd' command because
>it will copy the boot block (as 'ufsdump' will not). Using 'dd' with
>slice #2 - representing cylinder 0 to the very last - will give me the
>whole disk. Do I need to specify a block size? I am a little confused
>with the message at the URL listed above because is specifies a 'bs=1008b'
>argument and I cannot figure out why. I am concerned about this because
>it's a Solaris 2.4 system that I don't have the OS install disk for so if
I
>destroy the boot block I am screwed!
Answers: Thanks to all!
*******************************************************************************************
"David Evans" <DJEVANS@au.oracle.com> on 10/04/99 08:36:35 PM
To: sgauthier@domainpharma.com
cc:
Subject: Re: duplicating a disk
Steve,
A good question. The answer is no, you don't need to specify the block
size. Block size is useful when converting between systems or optimising
the backup time but if you don't know what it is when you restore your
in trouble. So don't use the block size unless you need to.
Regards,
David Evans
*******************************************************************************************
"Kenneth D. Tobin" <kentobin@pacbell.net> on 10/04/99 10:13:11 PM
To: SGauthier@domainpharma.com
cc:
Subject: RE: duplicating a disk
dd has caused me more grief than ufsdump. just learn how to use
installboot.
this is from solaris 2.5 man page but 2.4 should be the same. try it a
couple of times to get confident with the command, use a spare disk though.
good luck.
----------------------------------------------------------------------------
----installboot - install bootblocks in a disk partition ----------------------------------------------------------------------------
----
SPARC SYNOPSIS installboot bootblk raw-disk-device x86 SYNOPSIS installboot pboot bootblk raw-disk-device AVAILABILITY SUNWcsu
DESCRIPTION The boot.1m program is loaded from disk by the bootblock program which resides in the boot area of a disk partition.
bootblk is the name of the bootblock code. raw-disk-device is the name of the disk device onto which the bootblock code is to be installed; it must be a character device which is readable and writable. Naming conventions for a SCSI or IPI drive are c?t?d?s? and c?d?s? for an IDE drive. pboot is the name of the partition boot file.
The ufs boot objects are platform-dependent, and reside in the /usr/platform/platform-name/lib/fs/ufs directory. The platform name can be found using the -i option of uname.1
SPARC EXAMPLES To install a ufs bootblock on slice 0 of target 0 on controller 1, of the platform where the command is being run, use:
example# installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk \ /dev/rdsk/c1t0d0s0
x86 EXAMPLES To install the ufs bootblock and partition boot program on slice 2 of target 0 on controller 1, of the platform where the command is being run, use:
example# installboot /usr/platform/`uname -i`/lib/fs/ufs/pboot \ /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c1t0d0s2
SEE ALSO od.1 uname.1 boot.1m init.1m kadb.1m kernel.1m reboot.1m rpc.bootparamd.1m init.d.4
SPARC only monitor.1m
x86 only fmthard.1m fdisk.1m WARNINGS installboot will fail if the bootblk or pboot files don't exist or if the raw disk device isn't a character device.
*******************************************************************************************
pnjoyce@totacc.com (Pete and Nancy Joyce) on 10/04/99 10:49:14 PM
To: SGauthier@domainpharma.com cc: Subject: Re: duplicating a disk
Hello,
We have found that the fastest method to do this is to do a /etc/prtvtoc on each drive and multiply the (bytes per block size) by the (blocks per sector) by the (sectors per cylinder) -- (you end up with bytes per cylinder). If these are the same then
/etc/prtvtoc /dev/dsk/c0t0d0s2 cd /dev/rdsk dd if=c0t0d0s2 of=c0t1d0s2 bs=1352192 &
If the numbers are different, or the disks are really large, you will probably need to use a smaller number than the blocks per cylinder (we have had 9GB disk dds fail). Try 512000 if it does not work the first time, or if the geometry is different.
We run the dd in the background so that we can dd multiple disks as single user.
The 1352192 is the number for a Micropolis 4.3 GB drive. We always do this as single user, no partitions other than root mounted. Best of luck, Pete
*******************************************************************************************
Carlo Cosolo <ccosolo@home.com>@home.com on 10/04/99 11:35:18 PM
Sent by: ccosolo@home.com
To: SGauthier@domainpharma.com cc: Subject: Disk Duplicate
Steve
Try this script. I run it through cron on some of my machines every night. The duplicate can be booted from the ok prompt with a devalias. Make sure that you make a /dup_0 directory on your source disk and add or delete the newfs lines to match the slices on your source.
Carlo #!/bin/sh echo "Copying boot disk into its alternate"
prtvtoc /dev/rdsk/srcs2 > /tmp/vtoc fmthard -s /tmp/vtoc /dev/rdsk/dests2 installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/dests0 for fs in /dev/dsk/dests0 /dev/dsk/dests6 /dev/dsk/dests3 /dev/dsk/dests5 /dev/dsk/dests7 /dev/dsk/dests4 do case $fs in /dev/dsk/dests0 ) newfs $fs < /dev/null;mount $fs /dup_0;ufsdump 0f - /dev/dsk/srcs0|(cd /dup_0;ufsrestore rf - );sed 's/src/dest/g' /etc/vfstab > /dup_0/etc/vfstab;rm /dup_0/admin/dup_0.sh;umount /dup_0 ;; /dev/dsk/dests6 ) newfs $fs < /dev/null;mount $fs /dup_0;ufsdump 0f - /dev/dsk/srcs6|(cd /dup_0;ufsrestore rf -);umount /dup_0 ;; /dev/dsk/dests3 ) newfs $fs < /dev/null;mount $fs /dup_0;ufsdump 0f - /dev/dsk/srcs3|(cd /dup_0;ufsrestore rf -);umount /dup_0 ;; /dev/dsk/dests5 ) newfs $fs < /dev/null;mount $fs /dup_0;ufsdump 0f - /dev/dsk/srcs5|(cd /dup_0;ufsrestore rf -);umount /dup_0 ;; /dev/dsk/dests7 ) newfs $fs < /dev/null;mount $fs /dup_0;ufsdump 0f - /dev/dsk/srcs7|(cd /dup_0;ufsrestore rf -);umount /dup_0 ;; /dev/dsk/dests4 ) newfs $fs < /dev/null;mount $fs /dup_0;ufsdump 0f - /dev/dsk/srcs4|(cd /dup_0;ufsrestore rf -);umount /dup_0 ;; esac done # # # In This Template replace src with The source device eg. c0t0d0 and replace dest with the destination device eg. c0t1d0 # #
*******************************************************************************************
Steve_Turgeon@putnaminv.com on 10/05/99 05:45:42 AM
To: SGauthier@domainpharma.com cc: Subject: Re: duplicating a disk
I use ufsdump.
boot disk is c0t0d0s0
copy disk is c0t1d0s0
disks do not have to be the same type geometry or formatted the same (i.e. root partition can be 2 gb on the new disk instead of 1 gb on the old)
ufsdump 0f /<your choice>/root.dump /dev/dsk/c0t0d0s0
newfs /dev/rdsk/c0t1d0s0
mount /dev/dsk/c0t0d0s0 /a
cd /a
ufsrestore rf /<your choice>/root.dump
installboot /a/usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c0t1d0s0
and you are done.......
Steve
*******************************************************************************************
David Mitchell <davem@fdgroup.co.uk> on 10/05/99 06:19:52 AM
Please respond to David Mitchell <davem@fdgroup.co.uk>
To: SGauthier@domainpharma.com cc: Subject: Re: duplicating a disk
> I am a little confused > with the message at the URL listed above because is specifies a 'bs=1008b'Whwn doing disk to disk copies, the block size is mosly irrelvant, as long as it is a multiple of 512 bytes (ie 1b). Larger-ish numbers make it go faster.
*******************************************************************************************
wmd <William.M.Drazkowski@cdc.com> on 10/05/99 08:52:22 AM
Please respond to wmd <William.M.Drazkowski@cdc.com>
To: SGauthier@domainpharma.com cc: Subject: Re: duplicating a disk
Steve,
Here is a good procedure: Procedure to duplicate a system disk on a Solaris 2.x system -
1. Format the disk so that the partition is what you want.
a. format b. select the system disk, usually target 3. c. partition d. print e. quit
Do the same thing for the new disk let's call it as target 1.
a. format b. select the newdisk d. partition e. modify f. make sure partition 0, 5, 6 has enough space. g. write h. quit
2. create a new file system on new partition 0 -
newfs /dev/rdsk/c0t1d0s0 and answer yes
3. mkdir /newdisk0
4. mount /dev/dsk/c0t1d0s0 /newdisk0
5. cd /
6. ufsdump 0f - / | ( cd /newdisk0; ufsrestore rf -)
7. uname -m to see the platform
8. cd /usr/platform/sun4m/lib/fs/ufs If on a SPARC workstation
cd /usr/platform If on a X86 workstation
9. installboot bootblk /dev/rdsk/c0t1d0s0 If on a SPARC workstation
If on a X86 workstation, do the following: To install the ufs bootblock and partition boot program on slice 2 of target 0 on controller 1 of the platform where the command is being run, use:
example# installboot /usr/platform/`uname -i`/lib/fs/ufs/pboot \ /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c1t0d0s2
10. Create a new file system on partition 6 for /usr
newfs /dev/rdsk/c0t1d0s6 and answer yes
11. mkdir /newdisk6
12. mount /dev/dsk/c0t1d0s6 /newdisk6
13. ufsdump 0f - /usr | (cd /newdisk6; ufsrestore rf -)
14. Perform step 10 - 13 for partition 5 and restore /opt
15. Change the /etc/vfstab entry on /newdisk to match the new disk location. ie c0t2d0sx for the partition entries and mount points.
16. reboot -- disk1
Best Regards,
Draz
*******************************************************************************************
Dan Brown <brown@obscure.org> on 10/05/99 08:47:15 AM
To: SGauthier@domainpharma.com cc: Subject: Re: duplicating a disk
As long as you have another bootable disk, you should be fine. The boot block should be hidden under /usr/platform/...
See the man page for installboot
Dan Brown brown@obscure.org
*******************************************************************************************
"MARK ZANDER" <mzander@newbridge.com> on 10/05/99 10:02:09 AM
To: SGauthier@domainpharma.com cc: Subject: Re: duplicating a disk
Steve, Well I couldn't follow the link you gave but here is how I have copied disks in the past.
This was done with Solaris 2.5.1 and it does not matter if the disk sizes are the same. As long as the destination slice is larger than the source slice you will be fine.
newfs /dev/rdsk/c0t1d0s0 #slice must have a blank valid filesystem mount /dev/dsk/c0t1d0s0 /mnt #mount slice to be copied to(destination) ufsdump 0f - / | (cd /mnt; ufsrestore xf - ) #copy / (root) slice to destination slice) umount /mnt #repeat for all your slices
>From the 'installboot' man page this will create a new boot block on the specified disk. installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk \ /dev/rdsk/c1t0d0s0
Unfortunately, I have not been able to automate this process. For some reason 'newfs' does not like to be controlled via 'expect' and always dies.
later. mark.
*******************************************************************************************
\\|// (0~0) ------------------------oooO-(_)-Oooo----------------------------- Steve Gauthier Domain Pharma Corporation UNIX Systems Administrator 10 Maguire Road PHONE: (781) 778 - 3953 Lexington, MA 02421 FAX: (781) 778 - 3800 E-mail: sgauthier@domainpharma.com ______________________________Oooo._______________________________ .oooO (___)
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:13:26 CDT