Simple Solaris SDS/SVM Boot Disk flushing ing Howto

Source: Internet
Author: User
Tags svm

Version 0.42-Barbie levile-292.166.2006

What we want to do:

1) We want to create a mirrored systemdisk environment that can
Be booted from and between ves a disk failure.
In out example case we have 2 drives we want to use for that.
A three way mirror can be done in much the similar way.

2) some background on SDS concepts
 

Metadbs:

A metadb stores state informations of the metadevices, they are critical to SDS
Operation.
In SDS metadbs must follow this rules to work:
To be able to boot a SDS system, at least 2 and 50% + 1 metadbs of all existing metadbs
Need to be in a OK State. Yes, both statements mut be true.
For that reason metadbs are normaly placed on their own small slice on each drive.
Less change for accidently deleting them.
As a rule of thumb, 3 are placed on each drive in a 2 drive setup, and 2 in a 3 drive setup.
However, a SDS system with only 2 disks can never fullfill the minium requierments in case of diskfailure.
There are two choices for such situations, 1) set the kernel to ignore the problem and keep booting.
Or 2) fix the problem prior to getting back up manualy.

In this example we will set the kernel to ignore it, since in most cases its the prefered Mode
Of operation. On shocould however not forget to fix the problem ASAP.

Man metadb for details


Metadevices:

Metadevices are the building blocks of SDS.
First one creats a metadevice out of a logical disk device like a slice, then assembles
Those into another metadevices.

Example: We have 2 disks, each as 5 slices, each slice becomes a metadevice.
In a mirror those are called submirrors, and then one from each disk gets assembled
Actual mirror.
Metadevices are manipulated via metainit.

Man metainit for details


Metaroot:

The metaroot command sets up a) the kernel to be able to handle a sds mirror boot device
And B) creates a metadevice entry for the root filesystem in the/etc/vfstab.
It can be used to revert the root device back to non metadevice mode too.

Man metaroot for details


Hints:

SDS likes to have drives of the same geometry.
If thats not possible, make sure that the drive that holds your data has the smaller slices.
You can always mirror a smaller slice to a bigger one, but not the other way.

3) The example disklayout:

We have 2 drives, c0t0d0 and c1t0d0, drive 1 is sliced as follows:

C0t0d0s0 swap
C0t0d0s1/
C0t0d0s2 backup (whole disk)
C0t0d0s3/var
C0t0d0s4/OPT
C0t0d0s5/export/home
C0t0d0s6 unused
C0t0d0s7 here we place out metadbs

We have no seperate/usr in this example, add it yourself if you want it.
But generaly its not needed anymore.
S7 shoshould be around 50 mb, more is not needed, even with 10 s of metadbs.

Now we plan how to name out metadevices.

I usualy name my metadevices in the following sheme:

D Slice 0 for the mirror, 1 for the submirror on disk 1, 2 for disk 2, 3 for disk 3,
When T for swap which lays on s0, there it just gets ommited
Which gives us the following:

Disk 1 Disk 2 Metadevices
C0t0d0s0-> d1 c1t0d0s0-> d2 d1 + d2-> d0
C0t0d0s1-> d11 c1t0d0s3-> d12 d11 + d12-> d10
C0t0d0s3-> d31 c1t0d0s3-> d32 d31 + d32-> d30
C0t0d0s4-> d41 c1t0d0s4-> d42 d41 + d42-> d40
C0t0d0s5-> d51 c1t0d0s5-> d52 d51 + d52-> d50

4) Time to get our hands dirty!

The following steps shocould be done while in single usermode idealy.

4.1) Making both drives the same.

We start with slicing the second drive in the same way as our first drive,
Master.

# Prtvtoc/dev/rdsk/c0t0d0s2 | fmthard-s-/dev/rdsk/c1t0d0s2

No need to newfs the second drive slices here, that will automaticaly done
By the mirror syncing later.

Note: If your drives of a different geometry you need to create the slices on
Second disk by hand not use the command above. In such a case, make sure
Second disk has identical slice sizes or the bigger slices.


4.2) Metadbs

We can now setup our metadbs.

# Metadb-a-f-c3 c0t0d0s7 c1t0d0s7

Since its the initial creation of the metadbs, we need to force it with-f
-A adds the metadbs, and-c tells it how to create.

You can see the results with metadb-I.
Metadb-I is a very handy tool to determine the state of your metadb states.


4.3) Initializing the devices

Now we go to setup the initial metadevices.

# Metainit-f d1 1 1 c0t0d0s0
# Metainit-f d11 1 c0t0d0s1
# Metainit-f d31 1 c0t0d0s3
# Metainit-f d41 1 c0t0d0s4
# Metainit-f d51 1 c0t0d0s5

# Metainit-f d2 1 1 c1t0d0s0
# Metainit-f d12 1 c1t0d0s1
# Metainit-f d32 1 c1t0d0s3
# Metainit-f d42 1 c1t0d0s4
# Metainit-f d52 1 c1t0d0s5

Like metadb metainit must be forced with-f, but this time not because its the initial creation,
Because we work on mounted filesystems.
So, here we create a 1 way concatenation of our actual slices and form the needed submirrors.


4.3) refreshing fun part 1!

# Metainit d0-m d1
# Metainit d10-m d11
# Metainit d30-m d31
# Metainit d40-m d41
# Metainit d50-m d51

Here are the actualy mirroing intialized, the-m tells SDS that we want to build a mirror with the name
In the first colum and consiting of the submirror in the third colum.
We now have a one way mirror of our system drive, but its not active yet.

4.4) Setting the root device

# Cp/etc/vfstab/etc/vfstab_pre_sds
# Cp/etc/system/etc/system_pre_sds
# Metaroot d10


4.5) Setting up/etc/vfstab

# Device mount FS fsck mount
# To mount to fsck point type pass at boot options
#
Fd-/dev/fd-no-
/Proc-no-
#
# Sds drives
#
/Dev/md/dsk/d0--swap-no-
/Dev/md/dsk/d10/dev/md/rdsk/d10/ufs 1 no logging
/Dev/md/dsk/d30/dev/md/rdsk/d30/var ufs 1 no logging, noatime
/Dev/md/dsk/d40/dev/md/rdsk/d40/opt ufs 2 yes logging
/Dev/md/dsk/d50/dev/md/rdsk/d50/export/home ufs 2 yes logging
#
# Non sds drives
#
#/Dev/dsk/c1t0d0s0--swap-no-
#/Dev/dsk/c1t0d0s1/dev/rdsk/c1t0d0s1/ufs 1 no logging
#/Dev/dsk/c1t0d0s3/dev/rdsk/c1t0d0s2/var ufs 1 no logging, noatime
#/Dev/dsk/c1t0d0s4/dev/rdsk/c1t0d0s4/opt ufs 2 yes logging
#/Dev/dsk/c1t0d0s5/dev/rdsk/c1t0d0s5/export/home ufs 2 yes logging
#
# Swap slices
#
Swap-/tmp tmpfs-yes-

4.5.1) Optional: Making sure we can boot in case of disk failure.

Use only where data integrety is less important then service avilability.
This can lead to file coruption.

To make sure we can boot in case a disk fails, we need to tell the kernel to ignore
Quota on metadbs, otherwise we can't boot in a two disk setup, because we can't never
Fullfill the requirments.

For that we add the following to/etc/system set md: mirrored_root_flag = 1

# Echo "set md: mirrored_root_flag = 1">/etc/system

I sugges to create a copy of the/etc/system file and modify the copy instead
The original. This allows to run the system to operate with the data save settings,
And allows for switching the/etc/system file at boot if needed via boot-.

(4.6) Our first reboot!

Bring down the system to the OBP, don't reboot yet fully.
We need to setup the boot devices now.

OK setenv boot device disk0: B disk1: B

Make sure the devaliases of disk0 and disk1 are actualy pointing to the correct hardware decives.

Now we boot our system up for the first time on the mirror.

If all went well we are up and running in a few seconds.


4.7) refreshing Fun Part 2!

Now its time to hook up the second drive so we have actualy mirrored slices.

# Define tach D0 D2
# Define tach D10 D12
# Define tach d30 d32
# Define tach d40 d42
# Define tach D50 d52

This will take considereble amount of time.
Use metastat to check on the progress of the syncing

Example metastat d30

4.8) Swap

Since swap is now located on a metadevice, we want to tell the system that:

Dumpadm-D/dev/MD/DSK/D0

And since resyncing swap at boot is just wasted time, we disable that:

Metaparam-p 0/dev/md/dsk/d0

5) All done, enjoy

6) Performance and other Tips

To speed up the rsync process, especialy with modern disks raise the physical I/O buffer size.
Default is 32KB, 1 MB is what we set here, however its a setting that needs experimenting for best
Effect

/Etc/system-add the following line
Set maxphys = 0x100000
/Etc/rc2.d/S95svm. resync
Modify the '$ METASYNC-r 'line to be' $ METASYNC-r 2048'

To prevent write-on-write problems, which can lead to the sides of the mirror been
Written on by different programs at the same time and resulting in two different files
Set:

/Etc/system-Add the following line
Set md_mirror: md_1__wow_flg = 0x20

7) troubleshooting

7.1) Explain tach: submirror too small to attach

Format shows both mirrors to be the same size, metastat however shows they
Are of different size. Whats going one?

-You proably have put the metadbs on one of the Data slice on one disk,
But not on the other. Since metadbs take diskspace as well, this
Inconsitency happens. Place metadbs either in their own slice or make sure
To have the same amount on the same slices on both disks.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.