In HPE 3par or Primera storage, we have noticed that, sometimes when we deleted disks of virtual machines but didn't get back space to storage. Such issue occurred in storage when vvols not deleting from storage back-end.
To remove vvols from storage back-end, we need to run below commands on Storage CLI.
Below steps need to be carefully followed before removing the vvols from container in storage.
1. Login on Storage via service account in CLI mode and check the container name.
HPE cli% showvvolsc
--------(MiB)--------
Name Num_VMs Num_VVols In_Use Provisioned
hpe.vvol.ds01 269 1339 103369860 275678184
-------------------------------------------------------------
total 269 1339 103369860 275678184
showvvolsc command will show you the container name in HPE 3par or Primera storage. All vvols are part of this container.
2. To check the unbound vm_state, please run the below command.
HPE cli% showvvolvm -d -sc hpe.vvol.ds01
above command which show you the below parameter which you require to check that vm state.
VM_Name - Virtual machine name
UUID - Virtual machine UUID number
Num_vv - Number of vvols present on virtual machine
Num_snap - Number of snapshot present on virtual machine
Physical - Total vvols size of virtual machines
Logical - Used vvols size of virtual machine in container
GuestOS - Operating system information
VM_State- Machine is power-on, unbound ( power-off or deleted) and bound state.
UsrCPG - CPG of storage
SnpCPG - CPG of snapshot storage
Container - Name of container where all vvols are kept.
CreationTime - creation of vvols time.
3. To check the particular virtual machine vvol name from back-end, please run the below command.
HPE cli% showvvolvm -sc sys:all -vv redhat
-----(MiB)------
VM_Name VV_ID VVol_Name VVol_Type Prov Compr Dedup Physical Logical
redhat 8000 cfg-redhatba-e3fb20cb Config tpvv No No 2457 4096
8001 dat-redhatba-a8d0bea0 Data tpvv No No 9830 51200
8002 dat-redhatb-de253534-Snap Data snp NA NA 0 51200
--------------------------------------------------------------------------------------------
1 total 3 12287 106496
In above output, virtual machine name is "redhat" and it shows you the configuration file and vvol,snap data file information.
4. To remove this virtual machine "redhat" from the storage, we need to run below commands.
HPE cli% removevvset hpe.vvol.ds01 dat-redhatba-a8d0bea0
Remove dat-redhatba-a8d0bea0 from vv set hpe.vvol.ds01
select q=quit y=yes n=no: y
gb1inpst024.vvol.ds01 is a vVol storage container. vVols should not be removed from a vVol storage container individually. Instead use "setvvolsc -remove <vvsetname>" to remove the entire storage container. However, the matchbulkobjs environment variable can be used to remove vVols from a storage container. Use with caution.
Above error message is intresting. According to this message you need to set below CLI env.
HPE cli% setclienv matchbulkobjs 1
Now run the below command to delete the vvol and snap.
HPE cli% removevvset hpe.vvol.ds01 dat-redhatba-a8d0bea0
Remove dat-redhatba-a8d0bea0 from vv set hpe.vvol.ds01
select q=quit y=yes n=no: y
HPE cli% removevvset hpe.vvol.ds01 dat-hpeb-de253534-Snap
Remove dat-hpeb-de253534-Snap from vv set hpe.vvol.ds01
select q=quit y=yes n=no: y
Command to delete config file.
HPE cli% removevvset hpe.vvol.ds01 cfg-redhatba-e3fb20cb
Remove cfg-redhatba-e3fb20cb from vv set hpe.vvol.ds01
select q=quit y=yes n=no: y
Above "removevvset" command to use to remove virtual machine from container "hpe.vvol.ds01
5. Now remove the virtual machine vvol from storage to reclaim the space back, please use below command.
HPE cli% removevv dat-redhatba-a8d0bea0
Removing vv dat-redhatba-a8d0bea0
select q=quit y=yes n=no: y
VV dat-redhatba-a8d0bea0 has snapshot children which must be removed first.
If you are getting above message while deleting the data file, that means, you need to remove first snap file from storage then data file.
HPE cli% removevv dat-redhatb-de253534-Snap
Removing vv dat-redhatb-de253534-Snap
select q=quit y=yes n=no: y
HPE cli% removevv dat-redhatba-a8d0bea0
Removing vv dat-redhatba-a8d0bea0
select q=quit y=yes n=no: y
Remove config file:
HPE cli% removevv cfg-redhatba-e3fb20cb
Removing vv cfg-redhatba-e3fb20cb
select q=quit y=yes n=no: y
Once you remove all vvols and virtual machine from storage, please run the below command to check that virtual machine "redhat" exist or not.
HPE cli% showvvolvm -sc sys:all -vv redhat
No VM listed
if you are getting above message that means, virtual machine successfully remove from the storage and you can reclaim space back to storage.
You can run the below command to reclaim the space in CPG
HPE cli% compactcpg "CPG_NAME"
You can use "-dr" before run the reclaim the space, it will dry run and provide you the amount of space which you can reclaim.