[SunRescue] best way to copy data between partitions

Don Varner rescue at sunhelp.org
Tue Mar 6 20:59:52 CST 2001


Bill,

Here's what I use to copy to a new drive of the
same size and geometry.    Before using dd make
SURE you know which disk you're wanting to copy
or you'll end up with TWO fresh clean disks.   ;^)
This example assumes c0t0d0  is the source and
c0t1d0 is the target.

- prtvtoc /dev/rdsk/c0t0d0s2 > /drive0.vtoc
- fmthard -s /drive0.vtoc /dev/rdsk/c0t1d0s2
- dd if=/dev/rdsk/c0t0d0s2 of=/dev/rdsk/c0t1d0s2 bs=128b


That's the easy way.  If you don't have identical disks,
follow these steps.

Let's say you have an existing three partition disk
with root, usr and var.  The drive is c0t0d0 with
root at s0,  usr at s3 and var at s5 and you want
the new disk to also have three partitions.  The new
disk is at c0t1d0.

-Partition and label the new disk using format.
    Don't forget a swap partition.

Create file systems
-  newfs /dev/rdsk/c0t1d0s0  (Also s3 & s5)

- mkdir /newroot /newusr /newvar
- mount /dev/dsk/c0t1d0s0 /newroot
- mount /dev/dsk/c0t1d0s3 /newusr
- mount /dev/dsk/c0t1d0s5 /newvar

  - cd /tmp
  - ufsdump 0f - / | (cd /newroot; ufsrestore -rf -)
  - ufsdump 0f - /usr | (cd /newusr; ufsrestore -rf -)
  - ufsdump 0f - /var | (cd /newvar; ufsrestore -rf -)

  - installboot  bootblk  /dev/rdsk/c0t1d0s0

No need to edit vfstab if you change the target address
on the new disk before booting.

Good luck,
Don


Bill Bradford wrote:

> What's the suggested "best practices" way to move system partitions
> from one (failing) disk to another?  I dont want to have to ufsdump to
> tape then restore back; I'll have both drives online at once so I can
> just copy from one partition to another, installboot on the new /,
> edit /etc/vfstab accordingly, power down, remove old disk, and reboot
> with new....
>
> Bill (done this beofre, but I used tape as an intermediary step that
> time..)






More information about the rescue mailing list