Sunday, April 24, 2011

shrinking snapmirror destination volumes

When the initial snapmirror relationship is setup, we typically have source and destination volumes of equal size. But when the source volume is shrunk:

vol size appdata -200g

the destination remains at its original size. The problem is we now have unclaimed space that is not reported by the usual tools (df, system manager etc) - the tools report what the source volume reports.

Over time you can end up with snapmirror destination volumes too large and the space allocated during the initial snapmirror is effectively not available for new snapmirror destination volumes (or any other use) until you free it by shrinking the snapmirror destination volume (example volume is "vol6" below):

0) df -A (check initial Aggregate usage level)
aggr1 14036753204 12158892092 1877861112 87%

1) snapmirror break vol6
2) vol options vol6 fs_size_fixed off
3) df -A (verify the space is returned to the aggr for reuse)
aggr1 14036753204 11812443012 2224310192 84% But how do you get ONTAP to report the unused space without going through the procedure above?

One method is

vol status -b

this will report the volume size and filesystem size in 4k blocks - I added some awk to show the difference in gb:

[root@backup1 ~]# ssh netapp-01 -l root vol status -b | awk '{print $0" diff = "($3-$4)*4096/1024/1024" gb"}'
Volume Block Size (bytes) Vol Size (blocks) FS Size (blocks)
------ ------------------ ------------------ ----------------
vol0 4096 25952256 25952256
vm6 4096 684510413 590558004 diff = 367002 gb
sg1 4096 8912896 8650752 diff = 1024 gb
web2 4096 14417920 13107200 diff = 5120 gb
backup1 4096 5242880 3932160 diff = 5120 gb
data1 4096 15204352 14417920 diff = 3072 gb
vm2 4096 667942912 563714458 diff = 407142 gb
archive1 4096 418906112 402653184 diff = 63488 gb
ora6 4096 275251200 251658240 diff = 92160 gb
fcapdata 4096 18350080 14417920 diff = 15360 gb
apdata 4096 367001600 348966093 diff = 70451.2 gb
ora4 4096 216006656 183500800 diff = 126976 gb
backup2 4096 443862221 322122548 diff = 475546 gb


Now this takes the guesswork out of where the space is overallocated and I can use the diff numbers to shrink the snapmirror volumes

Update 3/16/15

snapmirror break vm6
vol options vm6 fs_size_fixed off # This returns the space to the aggregate
snapmirror resync vm65net


1 comment:

tim said...

VCP,

if you do a snapmirror update of your volumes, the reduced filesystem size is transferred to your mirror volume. After the update you can shrink your mirror volume so the vol sizes are the same again.

1. (on NAS1) vol size vol_01 -100g
2. (on NAS2) snapmirror update -S NAS1:vol_01 NAS2:vol_01_mir
3. (on NAS2) vol size vol_01_mir -100g

Tim