Network Attached Storage​

 View Only

 How to scripts HNAS snapshots - rename and create

  • Network Attached Storage
  • Hitachi Network Attached Storage NAS
Gary Matthews's profile image
Gary Matthews posted 10-19-2021 09:50

An update to an earlier query - We're currently scanning and reporting on files on our HNAS4060. To stop last access times being updated we're scanning on the filesystem snapshots. This needs to be a static , so created a snapshot called CRAWLER . During testing I've manually renamed it for the next run so renamed the old CRAWLER to CRAWLER_date then created a new Crawler. Going forward the project would like a script they can kick off that would do this from the windows management server. I'm not a programmer but have looked at the powershell cmdlets and the api manual. I can see options for getting, creating and deleting snapshots but not renaming. Any ideas?

Any help much appreciated

Cheers

Johann du Toit's profile image
Johann du Toit

Hi Gary,

You can do this via the SSC commands as well.

 

SSC can be found on the firmware DVD of the HNAS Nodes and is also available for Windows.

This will allow you to run any CLI command.

Example Create:

ssc -u manager -p nasadmin 192.168.62.86 vn 1 snapshot-create --file-system Filesystem01 MySnapshot

Where vn is the Virtual Node (EVS) ID.

Example List:

ssc -u manager -p nasadmin 192.168.62.86 vn 1 snapshot-list --file-system Filesystem01

snapshot-list: executing on cluster node 4, though the EVS in context (1) is currently on cluster node 1

 

        Date/Time  Created Preserved Space    Name Status

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

2021-10-21 15:11:26+02:00 Manually       0 B MySnapshot Usable

 

File system is using block-based snapshots.

 

Example Rename:

ssc -u manager -p nasadmin 192.168.62.86 vn 1 snapshot-rename --file-system Filesystem01 MySnapshot MySnapshot01

 

Example List Again:

[root@rhel-76-1 ~]# ssc -u manager -p nasadmin 192.168.62.86 vn 1 snapshot-list --file-system Filesystem01

snapshot-list: executing on cluster node 4, though the EVS in context (1) is currently on cluster node 1

 

        Date/Time  Created Preserved Space     Name Status

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

2021-10-21 15:11:26+02:00 Manually       0 B MySnapshot01 Usable

 

File system is using block-based snapshots.

 

The password can also be base64 encoded, by using the SSC command with the flag -G and then specifying the encoded credentials with a -P (uppercase) flag.

 

Example:

ssc -G nasadmin

8IfYLuSE0QFexd/1jI6Ldg==

 

ssc -u manager -P 8IfYLuSE0QFexd/1jI6Ldg== 192.168.62.86 vn 1 snapshot-list --file-system Filesystem01

instead of:

ssc -u manager -p nasadmin 192.168.62.86 vn 1 snapshot-list --file-system Filesystem01