Jump to content
Welcome to our new Citrix community!
  • 0

Reclaim lvm disk space on Xenserver 7.2


Reg Dancy1709159709

Question

12 answers to this question

Recommended Posts

You can do an SR scan, but depending on many factors such as what you have for snapshots, thin vs. thick provisioning, etc.  your results will vary.

Unfortunately in some cases, the best way is to move all the VMs to different storage to totally empty out the SR and then move the VMs back to it again.

 

-=Tobias

Link to comment

Reclaim Space on an LVM based SR will send a SCSI DISCARD request for all the unused data space in the LUN so that the storage array can release resources not currently being used such that they can be used by other clients of the array.

 

Reclaim space will not cause the amount of space in use by the XenServer virtual disks to be changed, if XenServer says that it is using 90% of the LUN then it really is using 90% of the LUN. It may be that the reason for this is that are old hidden VHD nodes left behind after deleting snapshots which require to be garbage collected, but if there is insufficient free space to allow data to be copied from the child node to its parent so that the child node becomes redundant then the coalescing process cannot be completed.

 

The /var/log/SMlog file will show errors if the garbage collection process is trying to coalesce and being prevented by a lack of free space. If you are in this situation then you only have two options 

  • Provide more space to the LUN on the SAN and rescan the SR so that it resizes
  • Remove some more data from the SR
    • either delete more snapshots, you might get enough free space.
    • migrate one or more VMs to a different SR

 

Link to comment

Here's the output from SMlog when I performed the reclaim freed space a few days ago:

 

# cd /var/log/
[root@dwdccmswing1 log]# tail -f SMlog
Mar  8 12:40:39 dwdccmswing1 SM: [27855] Entering _checkMetadataVolume
Mar  8 12:40:39 dwdccmswing1 SM: [27855] LVMCache: will initialize now
Mar  8 12:40:39 dwdccmswing1 SM: [27855] LVMCache: refreshing
Mar  8 12:40:39 dwdccmswing1 SM: [27855] ['/sbin/lvs', '--noheadings', '--units', 'b', '-o', '+lv_tags', '/dev/VG_XenStorage-6302ea96-3924-ced9-6317-ab4b9a8209c7']
Mar  8 12:40:39 dwdccmswing1 SM: [27852]   pread SUCCESS
Mar  8 12:40:39 dwdccmswing1 SM: [27855]   pread SUCCESS
Mar  8 12:40:39 dwdccmswing1 SM: [27852] vdi_epoch_end {'sr_uuid': '6302ea96-3924-ced9-6317-ab4b9a8209c7', 'subtask_of': 'DummyRef:|c898d772-0491-7679-7d9c-03509019dfee|VDI.epoch_end', 'vdi_ref': 'OpaqueRef:4c8cc002-d9f1-2cef-7fb3-af7613bcf3f0', 'vdi_on_boot': 'persist', 'args': [], 'vdi_location': '9bd97ea8-bbb2-42ed-85ef-2ca2fede714b', 'host_ref': 'OpaqueRef:717329e6-de59-c3e5-960e-52b826b649e9', 'session_ref': 'OpaqueRef:914f9435-0911-afca-60c3-3a82c09de42b', 'device_config': {'target': '172.31.225.100', 'multihomelist': '172.31.225.100:3260,172.31.225.103:3260,172.31.225.105:3260,172.31.225.107:3260,172.31.225.102:3260,172.31.225.101:3260,172.31.225.104:3260,172.31.225.106:3260', 'targetIQN': 'iqn.2010-06.com.purestorage:flasharray.3c9bf12bd7c53cf3', 'SRmaster': 'false', 'device': '/dev/disk/mpInuse/3624a93701ab79778588c412e0001103b', 'SCSIid': '3624a93701ab79778588c412e0001103b', 'port': '3260'}, 'command': 'vdi_epoch_end', 'vdi_allow_caching': 'false', 'sr_ref': 'OpaqueRef:3ea173ff-e3da-60e6-4603-d04538a3786d', 'vdi_uuid': '9bd97ea8-bbb2-42ed-85ef-2ca2fede714b'}
Mar  8 12:40:39 dwdccmswing1 SM: [27855] vdi_epoch_end {'sr_uuid': '6302ea96-3924-ced9-6317-ab4b9a8209c7', 'subtask_of': 'DummyRef:|99ee324f-134a-9d84-8efd-41faada8e75a|VDI.epoch_end', 'vdi_ref': 'OpaqueRef:990bb0c3-9c1a-3f2f-78ff-a52040bead4a', 'vdi_on_boot': 'persist', 'args': [], 'vdi_location': '531fda7d-5c42-4611-8e1f-e51021245673', 'host_ref': 'OpaqueRef:717329e6-de59-c3e5-960e-52b826b649e9', 'session_ref': 'OpaqueRef:0853c055-3ba3-1900-a8e6-45153fd2b900', 'device_config': {'target': '172.31.225.100', 'multihomelist': '172.31.225.100:3260,172.31.225.103:3260,172.31.225.105:3260,172.31.225.107:3260,172.31.225.102:3260,172.31.225.101:3260,172.31.225.104:3260,172.31.225.106:3260', 'targetIQN': 'iqn.2010-06.com.purestorage:flasharray.3c9bf12bd7c53cf3', 'SRmaster': 'false', 'device': '/dev/disk/mpInuse/3624a93701ab79778588c412e0001103b', 'SCSIid': '3624a93701ab79778588c412e0001103b', 'port': '3260'}, 'command': 'vdi_epoch_end', 'vdi_allow_caching': 'false', 'sr_ref': 'OpaqueRef:3ea173ff-e3da-60e6-4603-d04538a3786d', 'vdi_uuid': '531fda7d-5c42-4611-8e1f-e51021245673'}
Mar  8 12:40:39 dwdccmswing1 SM: [27852] lock: closed /var/lock/sm/6302ea96-3924-ced9-6317-ab4b9a8209c7/sr
Mar  8 12:40:39 dwdccmswing1 SM: [27855] lock: closed /var/lock/sm/6302ea96-3924-ced9-6317-ab4b9a8209c7/sr
Mar  8 17:15:20 dwdccmswing1 SM: [32132] on-slave.multi: {'vgName': 'VG_XenStorage-94afb247-8d34-71d9-ff46-b3da7d3ebb48', 'lvName1': 'VHD-a24c6d97-c8b0-4dec-9dc9-6de30b81dd39', 'action1': 'deactivateNoRefcount', 'action2': 'cleanupLock', 'uuid2': 'a24c6d97-c8b0-4dec-9dc9-6de30b81dd39', 'ns2': 'lvm-94afb247-8d34-71d9-ff46-b3da7d3ebb48'}
Mar  8 17:15:20 dwdccmswing1 SM: [32132] LVMCache created for VG_XenStorage-94afb247-8d34-71d9-ff46-b3da7d3ebb48
Mar  8 17:15:20 dwdccmswing1 SM: [32132] on-slave.action 1: deactivateNoRefcount
Mar  8 17:15:20 dwdccmswing1 SM: [32132] LVMCache: will initialize now
Mar  8 17:15:20 dwdccmswing1 SM: [32132] LVMCache: refreshing
Mar  8 17:15:20 dwdccmswing1 SM: [32132] ['/sbin/lvs', '--noheadings', '--units', 'b', '-o', '+lv_tags', '/dev/VG_XenStorage-94afb247-8d34-71d9-ff46-b3da7d3ebb48']
Mar  8 17:15:20 dwdccmswing1 SM: [32132]   pread SUCCESS
Mar  8 17:15:20 dwdccmswing1 SM: [32132] ['/sbin/lvchange', '-an', '/dev/VG_XenStorage-94afb247-8d34-71d9-ff46-b3da7d3ebb48/VHD-a24c6d97-c8b0-4dec-9dc9-6de30b81dd39']
Mar  8 17:15:21 dwdccmswing1 SM: [32132]   pread SUCCESS
Mar  8 17:15:21 dwdccmswing1 SM: [32132] ['/sbin/dmsetup', 'status', 'VG_XenStorage--94afb247--8d34--71d9--ff46--b3da7d3ebb48-VHD--a24c6d97--c8b0--4dec--9dc9--6de30b81dd39']
Mar  8 17:15:21 dwdccmswing1 SM: [32132]   pread SUCCESS
Mar  8 17:15:21 dwdccmswing1 SM: [32132] on-slave.action 2: cleanupLock
Mar  8 17:15:55 dwdccmswing1 SM: [32370] on-slave.multi: {'vgName': 'VG_XenStorage-94afb247-8d34-71d9-ff46-b3da7d3ebb48', 'lvName1': 'VHD-47d6b9a5-aec7-4a24-a31c-e4b4322f1b17', 'action1': 'deactivateNoRefcount', 'action2': 'cleanupLock', 'uuid2': '47d6b9a5-aec7-4a24-a31c-e4b4322f1b17', 'ns2': 'lvm-94afb247-8d34-71d9-ff46-b3da7d3ebb48'}
Mar  8 17:15:55 dwdccmswing1 SM: [32370] LVMCache created for VG_XenStorage-94afb247-8d34-71d9-ff46-b3da7d3ebb48
Mar  8 17:15:55 dwdccmswing1 SM: [32370] on-slave.action 1: deactivateNoRefcount
Mar  8 17:15:55 dwdccmswing1 SM: [32370] LVMCache: will initialize now
Mar  8 17:15:55 dwdccmswing1 SM: [32370] LVMCache: refreshing
Mar  8 17:15:55 dwdccmswing1 SM: [32370] ['/sbin/lvs', '--noheadings', '--units', 'b', '-o', '+lv_tags', '/dev/VG_XenStorage-94afb247-8d34-71d9-ff46-b3da7d3ebb48']
Mar  8 17:15:55 dwdccmswing1 SM: [32370]   pread SUCCESS
Mar  8 17:15:55 dwdccmswing1 SM: [32370] ['/sbin/lvchange', '-an', '/dev/VG_XenStorage-94afb247-8d34-71d9-ff46-b3da7d3ebb48/VHD-47d6b9a5-aec7-4a24-a31c-e4b4322f1b17']
Mar  8 17:15:56 dwdccmswing1 SM: [32370]   pread SUCCESS
Mar  8 17:15:56 dwdccmswing1 SM: [32370] ['/sbin/dmsetup', 'status', 'VG_XenStorage--94afb247--8d34--71d9--ff46--b3da7d3ebb48-VHD--47d6b9a5--aec7--4a24--a31c--e4b4322f1b17']
Mar  8 17:15:56 dwdccmswing1 SM: [32370]   pread SUCCESS
Mar  8 17:15:56 dwdccmswing1 SM: [32370] on-slave.action 2: cleanupLock
Mar  8 17:16:23 dwdccmswing1 SM: [32582] on-slave.multi: {'vgName': 'VG_XenStorage-94afb247-8d34-71d9-ff46-b3da7d3ebb48', 'lvName1': 'VHD-b7c2a77c-f873-421f-9a91-c8a313c80209', 'action1': 'deactivateNoRefcount', 'action2': 'cleanupLock', 'uuid2': 'b7c2a77c-f873-421f-9a91-c8a313c80209', 'ns2': 'lvm-94afb247-8d34-71d9-ff46-b3da7d3ebb48'}
Mar  8 17:16:23 dwdccmswing1 SM: [32582] LVMCache created for VG_XenStorage-94afb247-8d34-71d9-ff46-b3da7d3ebb48
Mar  8 17:16:23 dwdccmswing1 SM: [32582] on-slave.action 1: deactivateNoRefcount
Mar  8 17:16:23 dwdccmswing1 SM: [32582] LVMCache: will initialize now
Mar  8 17:16:23 dwdccmswing1 SM: [32582] LVMCache: refreshing
Mar  8 17:16:23 dwdccmswing1 SM: [32582] ['/sbin/lvs', '--noheadings', '--units', 'b', '-o', '+lv_tags', '/dev/VG_XenStorage-94afb247-8d34-71d9-ff46-b3da7d3ebb48']
Mar  8 17:16:24 dwdccmswing1 SM: [32582]   pread SUCCESS
Mar  8 17:16:24 dwdccmswing1 SM: [32582] ['/sbin/lvchange', '-an', '/dev/VG_XenStorage-94afb247-8d34-71d9-ff46-b3da7d3ebb48/VHD-b7c2a77c-f873-421f-9a91-c8a313c80209']
Mar  8 17:16:24 dwdccmswing1 SM: [32582]   pread SUCCESS
Mar  8 17:16:24 dwdccmswing1 SM: [32582] ['/sbin/dmsetup', 'status', 'VG_XenStorage--94afb247--8d34--71d9--ff46--b3da7d3ebb48-VHD--b7c2a77c--f873--421f--9a91--c8a313c80209']
Mar  8 17:16:24 dwdccmswing1 SM: [32582]   pread SUCCESS
Mar  8 17:16:24 dwdccmswing1 SM: [32582] on-slave.action 2: cleanupLock
Mar  8 17:16:44 dwdccmswing1 SM: [32717] on-slave.multi: {'vgName': 'VG_XenStorage-94afb247-8d34-71d9-ff46-b3da7d3ebb48', 'lvName1': 'VHD-OLD_dd272c56-d9e8-4148-bad6-3292d026db75', 'action1': 'deactivateNoRefcount', 'action2': 'cleanupLock', 'uuid2': 'OLD_dd272c56-d9e8-4148-bad6-3292d026db75', 'ns2': 'lvm-94afb247-8d34-71d9-ff46-b3da7d3ebb48'}
Mar  8 17:16:44 dwdccmswing1 SM: [32717] LVMCache created for VG_XenStorage-94afb247-8d34-71d9-ff46-b3da7d3ebb48
Mar  8 17:16:44 dwdccmswing1 SM: [32717] on-slave.action 1: deactivateNoRefcount
Mar  8 17:16:44 dwdccmswing1 SM: [32717] LVMCache: will initialize now
Mar  8 17:16:44 dwdccmswing1 SM: [32717] LVMCache: refreshing
Mar  8 17:16:44 dwdccmswing1 SM: [32717] ['/sbin/lvs', '--noheadings', '--units', 'b', '-o', '+lv_tags', '/dev/VG_XenStorage-94afb247-8d34-71d9-ff46-b3da7d3ebb48']
Mar  8 17:16:44 dwdccmswing1 SM: [32717]   pread SUCCESS
Mar  8 17:16:44 dwdccmswing1 SM: [32717] ['/sbin/lvchange', '-an', '/dev/VG_XenStorage-94afb247-8d34-71d9-ff46-b3da7d3ebb48/VHD-OLD_dd272c56-d9e8-4148-bad6-3292d026db75']
Mar  8 17:16:45 dwdccmswing1 SM: [32717]   pread SUCCESS
Mar  8 17:16:45 dwdccmswing1 SM: [32717] ['/sbin/dmsetup', 'status', 'VG_XenStorage--94afb247--8d34--71d9--ff46--b3da7d3ebb48-VHD--OLD_dd272c56--d9e8--4148--bad6--3292d026db75']
Mar  8 17:16:45 dwdccmswing1 SM: [32717]   pread SUCCESS
Mar  8 17:16:45 dwdccmswing1 SM: [32717] on-slave.action 2: cleanupLock

 

Not sure exactly if cleanup was successful or not

Link to comment
14 hours ago, Reg Dancy1709159709 said:

Here's the output from SMlog when I performed the reclaim freed space a few days ago:

 

.

.

.

 

Not sure exactly if cleanup was successful or not

 

Nothing in that log shows any form of Space Reclaim or Garbage Collection occurring, it's all to do with VM lifecycle (i.e. start stop etc) operations.

 

You should see log entries with a prefix of SMGC if the garbage collector is active (it starts automatically on VDI deletion or if you scan the SR). The reclaim space operation will log a line like

do_trim: 

when it is started.

 

Mark.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...