We have a host with two disk controllers c1 & c2 and with 4 disks of equal size – c1t0d0 , c1t1d0 , c2t0d0 and c2t1d0
Adding Disks To VxVm
Add/initiate these disks to Veritas Volume manager with following conditions
- Add them to a new disk group – mydg
- Veritas Disk Names should be disk01,disk02,disk03 & disk04
- Do not encapsulate them , We will initialize them by destroying data.
- Create a default sliced Private region of 2048 Blocks ( 1024 KB)on each disk. Rest of the disk will be used by Public region
This can be done by two way. Either by the menu utility vxdiskadm
# vxdiskadm => Add or initialize disks
or directly by using this command four times-
# vxdiskadd cxtxdx
In Both case you have to answer some questions. It will even ask you to create our new diskgroup – mydg
When Done , List all disks by the command
# vxdisk list
DEVICE TYPE DISK GROUP STATUS
……
…..
c1t0d0s2 sliced disk01 mydg online
c1t1d0s2 sliced disk02 mydg online
c2t0d0s2 sliced disk03 mydg online
c2t1d0s2 sliced disk04 mydg online
…..
….
And u can check each disk with command –
# vxdisk list c1t0d0s2
Creating Subdisks on Each Veritas Disks
On each disk we will create two subdisks. Though in our example we will use only one subdisk from each disk to create our example volume.
The command syntax -
vxmake –g <dg-name> sd <subdisk-name> <disk-name>,<offset>,<lenth>
Length can be in sectors (default ) of like 200m , 2g . Offset is specified in sectors
How to find Offset
To find Free space on disks of a particular DG
# vxdg -g mydg free
( Do not put much wait on the numbers… all are imaginary )
DISK DEVICE TAG OFFSET LENGTH FLAGS
disk01 c1t0d0s2 c1t0d0 0 4189320 -
disk02 c1t1d0s2 c1t1d0 0 4189320 -
disk03 c2t0d0s2 c2t0d0 0 4189320 -
disk04 c2t1d0s2 c2t2d0 0 4189320 -
So on each disk we can use “0” as the offset to create the first subdisk .
Just showing the tasks related to first disk disk01
# vxmake –g mydg sd disk01-01 disk01,0,1500m
Check whether it is created or not
# vxprint -htr|grep disk01
SD NAME PLEX DISK DISKOFFS LENGTH [COL /]OFF DEVICE MODE
sd disk01-01 - disk01 0 3072000 - c1t0d0 ENA
Again Check free disk space
# vxdg -g mydg free
DISK DEVICE TAG OFFSET LENGTH FLAGS
disk01 c1t0d0s2 c1t0d0 3072000 1117320 -
disk02 c1t1d0s2 c1t1d0 0 4189320 -
disk03 c2t0d0s2 c2t0d0 0 4189320 -
disk04 c2t1d0s2 c2t2d0 0 4189320 -
Notice that offset as well as Length is changed for disk01
Now we will create the second subdisk disk01-02 on disk01 using this offset info.
# vxmake -g mydg sd disk01-02 disk01, 3072000,200m
Again Check Free space on disk01
# vxdg -g mydg free
DISK DEVICE TAG OFFSET LENGTH FLAGS
disk01 c1t0d0s2 c1t0d0 3481600 707720 -
disk02 c1t1d0s2 c1t1d0 0 4189320 -
disk03 c2t0d0s2 c2t0d0 0 4189320 -
disk04 c2t1d0s2 c2t2d0 0 4189320 -
Check that disk01 now contains two subdisk disk01-01 and disk01-02
# vxprint –htr
DM NAME DEVICE TYPE PRIVLEN PUBLEN STATE
SD NAME PLEX DISK DISKOFFS LENGTH [COL /]OFF DEVICE MODE
…………
dm disk01 c1t0d0 sliced 2159 8378640 -
………………..
sd disk01-01 - disk01 0 3072000 - c1t0d0 ENA
sd disk01-0 - disk01 3072000 409600 - c1t0d0 ENA
Create Subdisks accordingly on disk02,disk03 and disk04.. Keep the subdisk sizes same in each disk.>
Creating Plexes
The syntax to create concatenated plex is –
vxmake –g <dg-name> plex <plex-name> sd=<sd1,sd2,sd3….>
Whereas Syntax to create a striped plex is -
vxmake –g <dg-name> plex <plex-name> layout=stripe stwidth=32 ncolumn=3 sd=<sd1,sd2,sd3.>
In our example we will create Concatinated plexes , Instead of Striped Plexes…
# vxmake –g mydg plex data-main sd=disk01-01,disk02-01
Now we will create a Plex – datamirror only from sd – disk03-01 and then attach sd- disk04-01 to it separately just to learn . But Doing it in single step is better.
# vxmake –g mydg plex data-mirror sd=disk03-01
# vxsd assoc data-mirror disk04-01
# check Plexes status by command -
# vxprint –lp
# vxprint –l data-main
Creating Mirrored Volume
First create a volume – data from the plex data-main
# vxmake –U fsgen vol data plex=data-main
Now attach the second plex as a mirror
# vxplex att data data-mirror ( Syntax vmolex att <Volume> <plex> )
You can directly create the Mirrored Volume form both of the plexes-
# vxmake –U fsgen vol data plex=data-main,data-mirror
Note that Volume- data is of available size 3 GB .
Now the status of your newly created volume & plexes would be
# vxprint -htr
v data - DISABLED EMPTY 61440 ROUND - fsgen
pl data-main data DISABLED EMPTY 61440 CONCAT - RW
pl data-mirror data DISABLED EMPTY 61440 CONCAT - RW
sd disk01-01 data-main disk01 0 20480 0 c1t0d0 ENA
sd disk02-01 data-main disk02 20480 40960 20480 c1t1d0 ENA
sd disk03-01 data-mirror disk03 0 20480 0 c2t0d0 ENA
sd disk04-01 data-mirror disk04 20480 40960 20480 c2t1d0 ENA
You can now Initiate the volume
# vxvol start data
v data - ENABLED ACTIVE 61440 ROUND - fsgen
pl data-main data ENABLED ACTIVE 61440 CONCAT - RW
pl data-mirror data ENABLED ACTIVE 61440 CONCAT - RW
sd disk01-01 data-main disk01 0 20480 0 c1t0d0 ENA
sd disk02-01 data-main disk02 20480 40960 20480 c1t1d0 ENA
sd disk03-01 data-mirror disk03 0 20480 0 c2t0d0 ENA
sd disk04-01 data-mirror disk04 20480 40960 20480 c2t1d0 ENA
Now following two devices node files are already created
/dev/vx/dsk/mydg/data
/dev/vx/rdsk/mydg/data
You can create solaris ufs filesystem on the raw device
# newfs /dev/vx/rdsk/mydg/data
# mkdir /data
# mount /dev/vx/dsk/mydg/data /data
Now If you want to delele this volume
First unmount the Filesystem
# umount data
Then stop the volume .
# vxvol stop data ( data is the name of the volume )
Now delte the volume,associated pleses and subdisks recursively
# vxedit -rf rm data ( data is the name of the volume )
If u want to delete only the volume, nothing else
# vxedit -rm data ( data is the name of the volume )
No comments:
Post a Comment