Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have an old 73gb SAS SCSI drive, so I plugged in a new 73gb SAS SCSI and I want to clone everything from it to the new drive.. I want to clone SCSI hard drive SD20 to SD21. Is there an easy way to accomplish this in Solaris? I am a Red Hat Linux guy. I am not familiar with Solaris.

If this cannot be done, then I must clone that actual data on that drive..

When I run format I get this:

       0. c1t0d0 <SUN36G cyl 24620 alt 2 hd 27 sec 107>
          /pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w21000020378deaf4,0
       1. c1t1d0 <SUN36G cyl 24620 alt 2 hd 27 sec 107>
          /pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w21000004cf22de9f,0
       2. c2t5d0 <QUANTUM-ATLAS10K3_73_WLS-020W cyl 31014 alt 2 hd 8 sec 579>
          /pci@8,700000/scsi@6,1/sd@5,0
       3. c2t6d0 <QUANTUM-ATLAS10K3_73_WLS-020W cyl 31014 alt 2 hd 8 sec 579>
          /pci@8,700000/scsi@6,1/sd@6,0

I believe that 2 is the old drive (that I want to clone from) and 3 is the new drive (that I want to clone to)

When I look at the partition map (verify) for 2, I get:

Part      Tag    Flag     Cylinders         Size            Blocks
  0 unassigned    wm       0                0         (0/0/0)             0
  1 unassigned    wm       0                0         (0/0/0)             0
  2     backup    wu       0 - 31013       68.50GB    (31014/0/0) 143656848
  3 unassigned    wm       0                0         (0/0/0)             0
  4 unassigned    wm       0 - 11318       25.00GB    (11319/0/0)  52429608
  5 unassigned    wm   11319 - 31013       43.50GB    (19695/0/0)  91227240
  6 unassigned    wm       0                0         (0/0/0)             0
  7 unassigned    wm       0                0         (0/0/0)             0

When I look at the partition map (verify) for 3, I get:

Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm       0 -    56      128.92MB    (57/0/0)       264024
  1       swap    wu      57 -   113      128.92MB    (57/0/0)       264024
  2     backup    wu       0 - 31013       68.50GB    (31014/0/0) 143656848
  3 unassigned    wm       0                0         (0/0/0)             0
  4 unassigned    wm       0                0         (0/0/0)             0
  5 unassigned    wm       0                0         (0/0/0)             0
  6        usr    wm     114 - 31013       68.25GB    (30900/0/0) 143128800
  7 unassigned    wm       0                0         (0/0/0)             0

Output of df -k command:

Filesystem            kbytes    used   avail capacity  Mounted on
/dev/md/dsk/d1       5040814 2947078 2043328    60%    /
/proc                      0       0       0     0%    /proc
fd                         0       0       0     0%    /dev/fd
mnttab                     0       0       0     0%    /etc/mnttab
/dev/md/dsk/d3       5040814 1959374 3031032    40%    /var
swap                 6968984      24 6968960     1%    /var/run
swap                 6969040      80 6968960     1%    /tmp
/dev/md/dsk/d7       25815139 4844450 20712538    19%    /d001
/dev/md/dsk/d8       44918294 21617527 22851585    49%    /d002
/dev/md/dsk/d4       5040814 3897382 1093024    79%    /opt

I believe, based upon the partition map of 2 (above) that /d001 and /d002 are the only partitions mounted from the old disk (that I want to clone from).

If I cannot directly clone the hard drives than maybe I can create the partition map on 3 to be the same as 2 and copy data from /d001 and /d002 to the new drive, which leads me to my biggest question: HOW CAN I VERIFY THAT /d001 and /d002 are the ONLY THING MOUNTED FROM THE OLD DRIVE?!

share|improve this question
1  
Can you also provide the output of metastat, as you have DiskSuite metadevices there (the df output shows /dev/md devices). It may be that they are already mirrored in SDS. –  James O'Gorman Dec 21 '11 at 18:17
    
Thanks brother, here it is: simonleyton.com/willy/metastat_out.txt –  IT_Fixr Dec 21 '11 at 19:11
add comment

1 Answer 1

up vote 1 down vote accepted

For some reason, c2t5d0s4 (/d001) and c2t5d0s5 (/d002) are set up as one-way mirrors in SDS. Perhaps someone forgot to metattach another disk at some point?

To accomplish what you want, there are two methods.

Method 1

As you suggest, dd could be used. I would first verify that you don't need the data on c2t6d0s6 by mounting it and reviewing the filesystem contents.

mount /dev/dsk/c2t6d0s6 /mnt

You also have two small partitions at the start of the disk. Check with metadb that these aren't required by SDS. If they are listed and there are partitions on the other disks in the metadb, remove them:

metadb -d c2t6d0s0
metadb -d c2t6d0s1

Then you will be able to use dd to clone:

umount /d001
umount /d002
dd if=/dev/rdsk/c2t5d0 of=/dev/rdsk/c2t6d0

Method 2

As you already have SDS configured you can use this to complete the mirrors.

First you need to copy the partition table:

prtvtoc /dev/rdsk/c2t5d0s2 | fmthard -s - /dev/rdsk/c2t6d0s2

Then create metadevices:

metainit d72 1 1 c2t6d0s4
metainit d82 1 1 c2t6d0s5

Then attach these do the existing mirrors:

metattach d7 d72
metattach d8 d82

Warning: metadevice d71 already has errors logged against it by SDS and has been placed into maintenance. It might refuse to copy this partition.

Periodically check that the mirrors are syncing:

metastat

You'll get a progress next to each submirror that is rebuilding. The State: field will say Okay once rebuilding has finished.

Removing the old drive

Disconnect each partition that is mirrored.

metadetach d7 d71
metadetach d8 d81

I can't remember if Solaris 8 has cfgadm or not, but if it does, run:

cfgadm -al

to check which device you want to remove (probably c2::dsk/c2t5d0), then unconfigure it:

cfgadm -c unconfigure c2::dsk/c2t5d0

It will then be safe to remove it.

HOW CAN I VERIFY THAT /d001 and /d002 are the ONLY THING MOUNTED FROM THE OLD DRIVE?!

Simple: They're the only partitions on the disk. (Slice 2 is the whole disk, not an actual usable partition.)

share|improve this answer
    
Thank you so much! So, would this work?: simonleyton.com/willy/unixclone.txt –  IT_Fixr Dec 22 '11 at 0:37
    
Not quite - you don't need to unmount/remount /d001 and /d002 while re-mirroring. Also, while part of a mirror, you shouldn't mount the submirrors directly so you should continue to use d7 and d8. Once the clone has completed you can destroy the mirror, or just remove (metadetach) d71 and d81 from the mirrors. –  James O'Gorman Dec 22 '11 at 7:28
    
Now it is making more sense. Method 1 did not work, I will give feedback on it soon. Method 2 I am on step 2 of 3 (just finished metainit). 2 questions: 1) if I do step 3, what is my next step to remove the old drive. 2) Can I simply mount c2t6d0s4 and c2t6d0s5 and copy the data from /d001 and /d002? –  IT_Fixr Dec 22 '11 at 17:22
    
I went with Method 2, Since I want to end up with a Raid 1. How do I verify that the partition mirroring worked? How do I know when it is safe to disconnect the original drive. How do I go about doing that? –  IT_Fixr Dec 22 '11 at 18:51
    
Check the output of metastat to see the mirroring progress. All submirrors should say "State: Okay". To remove the old drive you need to use metadetach to disconnect the partitions from the mirrors. –  James O'Gorman Dec 23 '11 at 7:14
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.