Solstice Disk Suite Setup (with Soft Partitions)

by Harry Hoffman <hhoffman@ip-solutions.net>

Copyright (C) 2002



Introduction:

Solstice Disk Suite (SDS) is a utility from Sun to allow for setting up of various different RAID configurations. While there are many different options available within SDS I am going to focus on mirroring the following filesystems (/, /var, and swap) and then using the remaining space on the disk as a soft partition. Soft partitions allow us to get around the limitation of only being able to use the seven slices of a disk that are available to Solaris.

Mirroring is an excellent way to help combat against a single disk failure. It is important to note that if the data on one side of the mirror is somehow flawed (i.e. -> incorrect editing) then that data will be copied across to the other side of the mirror. In other words, it doesn't prevent human error.



Setup:

In our example we assume that two disks, of 18GB each, are present in the system and available for our use. We will call these two disks c0t0d0 and c1t0d0. In a mirror configuration usually the disks are the same exact size, they don't have to be but it certainly helps.

As with any initial work on a disk we need to first define our slices and decide what filesystem is going to sit on each of the slices. Using the format command in Solaris we define our first disk (c0t0d0) in the following manner:

Slice Number

Size

Filesystem

Volume Type

S0

4GB

/

Mirror

S1

1GB (or twice the amt. of RAM)

Swap

Mirror

S2

[entire disk]

Disk Layout (Do not Use)

N/A

S3

1GB

/var

Mirror

S4

11.99GB

N/A

Softpartition

S7

10MB (or rest of disk)

N/A

metadb



We could also format our second disk in this manner but we'll use another Unix trick to accomplish this instead. By issuing the following command we copy the VTOC from disk1 one onto disk2 thereby making them exactly the same format.

dd if=/dev/rdsk/c0t0d0s2 of=/dev/rdsk/c0t1d0s2 count=16

Now that we have our disks the same we can begin to setup our mirrors and softpartitions using SDS. The first step to this is actually to setup our meta databases on each of the disks. The metadb will be located on slice 7 for each disk being used. Since we are jumpstarting this machine disk 1 will already be in use so we actually need to force the creation of the metadb file. After this we'll add the metadb to the other disk. The following commands will take create the metadb files.

metadb -a -f -c 2 c0t0d0s7

metadb -a -c 2 c0t1d0s7

Once we have the metadb in place we can begin to create our metadevices for each of the filesystems that we are going to mirror. The following commands will setup the metadevices for each of the slices that we will use.

# We use the -f flag to force creation because this slice is already mounted as /

metainit -f d11 1 1 c0t0d0s0



# We setup d11 as one side of the mirror for d10. Notice the numbering scheme (d10 – primary device, d11 as one half of the mirror and d12 as the other half of the # mirror. It makes it easier to follow the device layout when the numbering is sequential).

metainit d10 -m d11



# d12 will be used as the other half of the mirror that makes up the device d10

metainit d12 1 1 c0t1d0s0



#Now that the / mirror has been defined we can repeat the process for swap and /var.

# This sets up the swap slice on disk 1 as a metadevice. Note the -f flag again, both swap and /var are also already mounted so we need to force the operation.

metainit -f d21 1 1 c0t0d0s1



# This sets up the metadevice d20 which will be a mirror of d21 and d22

metainit d20 -m d21



# Here we are setting up the second half to our swap mirror.

metainit d22 1 1 c0t1d0s1



# The last piece of our mirroring is to setup the /var filesystem to be mirrored.

metainit -f d31 1 1 c0t0d0s3

metainit d30 -m d31

metainit d32 1 1 c0t1d0s3

# From here we can then setup a softpartition, if we so chose, and later create more partitions on it “than you can shake a stick at”.

# If you notice I use the opposite naming schema for softpartitions. Therefore the main metadevice is d100 and and softpartitions are then numbered sequentially after that # point in time (i.e. -> d101,d102).

metainit d100 1 1 c0t0d0s4

# To create a softpartition on d100 that is 4GB you would then issue the following command:

metainit d101 -p d100 4000M

# Then you can simply run newfs on the device d101

newfs /dev/dsk/d101

# The same procedure can be repeated for subsequent partitions on d100 and can also be used to setup c0t1d0s4 as a softpartition of its own.

# There are a few steps left to go on getting our new devices up and running properly. Since our / filesystem is actually going to be sitting on a mirror we need to let # Solaris know this ahead of time. The command metaroot is used to tell the system where the root partition now resides.

metaroot d10

# After this the file /etc/vfstab needs to be edited and all references to the actual disks need to be altered to the metadevices instead.

# So if the /var filesystem was pointing to /dev/dsk/c0t0d0s3 we would edit the file and point /var to /dev/md/dsk/d30. This can be accomplished all through a script. A # copy of the finish script used is provided below.

# Now we need to reboot the machine and then sync our mirrors. After the reboot is completed a sync of the mirrors is accomplished by the following commands:

metattach d10 d12

metattach d20 d22

metattach d30 d32

# It will take some time to sync the mirrors together so you system will be slow/unusable while this occurs. But if you are anywhere near the disks you will hear lots of # disk activity. When the disks stop cranking away then Disk Suite is done the sync process.

# Don't forget to read the man pages: metadb, metastat, metainit, metaroot