• 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.

    This entry was posted on Friday, June 11th, 2004 at 11:22 am and is filed under Data and Technology. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
  • 9 Comments

    Take a look at some of the responses we've had to this article.

    1. [...] UPDATE TO “Solaris Disk Partition Layout & Mirroring Scripts” [...]

    2. Ernie
      Feb 2nd
      Reply

      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

    3. WRJ
      Feb 22nd
      Reply

      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?

    4. Feb 22nd
      Reply

      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.

    5. [...] 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! [...]

    6. Swamy
      Mar 6th
      Reply

      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 !!!!

    7. doood
      Aug 10th
      Reply

      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.

    8. SURYA
      Apr 25th
      Reply

      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

    9. Nishanth
      Apr 29th
      Reply

      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

  • Leave a Reply

    Let us know what you thought.

  • Name (required):

    Email (required):

    Website:

    Message:

Visitors have tagged this post: prtvtoc fmthard (1912) - t (1114) - tag/storage (516) - solaris prtvtoc (497) - solaris partition (432) - prtvtoc solaris (318) - solaris disk layout (305) - solaris disk partition (253) - solaris 10 partition (238) - solaris partitions (229) - Solaris 10 disk mirroring (184) - solaris prtvtoc fmthard (169) - solaris disk partitioning (164) - solaris disk partitions (161) - partition + solaris (157) - solaris partitioning (146) - solaris disk (134) - solaris partition layout (130) - solaris installboot (126) - fmthard (123) - installboot solaris (122) - fmthard solaris (121) - solaris fmthard (108) - solaris 10 partitioning (108) - solaris 10 partitions (100) - solaris 10 disk layout (96) - partition solaris (90) - f (82) - solaris 10 disk partitioning (81) - solaris disk mirror (80) - solaris mirror (79) - fmthard prtvtoc (78) - solaris 10 disk mirror (77) - solaris swap partition (73) - solaris disk mirroring (72) - Disksuite howto (69) - prtvtoc fmthard solaris (68) - partition in Solaris (67) - solaris 10 mirror (62) - solaris disk size (57) - solaris metainit (54) - solaris 10 disk partition (53) - prtvtoc in solaris (52) - solaris 10 mirror disk (49) - solaris 10 disksuite (49) - fmthard in solaris (49) - disk partition in solaris (47) - partitions solaris (45) - solaris partition disk (44) - installboot solaris 10 (44) - solaris disk commands (44) - partition solaris 10 (42) - all (41) - solaris mirror swap (41) - solaris partition size (41) - partition solaris disk (40) - solaris 10 partition disk (40) - partitioning Solaris (39) - "solaris mirroring" (39) - how to partition solaris (38) - solaris 10 fmthard (38) - disk mirroring solaris 10 (38) - mirror Solaris 10 (38) - solaris 10 create partition (37) - solaris 10 partition size (36) - Solaris mirror script (35) - mirroring in solaris (35) - partitioning solaris 10 (35) - solaris meta (34) - solaris (33) - partition layout (33) - solaris meta* (33) - Solaris 10 installboot (33) - solaris copy disk layout (33) - solaris 10 partition layout (33) - solaris scripts (33) - solaris mirroring (33) - disk partition solaris (32) - solaris create partition (32) - partitioning in solaris (32) - prtvtoc in solaris (32) - solaris 10 mirroring (31) - solaris fmthard prtvtoc (31) - mirror disk solaris 10 (31) - Solaris 10 metaroot (31) - solaris 10 disk partitions (28) - mirroring solaris (28) - Solaris Disk copy (27) - solaris meta commands (27) - solaris disks (26) - "mirror solaris 10" (26) - prtvtoc+fmthard (26) - solaris copy partition (25) - solaris layout (25) - partitions in solaris (25) - meta solaris (24) - disk solaris (24) - solaris backup partition (24) - solaris mirror disk (23) - partition for solaris (23) - prtvtoc solaris 10 (23) - solaris change partition size (22) - disk partitioning in Solaris (22) - prtvtoc and fmthard (22) - partition disk solaris (21) - metainit solaris (21) - Disksuite solaris 10 (21) - disk partitions solaris (21) - solaris 8 prtvtoc (21) - tag/Solaris (20) - disk layout +solaris (20) - solaris partition copy (20) - Solaris +Disk suite (20) - disk mirroring in solaris 10 (19) - mirroring solaris 10 (19) - partition on solaris (19) - disk partition (19) - mirror disk solaris (19) - solaris 9 disk mirroring (19) - Disk layout solaris (19) - Solaris Mirror drives (18) - solaris change partition (18) - solaris disksuite howto (17) - disk mirror solaris (17) - Disk mirroring on Solaris 10 (17) - solaris partition howto (17) - solaris 9 disk partition (17) - solaris 10 disk commands (17) - disk partition solaris 10 (17) - solaris mirror prtvtoc (17) - installboot in solaris (16) - solaris 10 mirror system disk (16) - Disksuite script (16) - disk layout solaris 10 (16) - solaris 10 mirror disks (16) - solaris 10 disk suite (16) - disk partitioning solaris (16) - fmthard prtvtoc solaris (15) - copy disk layout solaris (15) - metainit prtvtoc (15) - mirroring disk solaris 10 (15) - solaris partition sizes (15) - mirror solaris disk (15) - how to create partition in solaris 10 (15) - solaris partitioning howto (14) - how to partition in solaris (14) - solaris copy disk partition (14) - solaris 9 disk partitioning (14) - installboot mirror (14) - prtvtoc (14) -