Solaris Disk Partition Layout & Mirroring Scripts
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.
Discuss This Article
Post Tags (user submitted): prtvtoc fmthard (1719) - t (1114) - tag/storage (516) - solaris prtvtoc (396) - solaris partition (269) - solaris disk layout (242) - prtvtoc solaris (215) - solaris partitions (179) - solaris 10 partition (166) - partition + solaris (157) - solaris prtvtoc fmthard (151) - solaris disk partition (143) - Solaris 10 disk mirroring (137) - fmthard (121) - solaris disk partitioning (112) - solaris partitioning (111) - solaris installboot (103) - solaris disk partitions (100) - solaris disk (100) - installboot solaris (93) - solaris partition layout (92) - solaris fmthard (82) - f (82) - solaris 10 disk layout (78) - solaris 10 partitioning (78) - solaris 10 partitions (69) - Disksuite howto (68) - fmthard prtvtoc (68) - solaris 10 disk mirror (63) - fmthard solaris (60) - solaris disk mirroring (60) - solaris 10 disk partitioning (60) - solaris disk mirror (58) - prtvtoc fmthard solaris (57) - prtvtoc in solaris (52) - solaris metainit (48) - solaris swap partition (47) - solaris 10 mirror (46) - partition in Solaris (44) - solaris mirror (43) - all (41) - "solaris mirroring" (39) - partitioning Solaris (38) - solaris 10 disk partition (38) - solaris mirror swap (35) - solaris 10 partition disk (35) - partitions solaris (35) - solaris 10 mirror disk (34) - solaris meta* (33) - solaris partition size (33) - solaris disk size (33) - partitioning in solaris (32) - partition layout (31) - solaris fmthard prtvtoc (31) - installboot solaris 10 (30) - solaris 10 disksuite (30) - solaris copy disk layout (29) - disk mirroring solaris 10 (29) - partition solaris 10 (28) - fmthard in solaris (27) - solaris (26) - solaris 10 create partition (26) - "mirror solaris 10" (26) - prtvtoc+fmthard (26) - solaris disk commands (26) - partitioning solaris 10 (26) - Solaris 10 installboot (24) - disk partition in solaris (24) - solaris 10 partition size (24) - Solaris mirror script (23) - how to partition solaris (23) - solaris 10 partition layout (23) - solaris scripts (23) - mirror disk solaris 10 (23) - Solaris Disk copy (22) - partition solaris (22) - partition solaris disk (21) - solaris 10 disk partitions (21) - solaris 10 fmthard (21) - prtvtoc and fmthard (21) - tag/Solaris (20) - solaris 10 mirroring (20) - disk layout +solaris (20) - Solaris +Disk suite (20) - solaris copy partition (18) - solaris disks (18) - mirroring solaris 10 (18) - mirroring solaris (18) - mirroring in solaris (18) - partitions in solaris (18) - solaris 8 prtvtoc (18) - solaris disksuite howto (17) - Disk mirroring on Solaris 10 (17) - solaris mirror disk (17) - solaris 9 disk partition (17) - Solaris 10 metaroot (17) - solaris change partition size (16) - disk solaris (16) - metainit solaris (16) - solaris change partition (16) - solaris create partition (15) - disk partitioning in Solaris (15) - solaris partition copy (15) - Disksuite solaris 10 (15) - solaris 10 disk suite (15) - fmthard prtvtoc solaris (14) - meta solaris (14) - solaris 10 mirror system disk (14) - Solaris Mirror drives (14) - solaris 9 disk partitioning (14) - installboot mirror (14) - solaris layout (14) - disk layout solaris 10 (14) - mss (14) - "solaris 10" format partition (14) - disksuite (13) - solaris 9 disk layout (13) - solaris partition disk (13) - disk partition solaris (13) - solaris partitioning howto (13) - solaris create "swap partition" (13) - metainit solaris 10 (13) - Disksuite script (13) - prtvtoc (13) - disk partitions solaris (13) - solaris disk partition layout (13) - "solaris 10 disk" (13) - solaris 10 partition sizes (13) - partition for solaris (13) - disk mirror solaris (12) - installboot in solaris (12) - disk partition layout (12) - solaris mirroring swap (12) - solaris partition howto (12) - prtvtoc copy (12) - solaris "mirror drive" (12) - solaris copy disk partition (12) - solaris mirror installboot (12) - solaris +meta +disk (12) - solaris disk mirror script (12) - disk partition (12) - solaris 10 mirror disks (12) - disk layout in solaris (12) - disk partition solaris 10 (12) - solaris disk howto (11) - mirroring Solaris boot drives. (11) - partition disk solaris (11) - change partition solaris (11) - partition on solaris (11) - metainit prtvtoc (11) -
[...] 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.