Skip to content

Commit 6633bf5

Browse files
authored
Improve instructions for using example runAfter shell script
1 parent 3f7d0cc commit 6633bf5

File tree

1 file changed

+36
-8
lines changed

1 file changed

+36
-8
lines changed

articles/azure-netapp-files/azacsnap-cmd-ref-runbefore-runafter.md

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services: azure-netapp-files
55
author: Phil-Jensen
66
ms.service: azure-netapp-files
77
ms.topic: reference
8-
ms.date: 07/29/2022
8+
ms.date: 02/20/2025
99
ms.author: phjensen
1010
---
1111

@@ -39,24 +39,28 @@ The following list of environment variables is generated by `azacsnap` and passe
3939
> [!NOTE]
4040
> There's only a value for `$azSnapshotName` in the `--runafter` option.
4141
42-
### Example usage
42+
### Example usage to backup to Azure Blob storage
43+
44+
> [!IMPORTANT]
45+
> Examples are provided for informational purposes only.
46+
> We do not guarantee the accuracy, completeness, or usefulness of any information provided.
47+
> The use of these examples is at your own risk.
48+
> We do not accept any liability for any loss or damage that may arise from the use of these examples.
49+
> We do not offer support for the examples provided in this documentation.
4350
4451
An example usage for this new feature is to upload a snapshot to Azure Blob for archival purposes using the azcopy tool
4552
([Copy or move data to Azure Storage by using AzCopy](../storage/common/storage-use-azcopy-v10.md)).
4653

47-
The following crontab entry is a single line and runs `azacsnap` at five past midnight. Note the call to `snapshot-to-blob.sh` passing the
48-
snapshot name and snapshot prefix:
49-
50-
```output
51-
5 0 * * * ( . ~/.bash_profile ; cd /home/azacsnap/bin ; ./azacsnap -c backup --volume data --prefix daily --retention 1 --configfile HANA.json --trim --ssl openssl --runafter 'env ; ./snapshot-to-blob.sh $azSnapshotName $azPrefix')
52-
```
54+
#### Shell script to upload to Azure Blob storage
5355

5456
This example shell script has a special stanza at the end to prevent AzAcSnap from killing the external command due to the timeout described earlier. This allows for
5557
a long running command, such as uploading large files with azcopy, to be run without being prematurely stopped.
5658

5759
The snapshots need to be mounted on the system doing the copy, with at a minimum read-only privilege. The base location of the mount point for the snapshots should
5860
be provided to the `sourceDir` variable in the script.
5961

62+
The snapshot is uploaded as a single file by using the `tar` command to create a gzipped tarball. This is done to keep the file permissions and ownership as uploading the files individually will lose these attributes.
63+
6064
```bash
6165
cat snapshot-to-blob.sh
6266
```
@@ -240,6 +244,30 @@ cat blob-credentials.saskey
240244
PORTAL_GENERATED_SAS="https://<targetstorageaccount>.blob.core.windows.net/<blob-store>?sp=racwl&st=2021-06-10T21:10:38Z&se=2021-06-11T05:10:38Z&spr=https&sv=2020-02-10&sr=c&sig=<key-material>"
241245
```
242246

247+
#### Scheduling the shell script
248+
249+
The following crontab entry is a single line and runs `azacsnap` at five past midnight. Note the call to `snapshot-to-blob.sh` passing the
250+
snapshot name and snapshot prefix:
251+
252+
```output
253+
5 0 * * * ( . ~/.bash_profile ; cd /home/azacsnap/bin ; ./azacsnap -c backup --volume data --prefix daily --retention 1 --configfile HANA.json --trim --ssl openssl --runafter 'env ; ./snapshot-to-blob.sh $azSnapshotName $azPrefix')
254+
```
255+
256+
#### Restoring from Azure Blob storage
257+
258+
Restoring from one of these archives stored in Azure Blob storage at a high-level is as follows:
259+
260+
1. Copy the snapshot archive back to the local machine into an area separate from the database files but with enough capacity to allow for the file archive and the extraction (e.g., /var/tmp).
261+
1. If they created the archive using the `--runafter` example shell script, then they can possibly extract the gzipped tarball directly from Azure Blob storage into the target location using an AzCopy pipe to tar to extract, for example:
262+
1. `cd ${TARGET_DIRECTORY}`
263+
1. `azcopy cp "${BLOB_STORE}/${ARCHIVE_BLOB_TGZ}?${BLOB_SAS_KEY}" --from-to BlobPipe | tar zxvf -`
264+
1. Extract the contents of the snapshot archive.
265+
1. Review the contents of the target location after extracting, comparing file permissions and ownership to the original database files.
266+
1. For example, do `ls -lR`.
267+
1. Shutdown the database server.
268+
1. Copy the files from the target location restored to in step 1 back to their original location.
269+
1. Proceed with the normal database recovery process.
270+
243271
## Next steps
244272

245273
- [Take a backup](azacsnap-cmd-ref-backup.md)

0 commit comments

Comments
 (0)