Step 1: scan your SR for orphaned VHDs
vhd-util scan -f -m “VHD-*” -l “VG_XenStorage-<uuid_of_SR>” –p
for example:
[root@MytestCase]# vhd-util scan -f -m “VHD-*” -l “VG_XenStorage-99dfb8a9-2dcc-b610-45ca-2010fb0e475b” -p
vhd=VHD-75fa7730-091d-4d6b-bcae-79ae11efa79d capacity=21474836480 size=21525168128 hidden=1 parent=none
vhd=VHD-7ec19bd2-1c86-44c0-83f1-aab4c8bd7e41 capacity=26843545600 size=26902265856 hidden=1 parent=none
vhd=VHD-902f17f1-c254-4cde-8519-a004b8721581 capacity=64424509440 size=64558727168 hidden=1 parent=none
vhd=VHD-94bc9c71-6e33-4281-9c1d-9ecd6f1da4c0 capacity=16106127360 size=16143876096 hidden=1 parent=none
vhd=VHD-975c1983-449c-4021-9843-3a6f5d36f564 capacity=21474836480 size=21525168128 hidden=1 parent=none
vhd=VHD-cb0d1245-2445-455f-bb17-3331172def32 capacity=21474836480 size=21525168128 hidden=1 parent=none
vhd=VHD-d5c21ed0-3970-4ac9-8ce8-70a90f7ce147 capacity=16106127360 size=16143876096 hidden=1 parent=none
vhd=VHD-d6a48e7f-307c-4053-a2f2-f05e6abcab49 capacity=16106127360 size=16143876096 hidden=1 parent=none
vhd=VHD-fc646534-658a-4550-b7e8-f13c6fbfe935 capacity=16106127360 size=16143876096 hidden=1 parent=none
vhd=VHD-6a0e604d-439f-4ec5-85f1-090574cd8cce capacity=26843545600 size=26902265856 hidden=0 parent=none
Step 2:
Make a full copy of the VM and delete the old VM. Then check whether the chain is removed from the SR. this process will remove the VHD chain whereas step 3 should be used to remove the Orphan VHDs
Step 3:
if step 2 does not reclaim space, then try to remove the Orphan VHD
lvremove /dev/VG_Xenstorage-<uuid_of_SR>/VHD-uuid
For Ex:
[root@XENH3-TEST VG_XenStorage-3a490822-9d03-50ae-01a2-07e8d877bb17]# lvremove /dev/VG_XenStorage-3a490822-9d03-50ae-01a2-07e8d877bb17/VHD-b21c101c-8f66-4202-842a-eb7173bee109
/dev/sdb: read failed after 0 of 4096 at 0: Input/output error
/dev/sde: read failed after 0 of 4096 at 0: Input/output error
Logical volume “VHD-b21c101c-8f66-4202-842a-eb7173bee109″ successfully removed
/dev/ VG_XenStorage-<uuid of ur SR># ls -l
Step 4:
Change the hidden VHD to unhidden
vhd-util set -f hidden -v 0 -n <path to vhd file>
Note: to find out the path, type ls –l in /dev/ VG_XenStorage-<uuid of ur SR>
For Ex:
vhd-util set -f hidden -v 0 -n /dev/mapper/VG_XenStorage–99dfb8a9–2dcc–b610–45ca–2010fb0e475b-VHD–6a0e604d–439f–4ec5–85f1–090574cd8cce
Now you will be able to see the VHD in the XenCenter.
Step 4:
Now attach the disk to any VM, modify its size and start the VM
Now the disk which was used by dom 0 will be used by the VM
Step 5:
Now stop the VM, then deattach the disk and finally delete it
vhd-util scan -f -m “VHD-*” -l “VG_XenStorage-<uuid_of_SR>” –p
for example:
[root@MytestCase]# vhd-util scan -f -m “VHD-*” -l “VG_XenStorage-99dfb8a9-2dcc-b610-45ca-2010fb0e475b” -p
vhd=VHD-75fa7730-091d-4d6b-bcae-79ae11efa79d capacity=21474836480 size=21525168128 hidden=1 parent=none
vhd=VHD-7ec19bd2-1c86-44c0-83f1-aab4c8bd7e41 capacity=26843545600 size=26902265856 hidden=1 parent=none
vhd=VHD-902f17f1-c254-4cde-8519-a004b8721581 capacity=64424509440 size=64558727168 hidden=1 parent=none
vhd=VHD-94bc9c71-6e33-4281-9c1d-9ecd6f1da4c0 capacity=16106127360 size=16143876096 hidden=1 parent=none
vhd=VHD-975c1983-449c-4021-9843-3a6f5d36f564 capacity=21474836480 size=21525168128 hidden=1 parent=none
vhd=VHD-cb0d1245-2445-455f-bb17-3331172def32 capacity=21474836480 size=21525168128 hidden=1 parent=none
vhd=VHD-d5c21ed0-3970-4ac9-8ce8-70a90f7ce147 capacity=16106127360 size=16143876096 hidden=1 parent=none
vhd=VHD-d6a48e7f-307c-4053-a2f2-f05e6abcab49 capacity=16106127360 size=16143876096 hidden=1 parent=none
vhd=VHD-fc646534-658a-4550-b7e8-f13c6fbfe935 capacity=16106127360 size=16143876096 hidden=1 parent=none
vhd=VHD-6a0e604d-439f-4ec5-85f1-090574cd8cce capacity=26843545600 size=26902265856 hidden=0 parent=none
Step 2:
Make a full copy of the VM and delete the old VM. Then check whether the chain is removed from the SR. this process will remove the VHD chain whereas step 3 should be used to remove the Orphan VHDs
Step 3:
if step 2 does not reclaim space, then try to remove the Orphan VHD
lvremove /dev/VG_Xenstorage-<uuid_of_SR>/VHD-uuid
For Ex:
[root@XENH3-TEST VG_XenStorage-3a490822-9d03-50ae-01a2-07e8d877bb17]# lvremove /dev/VG_XenStorage-3a490822-9d03-50ae-01a2-07e8d877bb17/VHD-b21c101c-8f66-4202-842a-eb7173bee109
/dev/sdb: read failed after 0 of 4096 at 0: Input/output error
/dev/sde: read failed after 0 of 4096 at 0: Input/output error
Logical volume “VHD-b21c101c-8f66-4202-842a-eb7173bee109″ successfully removed
Note:
The above happens only if the VHD do not have a Symbolic link to it. you can check this by the following command/dev/ VG_XenStorage-<uuid of ur SR># ls -l
Step 4:
Change the hidden VHD to unhidden
vhd-util set -f hidden -v 0 -n <path to vhd file>
Note: to find out the path, type ls –l in /dev/ VG_XenStorage-<uuid of ur SR>
For Ex:
vhd-util set -f hidden -v 0 -n /dev/mapper/VG_XenStorage–99dfb8a9–2dcc–b610–45ca–2010fb0e475b-VHD–6a0e604d–439f–4ec5–85f1–090574cd8cce
Now you will be able to see the VHD in the XenCenter.
Step 4:
Now attach the disk to any VM, modify its size and start the VM
Now the disk which was used by dom 0 will be used by the VM
Step 5:
Now stop the VM, then deattach the disk and finally delete it
No comments:
Post a Comment