Tuesday, July 26, 2011

Solaris Volume Manager

State Database Replicas are the meta database which will hold all the volume information. The default state database replica size in SVM is 8192 blocks while in Solstice DiskSuite is 1034 blocks. You should create state database replicas on dedicated slice of at least 4 mega bytes per replica copy.

A minimum of 3 copies of replica is required on a system.


Here are few commands to manage state database replicas ...

To create the initial state db replicas:
# metadb -a -f c1t0d0s3

To create additional state database replicas on disks:
# metadb -a c1t1d0s3 c1t2d0s3 c1t3d0s3

To create 2 state database replicas on the same disk:
# metadb -a -c2 c1t3d0s3

To list all the state database replicas :
#metadb

To list the status:
#metadb -i

To delete a state database replica:
#metadb -d c1t0d0s3

Volumes:

To create a stripe volume :
# metainit d0 1 2 c0t1d0s3 c0t2d0s3 -i 32k

To create a concat volume :
# metainit d1 2 1 c0t1d0s3 1 c0t2d0s3

To remove a stripe or concat volume :
# metaclear d0

To create a mirror using 2 concat volumes (d1 and d2) :
# metainit d10 -m d1
# metattach d10 d2

To detach a submirror from a mirror volume :
# metadetach d10 d2

To place a submirror offline :
# metaoffline d10 d2

To place a submirror online :
# metaonline d10 d2

To show the details of a volume :
# metastat d10

To create a RAID5 volume :
# metainit d11 -r c1t2d0s4 c2t2d0s4 c1t2d0s4
 

Now lets look at how to create and manage filesystem on the volumes

To create filesystem on the volume :

# newfs -i 8192 /dev/md/rdsk/d10

To mount the filesystem :
# mkdir /data
# mount -F ufs /dev/md/dsk/d10 /data

Also add the below line to /etc/vfstab so that the filesystem mounts on every reboot.
/dev/md/dsk/d10       /dev/md/rdsk/d10      /data  ufs     2       yes     -

Monday, July 11, 2011

How to Un-encapsulate a root disk in Solaris ?

1. Boot from the 2nd disk and unencapusolare the 1st root disk.

ok> boot "/pci@9,600000/scsi@1,1/sd@0,0

2. Install boot block,

# cd /usr/platform/`uname i`/lib/fs/ufs
# installboot bootblk /dev/rdsk/c1t0d0s0
# installboot bootblk /dev/rdsk/c1t0d1s0

3. Collect the list of plexes associated with the 1st disk,

# vxprint -dg rootdg

4. Dis-associate the plexes (of 1st disk) frmo rootdg,

# vxplex -g rootdg dis var01
# vxplex -g rootdg dis rootvol01
# vxplex -g rootdg dis swapvol01

5. Run fsck on root and var filesystems on 1st disk,

# fsck /dev/rdsk/c1t0d0s0
# fsck /dev/rdsk/c1t0d0s6

6. Mount the root filesystem of 1st disk and modify the vfstab files,

# mount /dev/dsk/c1t0d0s0 /mnt
# cd /mnt/etc/
# cp -p system system.ddmmyy
# cp -p vfstab vfstab.ddmmyy
# cp -p vfstab.prevm vfstab
# edit vfstab and modify root/swap/var filesystems to contain c1t0 entry
# Comment the below line in /mnt/etc/system file
* rootdev...
* set vxio ...

7. Create the below file so that VXVM daemons won't get started while booting,

# touch /mnt/etc/vx/reconfig.d/state.d/install-db

8. Remove the below file so that the system knows that root disks are not encapsulated.

# rm /mnt/etc/vx/reconfig.d/state.d/root-done

9. Chagne the auto boot value to false.

# eeprom auto-boot?=false

After booting from disk slice (instead of VXVM), if you want to access other disk groups you can follow the below procedure.

1. start the VXIO daemon,
# vxiod set 10

2. Start vxconfigd in disabled mode,
# vxconfigd -d

3. Enable vxconfigd,
# vxdctl enable

4. Start all the volumes of the concerned DG,
# vxvol -g dg startall

5. Mount the corresponding filesystems.

How to extend or shrink Volumes and Filesystems in VXVM / VXFS ?

You can use the below commands to extend / shrink the volume and filesystem.

vxresize - This command will extend or shrink volume and the filesystem.
vxassist - This command can extend or shrink only a volume. You need to use fsadm to extend / shrink a filesystem when you use vxassist.

Few Examples,

1. To grow a volume alone to 1GB :
# vxassist -g testdg growto testvol 1g

2. To extend a filesystem (after extending a volume).
# fsadm -b 1024m /test

3. To grow a volume by 500m,
# vxassist -g testdf growby testvol 500m

4. To shrink a volume to 1GB,
# vxassist -g testdg shrinkto testvol 1g

5. To shrink a volume by 1GB,
# vxassist -g testdg shrinkby testvol 1g

6. To extend a volume and its filesystem by 1GB
# vxresize -g datadg datavol +1g

7. To extend a volume and its filesystem to 2GB
# vxresize -g datadg datavol 2g