Wednesday, May 20, 2009

Doing an SVM Raid on existing single partition

# Make sure both disks have the same partition layout and create slices for the replica database (2 cylinders)
# Check the disks and the layout
root@server:# format


# You can copy the vtoc from one disk to another with this.
# You can also copy the vtoc to/from a file
root@server:# prtvtoc /dev/rdsk/c?t?d?s? | fmthard -s - /dev/rdsk/c?t?d?s?

# For x86 machines set the active partition for the disks
root@server:# fdisk -b /usr/lib/fs/ufs/mboot /dev/rdsk/c?t?d?p?

# If making root partition raid then make second disk bootable
# For x86 machines
root@server:# /sbin/installgrub -m /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c?t?d?s?

# And for Sparc machines
root@server:# installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c?t?d?s?


# Add the State Database Replicas to a slice (normally s7) - may need -f to force if partition mounted
root@server:# metadb -a -f c?t?d?s?
# Need more than one copy. Spread accross disks/controllers etc - see docs for details
root@server:# metadb -a -f c?+1t?d?s?

# We will use d0 with d10 and d20 as the two mirrors


# Initialise the first mirror in the array. -f to force and "1 1" for one stripe and one slice
root@server:# metainit -f d10 1 1 c?t?d?s?

# Initialise the second mirror in the array
root@server:# metainit d20 1 1 c?t?d?s?

# Add the first mirror to the raid array
root@server:# metainit d0 -m d10

# If doing the root partition this will update /etc/vfstab to point to new root partition location. If doing non-root partitions then vi the file
root@server:# metaroot d0

# Reboot so system uses half of the new raid 1 array
root@server:# reboot

# Add the second mirror to the raid array
root@server:# metattach d0 d20

# To check on the status of the array and make sure it is syncing
root@server:# metastat

# Misc commands
# To delete an SDR
root@server:# metadb -d -f c?t?d?s?

# Detach a mirror from an array
root@server:# metadetach d0 d10

# Take mirror off line
root@server:# metaoffline d0 d20

# Put mirror back in array and resync
root@server:# metaonline d0 d20

# Create a UFS file system on the new array
root@server:# newfs /dev/md/dsk/d?

# Backup your metadb information
root@server:# metastat -p > /etc/lvm/md.tab

Readers who read this page, also read:




Bookmark and Share My Zimbio http://www.wikio.com

0 comments: