ONTAP Discussions

Help With Removing Stubs That Were symlinks

EdS
4,073 Views

We are running ONTAP 9.6P2.  We have a volume that houses symlinks to various CIFS shares.  The symlinks are created with:

New-NcSymlink -target /linkname  -linkname /vol/Groups/linkname

Add-NcCifsSymlink -unixpath /linkname/ -cifspath / -locality widelink -sharename linkname$

 

All is working well until we try and delete one of these.  We first delete the symlink:

RemoveNcCifsSymlink -Unixpath /linkname/

 

That works well, but when we try and delete the remaining stub file we get a No such file or directory error.

Remove-NcFile -Path "/vol/Groups/linkname"

 

We get the same errors if we remove all the symlinks and then try to remove all the remaining stubs in bulk using:

Read-NcDirectory -Path /vol/Groups | ?{ $_.Type -eq "symlink" } | %{ Remove-NcFile  -Path "/vol/Groups/$($_.Name)/"}

 

Also, if we try and delete the stubs via Windows command line del the response is that the object is not empty.  So how can we delete these stubs and why does the stub still function after the symlink is deleted?

 

1 ACCEPTED SOLUTION

EdS
3,836 Views

If we also remove the corresponding CIFS share then the stub may be deleted.

View solution in original post

3 REPLIES 3

donny_lang
4,006 Views

What version of the PSTK and PowerShell are you running? I labbed your commands in the following environment:

 

PowerShell Version: 5.1

PSTK Version: 9.7.1

ONTAP version: 9.6

 

PS H:\> New-NcSymlink -target /linkname -LinkName /vol/groups/linkname -VserverContext lab-svm-1000

Name                                     Type            Size      Created     Modified Owner Group   Perm Empty
----                                     ----            ----      -------     -------- ----- -----   ---- -----
linkname                                 symlink         9 B     2/24/2020    2/24/2020     0     0    755

PS H:\> Read-NcDirectory -VserverContext lab-svm-1000 -Path /vol/groups | ?{$_.Type -eq "symlink"}

Name                                     Type            Size      Created     Modified Owner Group   Perm Empty
----                                     ----            ----      -------     -------- ----- -----   ---- -----
linkname                                 symlink         9 B     2/24/2020    2/24/2020     0     0    755


PS H:\> Read-NcDirectory -VserverContext lab-svm-1000 -Path /vol/groups | ?{$_.Type -eq "symlink"} | Remove-NcFile

Delete file
Are you sure you want to delete file /vol/groups/linkname?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): y
PS H:\>

 

Unfortunately, I was not able to replicate your issue. Does your "Groups" volume contain a capital "G" like in your code examples? I assume so because it's referenced in that way in your "New-NcSymlink" command, but I wanted to double-check. Wouldn't be the first time I got burned by case-sensitivity. 🙂 

EdS
3,964 Views

PS Toolkit - 9.7.1

PS - 5.1

ONTAP 9.6

The G is uppercase in the name Groups.

EdS
3,837 Views

If we also remove the corresponding CIFS share then the stub may be deleted.

Public