• 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 (2029) - t (1114) - solaris prtvtoc (580) - solaris partition (540) - tag/storage (516) - prtvtoc solaris (410) - solaris disk layout (331) - solaris disk partition (325) - solaris partitions (280) - solaris 10 partition (254) - solaris disk partitioning (205) - Solaris 10 disk mirroring (197) - solaris disk partitions (178) - solaris prtvtoc fmthard (176) - solaris partitioning (169) - fmthard solaris (165) - partition + solaris (157) - solaris partition layout (157) - solaris 10 partitioning (146) - solaris disk (142) - solaris installboot (135) - solaris fmthard (131) - installboot solaris (128) - fmthard (126) - partition solaris (125) - solaris 10 partitions (124) - solaris meta commands (108) - solaris 10 disk layout (104) - solaris 10 disk partitioning (104) - fmthard prtvtoc (100) - solaris disk mirror (89) - solaris swap partition (88) - prtvtoc fmthard solaris (87) - solaris mirror (86) - solaris disk mirroring (82) - f (82) - solaris 10 disk mirror (80) - partition in Solaris (75) - solaris 10 mirror (73) - Disksuite howto (71) - solaris 10 disk partition (70) - solaris disk size (69) - disk partition in solaris (59) - fmthard in solaris (59) - solaris partition disk (58) - solaris 10 mirror disk (57) - mirror Solaris 10 (56) - solaris metainit (54) - solaris 10 mirroring (52) - prtvtoc in solaris (52) - partitions solaris (52) - partition solaris 10 (52) - installboot solaris 10 (51) - how to partition solaris (51) - solaris 10 disksuite (50) - solaris disk commands (49) - solaris meta (49) - solaris 10 partition layout (48) - solaris 10 fmthard (48) - solaris partition size (46) - solaris 10 partition disk (45) - partition solaris disk (43) - solaris 10 create partition (43) - partitioning Solaris (42) - disk mirroring solaris 10 (42) - all (41) - solaris mirror swap (41) - mirror disk solaris 10 (40) - solaris mirroring (40) - "solaris mirroring" (39) - solaris backup partition (39) - meta commands Solaris (39) - Solaris mirror script (38) - disk partition solaris (38) - solaris 10 partition size (38) - mirroring in solaris 10 (38) - Solaris 10 installboot (37) - solaris copy disk layout (37) - mirroring in solaris (37) - partitioning solaris 10 (37) - prtvtoc in solaris (37) - solaris create partition (35) - solaris scripts (35) - solaris (34) - partition layout (34) - partitioning in solaris (34) - solaris meta* (33) - solaris fmthard prtvtoc (33) - how to create partition in solaris 10 (33) - solaris fmthard example (32) - solaris 10 disk partitions (31) - mirroring solaris (31) - prtvtoc and fmthard (31) - Solaris 10 metaroot (31) - solaris layout (29) - solaris mirror disk (28) - partitions in solaris (28) - solaris copy partition (27) - Solaris Disk copy (27) - meta solaris (27) - solaris disks (27) - disk solaris (27) - Disk layout solaris (27) - mirroring solaris 10 (26) - solaris change partition size (26) - disk partitioning in Solaris (26) - "mirror solaris 10" (26) - prtvtoc+fmthard (26) - solaris format partition (26) - Disksuite solaris 10 (24) - partition for solaris (24) - mirror disk solaris (24) - prtvtoc solaris 10 (24) - fmthard on solaris (24) - solaris 10 mirror system disk (23) - partition on solaris (23) - disk partitions solaris (23) - solaris 8 prtvtoc (23) - disk partitioning solaris (23) - solaris partitionieren (23) - partition disk solaris (22) - solaris partition howto (22) - solaris partition copy (22) - solaris 10 disk commands (22) - metainit solaris (22) - create partition solaris (22) - solaris 9 disk mirroring (22) - disk mirroring in solaris 10 (21) - solaris copy disk partition (21) - solaris 10 disks (21) - tag/Solaris (20) - disk layout +solaris (20) - Solaris Mirror drives (20) - Solaris +Disk suite (20) - fmthard Solaris 10 (20) - how to partition in solaris (19) - disk partition (19) - solaris change partition (19) - metaroot solaris 10 (19) - disk mirror solaris (18) - solaris partition sizes (18) - solaris mirror prtvtoc (18) - solaris disksuite howto (17) - Disk mirroring on Solaris 10 (17) - swap partition solaris (17) - solaris 9 disk partition (17) - solaris 10 mirror disks (17) - disk partition solaris 10 (17) - prtvtoc on solaris (17) - installboot in solaris (16) -