[SPARCbook] How to Install/clone to a new hard drive

sunder sunder at sunder.net
Wed Oct 4 11:55:50 CDT 2000


Hey guys, I went to that thread and kicked myself for not checking email in a few days.  I know you've solved your problem, but
here's my two cents. :)

Basically the solution is simple.  You have to use the format command.  The first time you run format on a SCSI disk that has been
setup already for Pee Cee's, you'll have to do a destructive analysis.  So, run format, select the new disk, then type in format. 
This will do a low level scsi format and also check the media for errors which is always a good thing.

The dd if=/dev/zer0 stuff will work -- IF Solaris recognizes the drive.  Which it likely won't if the disk has been previously
partitioned for a Pee Cee or a Mac.  So again, "format format" is your friend. :)

Then, once "formatted" you can run the label command.

Then run installboot like this:

installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c?t?d?s0

For a quick clone - i.e. the two drives are of the same size, just copy slice two.  (If you run format, then select partition, then
print, you'll notice that slice two always starts at cylinder zero and ends at the end of the drive.  It's also tagged "Backup". 
This is so you can do an image backup of your disk to tape or another disk, which is what you'll want to do now.) 

Otherwise, you'll have to copy every single slice by hand.

i.e.:

dd if=/dev/c0t0d0s2 of=/dev/c0t3d0s2  and this should include the partition table as well as all the slices (but not the boot
block.)


So again:

#format
 {Select the disk}
 format
 {wait a few hours}
 label
 quit

#installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c?t?d?s0
#dd if=/dev/dsk/c0t0d0s2 of=/dev/dsk/c?t?d?s2 bs=512

Replace the question marks with the appropriate paths.  For those of you who don't know what this c0t0d0s0 business is all about, c0
stands for controller zero, t0 stands for target zero (i.e. scsi id zero) d0 stands for disk zero (this is the LUN of the disk, or
the logical unit number*), s0 stands for slice zero (aka partition zero.)

(* LUN's aren't used any more, except maybe for multi cd changers.  See back in the bad early days, when scsi was new, you could buy
a controller that would look like a scsi drive to a scsi controller, but would connect to one or more RLL or MFM disks.  You could
access the whole thing by the target ID, and access each individual disk inside it by it's LUN.  LUN's aren't used that much
anymore.)

(Actually, if you want it to go much faster, change the block size to something huge,
but a multiple of 512.  i.e. bs=65536 would do 64k chunks at a time.)  If you get errors, go back to something like 512 or 1024 or
2048, etc.  In the case of using a larget block size, what happens is that you're buffering more blocks in ram, so you can speed
things up a bit.


Now, you can't use dd if your drives are of different sizes!!!  If you want to keep some of the partititions the same, by all means,
you can create them with the format command.  Type in format, then parition and then select the slice by its number.  Type in the
sizes you need - these must match the existing ones.  Then you can dd each slice, one at a time.

If you're interested in having more free space on the new disk, say the disk is bigger, or have lots of free space on the old disk,
and want to use up a smaller partition, etc. you can use tar or ufsdump and ufsrestore.

The problem with tar is that it can cross mount points, so do this in single user mode, and mount each slice to say, /tmp/mnt1 and
mount the new slice on the target drive to /tmp/mnt2 then do this:

cd /tmp/mnt1; tar cpf - | (cd /tmp/mnt2; tar xpf -)

If you want to see the progress (this slows it down a lot, change the xpf - to xvpf -)


To use ufsdump (this is off the top of my head, so it might be a bit off)

cd /tmp/mnt1; ufsdump 0f- /dev/rdsk/c0t0d0s? | (cd /tmp/mnt2/; ufsrestore rf- )
                          ^^^^^^^^^^^^^^^^^^
                where this is the source fs

You can also play with cpio if you like it. :)

-- 
----------------------Kaos-Keraunos-Kybernetos---------------------------
 + ^ + :Surveillance cameras|Passwords are like underwear. You don't /|\
  \|/  :aren't security.  A |share them, you don't hang them on your/\|/\
<--*-->:camera won't stop a |monitor, or under your keyboard, you   \/|\/
  /|\  :masked killer, but  |don't email them, or put them on a web  \|/
 + v + :will violate privacy|site, and you must change them very often.
--------_sunder_ at _sunder_._net_------- http://www.sunder.net ------------





More information about the SPARCBook mailing list