Microsoft Virtualization Discussions

Getting read only Volume

JGPSHNTAP

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

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

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

JGPSHNTAP

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

Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public