When you need to delete a large number of files and folders, serial deletion by running
rm -rf across a large directory tree can take a while. The trash folder gives you a faster method.
The trash folder is a hidden folder named .vast_trash into which you can move any files and folder that you want to delete. The files and folders are automatically deleted for you from the trash folder asynchronously.
The trash folder is supported for clients using NFSv3 on Linux and for S3 clients. (For information about usage via S3, see Trash Folder Fast Deletion).
Access to the trash folder is granted to NFSv3 hosts per view policy. It also requires the no squash policy to be enabled for the host, and a global trash access setting to be enabled on the cluster.
The operation of moving files into the trash folder is supported for the root user only by default. It is also possible to allow other users access by adding them to a specific user group and specifying the group's GID.
The trash folder feature must be enabled globally in the VAST Web UI. Permission may be granted to hosts through either the VAST Web UI or the VAST CLI.
In the VAST Web UI, the option to grant trash folder access is disabled by default and needs to be separately enabled in the Settings.
Enable the global ability to grant trash folder access:
The option to grant trash folder access now appears in the Add Policy and Update Policy dialogs:
To grant trash folder access to a host, add the host to both the Trash Folder Access and No Squash access type lists. Note that a more restrictive access type overrides a less restrictive access type. Therefore, if the host is also listed for Root Squash or All Squash, trash folder access will effectively be disabled on the host for the root user.
For the workflow for configuring an NFS-enabled view and view policy, see Enabling NFS Access.
The ability to grant trash folder access must be globally enabled through the VAST Web UI.
When creating (viewpolicy create) or modifying (viewpolicy modify) a view policy, include the
--trash-access option and the
--nfs-no-squash option. With both options, specify an IP list including any host IPs to which you want to grant trash folder access. You need to be sure you want to apply the no squash policy and allow the root user to access the trash folder. With the no squash policy, the root user can perform all file and folder operations.
For example, in the following view policy, the host 10.0.0.4 is granted both trash access permission and no squash policy. This host will be able to access the trash folder provided the global Enable trash folder access setting is enabled through the VAST Web UI:
vcli: admin> viewpolicy create --name multipro1 --flavor nfs --enable-auth-provider --read-write 10.0.0.* --read-only 10.0.0.1 --nfs-all-squash 10.0.0.3 --nfs-no-squash 10.0.0.4 --trash-access 10.0.0.4 --smb-file-mode 664 --smb-directory-mode 775
Note that a more restrictive access type overrides a less restrictive access type. Therefore, if the host is also specified for root squash or all squash, trash folder access will effectively be disabled on the host for the root user.
Once trash folder access is enabled for the host machine, the root user can delete files and folders by moving them into the trash folder:
$ sudo mv /export/path/to/folder /export/.vast_trash