UPDATED “Problems With Multiple MetaDB Partitions“
For some reason, it always seems that no two servers in the world have the same disk partition layout. For the longest time, I’d get a server in, lay out the partitions in a way that seemed to make sense to me at the time, and move on with my life.
Anyhow, I finally decided to come up with a standard layout based on the spiralbound story “Mirroring a boot drive using Solstice Disk Suite”, which has been nice since I can now script the mirroring process. Read more to see the layout, and the scripts I use to mirror the disks. Hopefully it will make sense in your machine room, but if not, change it and tell me why. Please do not run these scripts unless you know EXACTLY what you are doing, and EXACTLY what each and every command in them is doing. You could very easily overwrite data on your drives, and ruin your whole day.
| Partition | Mount Point | Size in MB | Notes |
| 0 | / | 1024 | |
| 1 | Swap | 12288 | |
| 2 | Backup | ||
| 3 | 100 | Meta DB | |
| 4 | 100 | Meta DB | |
| 5 | /usr | 2048 | |
| 6 | /var | 10240 | |
| 7 | /opt | Remainder |
As you can see, I like to leave partiton 3 and (4 UPDATED “Problems With Multiple MetaDB Partitions“) reserved to the meta databases required by Solstice Disk Suite. I also like to get the swap partition way up near the front of the disk so that I can, at least in theory, get a little more speed on my virtual memory.
I like to mirror my system disks, so I wrote a script to do it for me. You may have to change things around a little depending on which disks are on which controller, but that’s usually a lot easier than typing everything in by hand, and keeping it all lined up in your head. Edit as needed.
————-SNIP————
#!/bin/sh
#Mirrorme.sh
prtvtoc /dev/rdsk/c1t0d0s2 | fmthard -s – /dev/rdsk/c1t1d0s2
metadb -a -f -c2 /dev/dsk/c1t0d0s3 /dev/dsk/c1t1d0s3
metadb -a -f -c2 /dev/dsk/c1t0d0s4 /dev/dsk/c1t1d0s4 (UPDATED “Problems With Multiple MetaDB Partitions“)
# / Filesystem
metainit -f d10 1 1 c1t0d0s0
metainit d20 1 1 c1t1d0s0
metainit d30 -m d10
metaroot d30
# Swap Filesystem
metainit -f d11 1 1 c1t0d0s1
metainit d21 1 1 c1t1d0s1
metainit d31 -m d11
# /usr filesystem:
metainit -f d12 1 1 c1t0d0s5
metainit d22 1 1 c1t1d0s5
metainit d32 -m d12
# /var filesystem:
metainit -f d13 1 1 c1t0d0s6
metainit d23 1 1 c1t1d0s6
metainit d33 -m d13
# /opt filesystem:
metainit -f d14 1 1 c1t0d0s7
metainit d24 1 1 c1t1d0s7
metainit d34 -m d14
metainit hsp001
echo “Do a lockfs -fa, and then an init 6″
————-SNIP————
If you are unsure of what these commands are doing, please read the man pages on them. Change the drive and controller numbers based on your server, run this script, and reboot the system.
After the system has come back up, it’s time to attach the mirror partitions to the metadevices. This next script will take care of that for you.
————-SNIP————
#!/bin/sh
#Mirrormemore.sh
metattach d30 d20
metattach d31 d21
metattach d32 d22
metattach d33 d23
metattach d34 d24
echo “Don’t forget to make the new mirror bootable”echo ” # installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c1t1d0s0″echo “Making darn sure this is pointed towards the mirror drive!”
————-SNIP————
After running this script, the drive lights will go crazy for a while as everything gets all synced up. While the system is mirroring the drives, you can go in and edit your /etc/vfstab file. How to do this is well covered in my story about mirroring Solaris boot drives.

[...] UPDATE TO “Solaris Disk Partition Layout & Mirroring Scripts” [...]
don’t forget to edit vfstab and change the entries for your new mirrored partitions to use the mirrored disk reference. metaroot only takes care of the vfstab entry for the root partition
I was always under the impression that /etc/vfstab had to be edited before the reboot and mirror part of the operation.
Does it really matter?
The metaroot command actually does edit your /etc/vfstab file such that it will boot off the new mirror. Once your have booted off this mirror, you metattach the other mirrors, and edit your /etc/vfstab file by hand to mount these new mirrors before rebooting again.
I guess you could do it all at once, but I like to make sure I’m coming up off the mirror before committing to mounting all the other filesystems as mirrors.
[...] Kids… DO NOT TRY THIS AT HOME! If this is not done exactly right, you will render your system unbootable and corrupt your data. That being said, under some circumstances you can take some space from your swap partition and add it to an unused one without initializing your entire disk. This is particularly useful if you decide you want to use DiskSuite to mirror your system disk, but have not allocated the 100MB partition that is needed to hold the state databases. As always, BACK EVERYTHING UP FIRST. Better yet, make two backups and store them on two different systems. This is a risky procedure, and you don’t want to lose any data! [...]
Its a good script if u find urself in a pain to type the commands in the beggining,
I prefer u do typing the commands manually,
once u get to know whatz happening with them,
U can go for the script..
Happy Mirroring !!!!
So when addressing an x86 system with a seperate /boot or other partition you’ll have great difficulty in making this happen.
I was able to get it going on x86 by moving all the data to one fdisk partition. Also using installgrub instead of installboot.
very good article.
Dont reboot the box while the sync is going on. and before reboot you need to give the entries in vfstab with metadeices
As we can specify the size of the partition in Cylinders, MB, GB and E. I would like to know what “E” Stands for as i noticed this in Solaris 10 while creating a file system & specifying the size. Please advice