#User error using ONTAP cli extended query?

1 messages · Page 1 of 1 (latest)

lilac vigil
#

I am trying to unmount/offline/delete all volumes that start with volume name "to_" and that has less than 3 snapshots. I use the following query to find them I use:

`hostname::> vol show -snapshot-count <3 -volume to_*
Vserver Volume Aggregate State Type Size Available Used%


svm-bu-file to_sv_vol_staff_foo_bar aggr_backup_1n_hostname online DP 204.8GB 204.8GB 0%
...etc...`

I find 110 entries that match, I want to use this to first unmount, then offline and lastly delete.

So I normaly take the search I did previously "vol show -snapshot-count <3 -volume to_*" and edit the line to make "vol unmount { -snapshot-count <3 -volume to_*}"

For other work I do this work but for unmounting/offline/delete this always gives me the following:

hostname::> vol unmount {-snapshot-count <3 -volume to_*}

Error: Volume name: The first character must be a letter or underscore.

I have looked at the article https://docs.netapp.com/us-en/ontap/system-admin/methods-specifying-queries-concept.html

Am I missing something in my thought process or can't I use wildcards in that extended query?

copper crown
#

Loving the hearts! ❤️
I'm pretty sure the unmount/offline/delete operations does not accept queries.

balmy prawn
#

yes, volume unmount and volume offline do not support queries. But you can woirk around that!
Instead of using volume offline -volume foo, use volume modify -volume foo -state offline
In the CLI, you don't need to unmount the volume first if you set -confirmations off, it will do that automatically when you offline the volume. If you still want to unmount the volume first, you can use volume modify -volume foo -junction-active false instead of volume unmount -volume foo. It's not exactly the same but it works fine for sliencing the "In order to offline the volume, it must be unmounted first" warning