Assumed configuration: 2 internal disks, c0t0d0 and c0t1d0 These may be substituted freely and swapped anywhere below, as long as you swap them consistently.
slice 2 (backup) is reservedexample:
VxVM requires two slices
1 for private region. (usually slice 3)
1 for public region. (usually slice 4)
So: You can have a maximum of 5 slices that have physical presence on the vxvm disk. (But, in actuality, only root, swap and possibly /var technically need physical presence. the rest can just be vxvm allocated dynamic regions. Having /usr as a separate VxVM partition is not usually a good idea because if /usr becomes unavailable, you've got no vxvm anyway) You should also make the volumes in the same order that you want your partitions layed out on the disk. (This isn't 'strictly' needed. VxVM doesn't really care, but it's still a good idea).
# vxassist make rootvol 500m usetype=root contig,align # vxassist make swapvol 500m usetype=swap contig,align # vxassist make var 500m contig,align # vxassist make local 500m contig,align
# /etc/vx/bin/vxmksdpart disk01-01 0 0x02 0x00 <--- rootvol # /etc/vx/bin/vxmksdpart disk01-02 1 0x03 0x01 <--- swapvol (unmountable) # /etc/vx/bin/vxmksdpart disk01-03 6 0x07 0x00 <--- var # /etc/vx/bin/vxmksdpart disk01-04 7 0x09 0x00 <--- local ('alt' tag)
(this actually gives you a good opportunity to give sensible inode sizes and minfree sizes in relation to a default install. See newfs for flag details.)
example:
# newfs -m 2 -i 16384 -d 0 -r 10000 /dev/vx/rdsk/rootvol # newfs -m 5 -i 65536 -d 0 -r 10000 /dev/vx/rdsk/var # newfs -m 3 -i 32768 -d 0 -r 10000 /dev/vx/rdsk/local
(The example I use is star, which is much faster than standard Sun tar, slightly faster than gnu tar, and also often faster than ufsdump. star also supports sparse files, but not Solaris ACLs)
# mkdir /mnt # mount /dev/vx/dsk/rootvol /mnt # mkdir -p /mnt/var /mnt/usr/local # chmod 755 /mnt/var # mount /dev/vx/dsk/var /mnt/var # chmod 755 /mnt/usr/local # mount /dev/vx/dsk/local /mnt/usr/local
copy files
# cd / # /usr/local/bin/star -c -M -sparse H=xstar blocks=40 . | (cd /mnt; /usr/local/bin/star -xp blocks=40) # cd /var # /usr/local/bin/star -c -M -sparse H=xstar blocks=40 . | ( cd /mnt/var ; /usr/local/bin/star -xp blocks=40 ) & (if /usr/local is on / on pre-vxvm disk, you can skip this) # cd /usr/local # /usr/local/bin/star -c -M -sparse H=xstar blocks=40 . | ( cd /mnt/usr/local ; /usr/local/bin/star -xp blocks=40 ) &
Up to now, everything has been pretty quotidian Veritas stuff (except possibly the vxmksdpart). Now comes the weird stuff.
In order for Veritas to boot, rootvol must be of a layout type called 'root', and when you created the volume above, it got created with a type of fsgen.
first, unmount all the filesystems you mounted above.
# umount /mnt/usr/local # umount /mnt/var # umount /mntstop the root volume
# vxvol stop rootvolhere's the part that might make you queasy. You actually have to destroy the root volume and create a new one.
# vxplex dis rootvol-01 # vxedit rm rootvol # vxmake vol rootvol usetype=root plex=rootvol-01 comment="hand created rootvol by doug"(remind vxvm that state has data, and it's good, volume will be in EMPTY state after vxmake)
# vxvol init clean rootvol # vxvol start rootvol(now it is safe to mount again)
There is one last stipulation. In order to boot, the rootvol must have
a minor device number of 0.
Here's an example of what it might look like
# ls -l /mnt/dev/vx/*dsk/rootvol brw------- 1 root root 109, 5 Feb 16 19:53 /mnt/dev/vx/dsk/rootvol crw------- 1 root root 109, 5 Feb 16 19:53 /mnt/dev/vx/rdsk/rootvol
(109 is, on this system, the device number corresponding for the Veritas IO driver. On your system it will most likely be different. The important thing is that the second number (column 6), *must* be 0. If it is different, simply remove and recreate them with the proper minor number.
# rm /mnt/dev/vx/*dsk/rootvol /mnt/dev/vx/*dsk/rootdg/rootvol
The devices in /dev/vx/dsk/rootvol and /dev/vx/dsk/rootdg/rootvol are
block devices.
example (after removing the current rootvol devices):
# mknod /mnt/dev/vx/dsk/rootvol b 109 0
The devices in /dev/vx/rdsk/rootvol and /dev/vx/rdsk/rootdg/rootvol are
the character special devices.
# mknod /mnt/dev/vx/dsk/rootdg/rootvol b 109 0
# mknod /mnt/dev/vx/rdsk/rootvol c 109 0
# mknod /mnt/dev/vx/rdsk/rootdg/rootvol c 109 0
(Again: it is important that you substitute the 109 above with whatever major number your device currently has. If you are in doubt, grep vxio /etc/name_to_major and use that number.)
# /usr/sbin/installboot /usr/platform/sun4u/lib/fs/ufs/bootblk
/dev/rdsk/c1t1d0s0
(for instance)
# cd /mnt # cp vfstab vfstab.prevm  edit vfstab and make it VxVM able.
/dev/vx/dsk/swapvol - - swap - no - /dev/vx/dsk/rootvol /dev/vx/rdsk/rootvol / ufs 1 no logging /dev/vx/dsk/var /dev/vx/rdsk/var /var ufs 1 no logging /dev/vx/dsk/local /dev/vx/rdsk/local /usr/local ufs 1 yes -
The system still won't boot correctly yet, but it's almost there. You need to make a few more updates in /mnt/etc/system and update boot aliases. This procedure is a subset of the things that vxbootsetup does, but vxbootsetup will not run when we are booted off of the non vxvm disk, so they need to be done by hand.
add the following 5 lines in /mnt/etc/system just before this line:
* vxvm_END (do not remove) forceload: drv/vxdmp forceload: drv/vxio forceload: drv/vxspec forceload: drv/fp forceload: drv/qlc forceload: drv/sd forceload: drv/ssd forceload: drv/SUNW,fas forceload: drv/sbus rootdev:/pseudo/vxio@0:0 set vxio:vol_rootdev_is_volume=1 -> vxvm_END line will be here after add
Note, after the mirror is setup below, you can easily swap which disk is rootdisk and which is rootmir via the prom aliases
Now we're ready to configure the mirror.
halt the system and boot it off the vxvm disk that we just setup.
# halt System halted.. > boot rootdisksystem comes up
Now mirror all the volumes.
# vxassist mirror rootvol disk00 # vxassist mirror swapvol disk00 # vxassist mirror var disk00 # vxassist mirror local disk00setup root as a partition
# /etc/vx/bin/vxbootsetup disk00-01instantiate slices for rest of volumes
# /etc/vx/bin/vxmksdpart disk00-02 1 0x03 0x01 <--- swapvol (unmountable) # /etc/vx/bin/vxmksdpart disk00-03 6 0x07 0x00 <--- var # /etc/vx/bin/vxmksdpart disk00-04 7 0x09 0x00 <--- local ('alt' tag)
Now for eeprom to setup boot aliases (cut & pastable) this creates two EEPROM aliases, rootdisk and rootmir and sets up the default boot-device to be rootdisk followed by rootmir. You can boot from either one from the ok prompt.
/bin/echo 'eeprom nvramrc="devalias rootdisk \c' > /tmp/ee ls -l /dev/dsk/c0t0d0s0 | nawk '{print $NF}' | cut -c 14- | tr -d '\012' >> /tmp/ee /bin/echo ' \' >> /tmp/ee /bin/echo 'devalias rootmir \c'>> /tmp/ee ls -l /dev/dsk/c0t1d0s0 | nawk '{print $NF}' | cut -c 14- | tr -d '\012' >> /tmp/ee /bin/echo '"' >> /tmp/ee . /tmp/ee eeprom 'use-nvramrc?=true' eeprom boot-device="rootdisk rootmir"