Veritas Cluster (VCS) is the most popular among others because I have seen VCS running on many mission critical systems, especially core banking systems were running on Veritas clusters.
In this article, we will show you how to create a Disk Group (DG), Volume and Filesystem using Veritas Volume Manager (VxVM) in Linux.
Veritas Volume Manager (VxVM) allows you to easily manage volumes and it improves performance and ensure data availability and integrity.
Step-1: Scanning LUNs
After the Storage team mapped the new LUN to the host, obtain the LUN id and keep it handy.
Use below command to scan/detect newly allocated LUNs from storage at OS level.
for disk_scan in `ls /sys/class/scsi_host`; do echo "Scanning $disk_scan…Completed"; echo "- - -" > /sys/class/scsi_host/$disk_scan/scan; done Scanning host0...Completed Scanning host1...Completed . . Scanning host[N]...Completed
Once the scanning is complete, use the below command to find out if the given LUN is found at the OS level.
ls -ltrh /dev/disk/by-id | grep -i [Last_Five_Digit_of_LUN]
Step-2: Identifying Disks using vxdisk
By default, all available disks are visible to Veritas Volume Manager (VxVM), which can be seen by using ‘vxdisk’ command as shown below.
vxdisk -e list DEVICE TYPE DISK GROUP STATUS OS_NATIVE_NAME ATTR emc_01 auto:none - - online invalid sdd - emc_02 auto:none - - online invalid sde - emc_03 auto:none - - online invalid sdf - sda auto:LVM - - LVM sda -
If you see the status as "Online invalid"
and type as "auto:none"
, this indicates that these disks have not yet been added to Veritas Volume Manager. But, double check the disk against the LUN ID before initializing the disk to make sure you are using the correct one, VxVM shows all disks as invalid because these disks are not initialized by Veritas Volume Manager (VxVM).
If the disks aren’t visible to VxVM, you can use the below command to scan the disk devices in the operating system device tree.
vxdisk scandisks
Understanding Naming Scheme
We can have disks naming scheme in two ways, Operating System based names (OS native) nor Enclosure based names. It’s advised to use Operating System Based names, which will help us to identify the correct disk easily.
To check the current naming scheme, run:
vxddladm get namingscheme NAMING_SCHEME PERSISTENCE LOWERCASE USE_AVID ============================================================ OS Native No Yes Yes
To change the naming scheme to Enclosure based names, run:
vxddladm set namingscheme=ebn
To check the value again, run:
vxddladm get namingscheme NAMING_SCHEME PERSISTENCE LOWERCASE USE_AVID ============================================================ Enclosure Based Yes Yes Yes
Step-3: Initializing Disks using vxdisksetup
Once the disks are visible to VxVM and you find the correct disk, then go ahead to initialize the disks using the vxdisksetup command. Let’s bring the 'sdd'
and 'sde'
disks to under control of VxVm.
vxdisksetup -i sdd
vxdisksetup -i sde
After bringing the disks into Veritas Volume Manager (VxVM), the disk status will change to "online"
and type "auto:cdsdisk"
. The cdsdisk stands for Cross-Platform Data Sharing Disk.
vxdisk -e list DEVICE TYPE DISK GROUP STATUS OS_NATIVE_NAME ATTR emc_01 auto:cdsdisk - - online sdd - emc_02 auto:cdsdisk - - online sde - emc_03 auto:none - - online invalid sdf - sda auto:LVM - - LVM sda -
To check the device information’s, run:
vxdisk list emc_01
Step-4: Creating Disk Group and adding disks
Disk Groups are similar to Volume Groups in LVM. We can create a Disk Group (DG) using vxdg command with required parameters as shown below: Let’s create a disk group named "testdg"
and add the identified disks ’emc_01′ and ’emc_02′ to the disk group “testdg”.
Syntax: vxdg init [DG_Name] [Any_Name_to_Disk_as_per_Your_Wish=Device_Name]
vxdg init testdg disk1=emc_01 disk2=emc_02
Make a Note: If you want to create a shared disk group, you may need to use ‘-s’ in the above command before the DG name. Veritas Cluster File System (CFS) allows the same file system to be mounted simultaneously on multiple nodes in the cluster. This is necessary if you are using an Active-Active (AA) cluster setup.
To check DG name, run:
vxdg list NAME STATE ID testdg enabled,cds 1245342109.13.linuxgeek
Now, DISK and GROUP details were updated as shown below:
vxdisk -e list DEVICE TYPE DISK GROUP STATUS OS_NATIVE_NAME ATTR emc_01 auto:cdsdisk disk1 testdg online sdd - emc_02 auto:cdsdisk disk2 testdg online sde - emc_03 auto:none - - online invalid sdf - sda auto:LVM - - LVM sda -
To check the disk group properties, run:
vxdg list testdg
Step-5: Creating Volume
Let’s create a Volume of 500GB using vxassist command as shown below: To create a Volume in MB use ‘m’ instead of ‘g’. This will create 500GB of 'testvol'
in the ‘testdg’.
Syntax: vxassist -g [DG_Name] make [Volume_Name] [Size(m|g)]
vxassist -g testdg make testvol1 500g
To check free space in the DG, run the below command: The vxassist ‘maxsize’ argument allows you to determine the maximum volume size you could create for named disk group “testdg” :
vxassist -g testdg maxsize
Maximum volume size: 4294899712 (2097119Mb)
Volume details can be checked using ‘vxlist’ command:
vxlist volume
Step-6: Creating VxFS Filesystem.
To create Veritas filesystem (VxFS), run:
mkfs -t vxfs /dev/vx/rdsk/testdg/testvol1
Make a Note: You need to create a filesystem on the RAW device (rdsk)
and not on the block device.
Step-7: Mounting Filesystem
Create a directory and mount the filesystem. For mounting, we need to use block device as shown below:
mkdir /data mount -t vxfs /dev/vx/dsk/testdg/testvol /data
We have successfully mounted VxFS and you can start using it as needed. You can add this to the /etc/fstab file if you want it to mount automatically on reboot.
Conclusion
In this tutorial, we’ve shown you how to create Disk Group (DG), Volume & vxfs Filesystem using Veritas Volume Manager (VxVM) in Linux with few easy steps.
If you have any questions or feedback, feel free to comment below.
Kindly support us by sharing this article with wider circle.