NetApp Community Update
This site will enter Read Only mode on July 23 as we prepare to move to a new platform.
You will still be able to view content, but posting and replying will be temporarily disabled.
To learn more, please review the information in this blog post.

Microsoft Virtualization Discussions

Getting read only Volume

JGPSHNTAP
5,586 Views

I figured this one would be fairly simple and I reviewed the help for both get-navol and get-navoloption but i'm not able to find exactly what I was looking for.

I'm basically looping through our environment removing old snaps based on a criteria set but some filers have both source and snapmirrored (r/o) volumes.  I was hoping there was an option in get-navol for read ony but i didn't see it anywhere

Am I just overlooking this?

Here's my basic code

$45day =  Get-NaVol | where {$_.state -eq "online" }`

    | Get-NaSnapshot | where {((get-date)-$_.created).days -gt 46}

1 ACCEPTED SOLUTION

timothyn
5,586 Views

You'll have to look at the RaidStatus property, which contains more than just the read-only flag.  So you can use "-match" or "-notmatch" like this:

PS C:\> get-navol | ? {$_.RaidStatus -match "read-only"} | ft Name, State, RaidStatus

Name                                State                              RaidStatus                       

----                                -----                              ----------                       

rre1deleteme                        online                             raid_dp,snapmirrored,read-only   

rresql                              online                             raid_dp,snapmirrored,read-only   

Cheers!

Eric

View solution in original post

2 REPLIES 2

timothyn
5,587 Views

You'll have to look at the RaidStatus property, which contains more than just the read-only flag.  So you can use "-match" or "-notmatch" like this:

PS C:\> get-navol | ? {$_.RaidStatus -match "read-only"} | ft Name, State, RaidStatus

Name                                State                              RaidStatus                       

----                                -----                              ----------                       

rre1deleteme                        online                             raid_dp,snapmirrored,read-only   

rresql                              online                             raid_dp,snapmirrored,read-only   

Cheers!

Eric

JGPSHNTAP
5,586 Views

Eric,

Thanks for the quick response.. I was "assuming" this would be a Boolean property under get-navol.

I have updated my code and am testing it now..

$45day =  Get-NaVol | where {$_.state -eq "online" -and $_.raidstatus -notmatch "read-only"}`

    | Get-NaSnapshot | where {((get-date)-$_.created).days -gt 46}

Next I will be piping it to | remove-nasnapshot -confirm:$false

Public