Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to clone disk 1

Status
Not open for further replies.

sunny1504

Technical User
Nov 30, 2005
77
US
MachineA --- Sun-Fire-V210
----------------
c1t0d0 (HDD1) (146G)
||
||
c1t1d0 (HDD2)(146G)
----------------


MachineB --- Sun-Fire-V210
----------------
c1t1d0(HDD3)
----------------

Currently on 'machine A' below mentioned slices are available.
/dev/md/dsk/d0 (/)
/dev/md/dsk/d1 (swap)
/dev/md/dsk/d2 (/export/home)
/dev/rdsk/c1t0d0s4 --- used for metadatabase replica.
/dev/rdsk/c1t0d0s5 --- used for metadatabase replica.
/dev/rdsk/c1t0d0s6 --- used for metadatabase replica.

# metastat -p
d2 -m d25 d26 1
d25 1 1 c1t0d0s7
d26 1 1 c1t1d0s7
d1 -m d23 d24 1
d23 1 1 c1t0d0s1
d24 1 1 c1t1d0s1
d0 -m d21 d22 1
d21 1 1 c1t0d0s0
d22 1 1 c1t1d0s0

# metadb
flags first blk block count
a m p luo 16 8192 /dev/dsk/c1t0d0s4
a p luo 16 8192 /dev/dsk/c1t0d0s5
a p luo 16 8192 /dev/dsk/c1t0d0s6
a p luo 16 8192 /dev/dsk/c1t1d0s4
a p luo 16 8192 /dev/dsk/c1t1d0s5
a p luo 16 8192 /dev/dsk/c1t1d0s6


I would like to replace HDD2 on machineA with HDD3 of MachineB so that I can clone hdd3 as hdd1.

Now
c1t0d0 (HDD1)
||
||
c1t1d0 (HDD3) ------> we have replace hdd2 with hdd3, where hdd3 needs to be cloned.

Below are the steps which I will perform

Boot in single user mode..

step 1)
#cp /etc/system /etc/system.orig.raid

2)
Edit the /etc/system file and add "set md:mirrored_root_flag=1" to the last line.

3)
#/usr/sbin/prtvtoc /dev/rdsk/c1t0d0s2 | fmthard -s - /dev/rdsk/c1t1d0s2

4)
#newfs -v /dev/rdsk/c1t1d0s0
#newfs -v /dev/rdsk/c1t1d0s1
#newfs -v /dev/rdsk/c1t1d0s4
#newfs -v /dev/rdsk/c1t1d0s5
#newfs -v /dev/rdsk/c1t1d0s6
#newfs -v /dev/rdsk/c1t1d0s7

5)
Next reboot the system in multiuser mode init 3 or ctrl + d

6)
metareplace -e d0 c1t1d0s0
wait for the sync
metareplace -e d1 c1t1d0s1
wait for the sync
metareplace -e d2 c1t1d0s7
wait for the sync

After restoring HDD2 in place will mirror work fine between HDD1 and HDD2? (Here we have not deleted any of the metastat replica).

The current system is production server and I am worried if the above steps wont do any harm.

Can some one suggest whether the above step will work fine.


Thanks
D'Souza
 
Can someone suggest on the above steps..

Thanks
 
I missed one step it should be

7)
#installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c1t1d0s0

 
Also will I have to delete the below mentioned replica which were on the hdd2 and then attach hdd3

/dev/dsk/c1t1d0s4
/dev/dsk/c1t1d0s5
/dev/dsk/c1t1d0s6

Thanks
Sunil D'Souza
 
yep Sunil,

this will *cross fingers* work, but it is nor recommended by Sun to do this, since your machine B may recognize the hardware other than machine A.
Your bootdisk is c1t0d0s0 on machine A, it might be c0t0d0s0 on machine B...

If the host won't boot try this workaround: move /etc/path_to_inst to another name, move /dev and /devices to other names and boot host with "boot -as" a=ask s=singeuser

BTW: you can drop
#newfs -v /dev/rdsk/c1t1d0s4
#newfs -v /dev/rdsk/c1t1d0s5
#newfs -v /dev/rdsk/c1t1d0s6
since metadb's are on raw partitions; btw you can add more than one metadb on one slice using eg.

root# metadb -a -c 3 /dev/rdsk/c1t1d0s5

Best Regards, Franz
--
Solaris System Manager from Munich, Germany
I used to work for Sun Microsystems Support (EMEA) for 5 years in the domain of the OS, Backup and Storage
 
btw doublecheck thread60-1182123
it's more or less the same...

Best Regards, Franz
--
Solaris System Manager from Munich, Germany
I used to work for Sun Microsystems Support (EMEA) for 5 years in the domain of the OS, Backup and Storage
 
aehm, just saw, it's you... :D

Best Regards, Franz
--
Solaris System Manager from Munich, Germany
I used to work for Sun Microsystems Support (EMEA) for 5 years in the domain of the OS, Backup and Storage
 
DaFranze,

------------------------------------------------------
BTW: you can drop
#newfs -v /dev/rdsk/c1t1d0s4
#newfs -v /dev/rdsk/c1t1d0s5
#newfs -v /dev/rdsk/c1t1d0s6
since metadb's are on raw partitions; btw you can add more than one metadb on one slice using.
------------------------------------------------------

I guess I assumed then that we need to first create filesystem and then add metadb's on it.

Will creating filesystem and then adding metadb's create problem in future.



Thanks
Sunil D'Souza
 
I see, but, you will not need a Filesystem on this slice. SDS 4.2 (afaik) allowes to create a metadb in a large metadevice, but this is very confusing and I never saw somebody using this...

Best Regards, Franz
--
Solaris System Manager from Munich, Germany
I used to work for Sun Microsystems Support (EMEA) for 5 years in the domain of the OS, Backup and Storage
 
If this a exact disk size and you want to mirror disk, I partition exactly like the orginal disk to be mirrored with prtvtoc:

prtvtoc /dev/rdsk/<orginaldisk slice2> | fmthard -s - /dev/rdsk/< new disk slice2>

then I recreate the meta devices of the new disk and finally
metattach the new md devices and watch them sync up.

I use the below website as reference. good luck !


 
also don't forget to recreate the meta database on the new drive as well.
 
What if I want to break the mirror and then rebuilt again with the new disk2.

*******************************************************
d0: Mirror
Submirror 0: d21
State: Okay
Submirror 1: d22
State: Okay
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 9748608 blocks (4.6 GB)
d21: Submirror of d0
State: Okay
Size: 9748608 blocks (4.6 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c1t0d0s0 0 No Okay Yes

d22: Submirror of d0
State: Okay
Size: 9748608 blocks (4.6 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c1t1d0s0 0 No Okay Yes


*******************************************************
d1: Mirror
Submirror 0: d23
State: Okay
Submirror 1: d24
State: Okay
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 16586880 blocks (7.9 GB)

d23: Submirror of d1
State: Okay
Size: 16586880 blocks (7.9 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c1t0d0s1 0 No Okay Yes

d24: Submirror of d1
State: Okay
Size: 16586880 blocks (7.9 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c1t1d0s1 0 No Okay Yes

*******************************************************
bash-2.05# metastat -p
d2 -m d25 d26 1
d25 1 1 c1t0d0s7
d26 1 1 c1t1d0s7
d1 -m d23 d24 1
d23 1 1 c1t0d0s1
d24 1 1 c1t1d0s1
d0 -m d21 d22 1
d21 1 1 c1t0d0s0
d22 1 1 c1t1d0s0




#cp /etc/system /etc/system.org.raid
#echo "set md:mirrored_root_flag=1" >> /etc/system
#touch /reconfigure

Below mentioned step will break the mirror on sii-solaris01
#metadetach d0 d22
#metaclear -f d22

#metadetach d1 d24
#metaclear -f d24

#metadetach d2 d26
#metaclear -f d26

WILL THE ABOVE LINE GIVE ME ANY PROBLEM?

Shutdown the server replace HDD2 with HDD3 and restart.
Once system is up verify whether HDD3 is detected.

#prtvtoc /dev/rdsk/c1t0d0s2 | fmthard -s - /dev/rdsk/c1t1d0s2
#newfs -v /dev/rdsk/c1t1d0s0
#newfs -v /dev/rdsk/c1t1d0s1
#newfs -v /dev/rdsk/c1t1d0s4
#newfs -v /dev/rdsk/c1t1d0s5
#newfs -v /dev/rdsk/c1t1d0s6
#newfs -v /dev/rdsk/c1t1d0s7

Preparing for sync.
#metainit d22 1 1 /dev/dsk/c1t1d0s0
#metainit d24 1 1 /dev/dsk/c1t1d0s1
#metainit d26 1 1 /dev/dsk/c1t1d0s7

#metattach d2 d26
Wait for the resync

#metattach d0 d22
Wait for the resync

#metattach d1 d24
Wait for the resync

After the above step do 'metastat' to see if the filesystem has resynced.





Can someone suggest on the above method.
 
daFranz already said that you don't need to create filesystems. The filesystems will be copied across from the other disk.

Why are you doing this?

[tt]#cp /etc/system /etc/system.org.raid
#echo "set md:mirrored_root_flag=1" >> /etc/system[/tt]

If your root disk is already mirrored you shouldn't have to do this again.

Annihilannic.
 
I am trying to replace the second hard drive with new one so that I can clone the second new drive.
Thats the reson I am adding the line set md:mirrored_root_flag=1 so that the system comes up fine with half the metadevice.

I want to break the metadevice for the old one and then add new will the above step work.

Thanks
 
You don't need to do that. A metadevice is a metadevice, regardless of how many copies/mirrors there are, 1, 2, 4, etc...

Annihilannic.
 
The V210 has hot-swappable drives, so you don't have to shutdown to replace a drive.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top