Microsoft Virtualization Discussions

powershell commandlet for vol size cli

adaikkap
5,752 Views

Is the powershell cmdlets of  bGet-NaVolSize    Given the name of a flexible volume, return its current size in bytes.

same as the ontap cli vol size <volume name>?

Similary is  Set-NaVolSize  Given the name of a flexible volume, set the volume's size to the stated amount.

same as the ontap cli vol size <vol name> +/- new size ?

Regards

adai

6 REPLIES 6

paleon
5,752 Views

From my experience, the netapp cli command "vol size" returns size in the units in which size was set.  In other words, if I enter "vol size vol1 1200g" and then enter the command "vol size vol1," I will expect a result of "1200g".

The command "df vol1" would return size in kibibytes (KiB) or 1024 bytes.  The commandled "Get-NaVolSize vol1" command returns the size in bytes.

For example, here are the outputs for various commands in my environment for a volume named "vol1" (the volume name and NetApp names have been changed).  The volume size was set previously to 200g by using the command "vol size vol1 200g"

filer> vol size vol1
vol size: Flexible volume 'vol1' has size 200g.

filer> df vol1
Filesystem              kbytes       used      avail capacity  Mounted on
/vol/vol1/            188743680   80478696  108264984      43%  /vol/vol1/
/vol/vol1/.snapshot   20971520     373032   20598488       2%  /vol/vol1/.snapshot

PS> $volSize = Get-NaVolSize vol1

PS> $volSize.VolumeSize
214748364800

PS> $volSize.VolumeSize / 1GB
200

PowerShell allows conversion from bytes to Gibibytes (1 GiB = 1024^3 bytes) by dividing the bytes by 1GB.

When using Set-NaVolSize, the size is specified in the same format used by the NetApp CLI.  So, a NewSize value of "214748364800" is just as valid as "200g"

I hope that helps.

Bill

cknight
5,752 Views

Adai, the design point for the PowerShell Toolkit is to report all sizes, rates, etc. in bytes unless specifically stated otherwise.  The data formatters do reduce those to human-readable values with units, and the setter cmdlets accept both byte values as well as values with units.  The Toolkit invokes Data ONTAP APIs in most cases, rather than calling the CLI, but the Toolkit and CLI should obviously return the same results.

adaikkap
5,752 Views

Hi clinton,

Let me explain the situation.

Say i create a volume snapmirror between two filers f1 and f2.In order to make sure that the VSM update always succed and to avoid constant resizing of the vsm destination volume I create the volume to the size of the aggr.

So if i have a source volume f1:v1 of 10g and aggr on filer f2: of size 100G. now in order to create a VSM destination volume on filer f2 i create a volume v2 of size 100G with guarntee set to none.

Now, once the VSM baseline is completed. On the destination filer f2.

df -h will give the size of f2:v2 as 10G( same as source)

where as

vol size v2 will give the size as 100G( the size to which it was created)

so my question now is does running Get-NaVolSize will it reutrn 10g or 100G ?

I am looking for the command that will list 100G and not 10G.

Regards

adai

cknight
5,752 Views

Get-NaVolSize will return the actual size, ignoring snapshot reserve, etc.  That's what you want.

jburton
5,752 Views

Thanks Clinton and Glen...that solves my issue.

When the volume is a snapmirror destination and the source volume is smaller, there is a difference between the "df" results and the "vol size" results. 

Here is how the different volume sizes are reflected in the powershell commandlet's

  • Get-NaVolSize dest
    • Returns the results of "vol size dest"
  • Get-NaVol dest | Format-Table TotalSize
    • Returns the results of "df -g /vol/dest"

filer1> df -g /vol/dest

/vol/dest/             1GB    0GB    1GB   0%  /vol/dest/
/vol/dest/.snapshot    0GB    0GB    0GB   0%  /vol/dest/.snapshot

filer1> vol size dest

Warning: Volume 'dest' has fs_size_fixed option set.  The file system

size may differ from the volume size.

See 'vol status -b' for more detail.

vol size: Flexible volume 'dest' has size 5g.

filer1>

sizemore
5,752 Views

Get-NaVol will report the size actually being used.  The *-NaVolSize cmdlets are to modify the actual size.

it is different though...

apollo [0:90]≥ Invoke-NaSsh -Command 'df -g /vol/vmdata0'
Filesystem               total       used      avail capacity  Mounted on
/vol/vmdata0/           8192GB      135GB     6153GB      25%  /vol/vmdata0/
/vol/vmdata0/.snapshot     2048GB        0GB     2047GB       0%  /vol/vmdata0/.snapshot

apollo [0:91]≥ Get-NaVol vmdata0 | Select-Object -ExpandProperty SizeUsed | ConvertTo-FormattedNumber
145G

~Glenn

Public