Snapshot Management in Gaia Clish - Scheduled Snapshots
|
|
Important:
|
Before you create a snapshot image, make sure the appliance or storage destination meets the prerequisites.
Description
Manage system images (snapshots).
From R81, you can also configure scheduled system images (snapshots).
|
|
Notes:
|
Syntax
|
|
|
|
|
|
|
|
|
|
Procedure
-
Configure the scheduled snapshot task
R82 supports only one of these scheduled snapshot tasks.
You can only configure one task for a local LVM volume, one task for an FTP server, or one task for an SCP server.
Creating a new snapshot image as a local LVM volume
set snapshot-scheduled settings snapshot-name-prefix <Prefix of Snapshot Name> [description "<Description of Snapshot>"] target lvm
Note - Gaia Snapshots are not files, but Logical Volume Management (LVM) volumes. Gaia stores these snapshots as a disk partition. To show the list of virtual drives, run the "
lvs" command in the Expert mode.
Creating a new snapshot image as a file and uploading it to an SCP server
set snapshot-scheduled settings snapshot-name-prefix <Prefix of Snapshot Name> [description "<Description of Snapshot>"] target scp ip <IPv4 Address of SCP Server> path <Path on SCP Server> username <User Name on SCP Server> {password <Password in Plain Text> | password-hash <Password Hash>}
Important:
-
First, you must follow sk164234 to configure the SCP server as a trusted host on Gaia.
-
The username must have permissions to delete files on the SCP server.
Creating a new snapshot image as a file and uploading it to an FTP server
set snapshot-scheduled settings snapshot-name-prefix <Prefix of Snapshot Name> [description "<Description of Snapshot>"] target ftp ip <IPv4 Address of FTP Server> path <Path on FTP Server> username <User Name on FTP Server> {password <Password in Plain Text> | password-hash <Password Hash>}
Important -The username must have permissions to delete files on the FTP server.
-
-
Configure the recurrence for the snapshot schedule
Running one time on each day at specified time
set snapshot-scheduled recurrence daily time <HH:MM>
Running several times each day at specified times
set snapshot-scheduled recurrence hourly hours {<Hours> | all} at <0-59>
Running several times each day at specified intervals
set snapshot-scheduled recurrence interval minutes <1-59>
Running in specified months on specified days and at specified time
set snapshot–scheduled recurrence monthly month {<Months> | all} days <Days> time <HH:MM>
Running each week on specified days of week and at specified time
set snapshot-scheduled recurrence weekly days {<Days> | all} time <HH:MM> -
Configure the snapshot retention policy
Important:
-
This step applies only if you save the new snapshot image as a local LVM volume.
-
The retention policy applies only to the new snapshots (and does not apply to existing snapshots).
-
When Gaia creates new snapshots, it deletes the oldest snapshot that exceeds the configured policy parameters.
Configuring the maximum number of snapshot images to save
set snapshot-scheduled retention-policy max-snapshots-to-keep <1-9999>
Configuring the minimum number of snapshot images to save
set snapshot-scheduled retention-policy min-snapshots-to-keep <1-9999>
Configuring the amount of free disk space to maintain
This command lets you configure how much of the disk space must remain free at all times:
set snapshot-scheduled retention-policy keep-disk-space-above-in-GB <Limit>The limit you need to configure with this command is:
Limit = (Available free disk space for all snapshot images) - (Free disk space to maintain)Where:
Available free disk space for all snapshot images == (Output of: vgdisplay | grep Free) - 1.1*(Output of: lvs | egrep "LSize|lv_current")
Example
For more information, see sk80260.
-
Log in to the Expert mode.
-
Get the free disk space in volume groups:
[Expert@MyGaia:0]# vgdisplay | grep Free Free PE / Size 4090 / 127.81 GiB [Expert@MyGaia:0]#
-
Get the free disk space in the "
lv_current" partition:[Expert@MyGaia:0]# lvs | egrep "LSize|lv_current" LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert lv_current vg_splat -wi-ao---- 40g [Expert@MyGaia:0]#
-
Calculate the free disk space available for snapshot images:
Available free disk space for all snapshot images == (Output of "vgdisplay" command) - 1.1*(Output of "lvs" command) == (127.81) - 1.1*(40) = 83.81 GB -
Calculate the limit for the scheduled snapshot task:
For example, you need to maintain 30 GB of free disk space at all times.
Limit = (Available free disk space for all snapshot images) - (Free disk space to maintain) == (83.81 GB) - (30 GB) = 53.81 GB -
Log in to Gaia Clish.
-
Configure the limit (round up or round down the limit you calculated in the previous step):
set snapshot-scheduled retention-policy keep-disk-space-above-in-GB 54save config
-
-
Enable the scheduled snapshot feature
-
To control this feature in Gaia Clish:
-
To enable the snapshot schedule:
set snapshot-scheduled activation enabled
Important:
-
You must run this command after you configure a scheduled snapshot for the first time.
-
You must run this command after any change in the existing configuration of a scheduled snapshot.
-
-
To disable the snapshot schedule:
set snapshot-scheduled activation disabled
-
-
To control this feature in Gaia Portal:
-
In the navigation tree, click Maintenance > Snapshot Management.
-
In the section Scheduled Snapshots:
-
To enable the snapshot schedule, select Activate / Deactivate.
-
To disable the snapshot schedule, clear Activate / Deactivate.
-
-
Click Apply.
-
-
-
Examine the scheduled snapshot configuration
show snapshot-scheduled
You can only disable the snapshot schedule to stop the scheduled task:
|
|
|
|
Important - After you add, configure, or delete features, run the " |
|
Parameter |
Description |
||
|---|---|---|---|
|
|
The final name of the snapshot consists of two parts - the prefix (configured by the user) and the time stamp (format is hard-coded):
|
||
|
|
Optional. Configures the description of the snapshot image. You must enclose the text in double quotes, or enter the string that does not contain spaces. Default description : |
||
|
|
Specifies the destination for the snapshot image:
|
||
|
|
Specifies the IPv4 address of the remote server:
|
||
|
|
Specifies the path to the snapshot image file:
|
||
|
|
Specifies the login username on the remote server:
|
||
|
|
Specifies the password (in plain text) required to log in to the remote server. |
||
|
|
Specifies the hash of the password required to log in to the remote server. |
||
|
|
Specifies that the job should run once a day - every day, at specified time. Enter the time of day in the 24-hour clock format - <Hours>:<Minutes>.
|
||
|
|
Specifies that the job must run many times during the day - at the specified time.
Example:
|
||
|
|
Specifies that the job must run many times during the day - at intervals of the specified number of minutes. Example:
|
||
|
|
Specifies that the job must run once a month - on the specified months, on the specified dates, and at the specified time.
Example:
|
||
|
|
Specifies that the job must run once a week - on specified days of week, and at specified time.
Example:
|
||
|
|
Configures the retention policy when you save the new snapshot image as a local LVM volume: (when Gaia creates new snapshots, it deletes the oldest snapshot that exceeds the configured policy parameters)
|
||
|
|
Enables or disables the snapshot schedule. |
-
Creating a daily snapshot image as a local LVM volume:
gaia> set snapshot-scheduled settings snapshot-name-prefix Daily description "Daily snapshot image" target lvmgaia>gaia> set snapshot-scheduled recurrence daily time 22:00gaia>gaia> set snapshot-scheduled retention-policy max-snapshots-to-keep 10gaia>gaia> set snapshot-scheduled retention-policy min-snapshots-to-keep 3.gaia>gaia> set snapshot-scheduled retention-policy keep-disk-space-above-in-GB 50gaia>gaia> show snapshot-scheduledScheduled snapshot configuration:name: Dailydescription: Dailyactivation: disabledtarget: lvmmax-snapshots-to-keep: 10min-snapshots-to-keep: 3keep-disk-space-above-in-GB: 50Every day at 22:00gaia>gaia> set snapshot-scheduled activation enabledgaia>gaia> save config -
Creating a monthly snapshot image as a file and uploading it to an SCP server:
gaia> set snapshot-scheduled settings snapshot-name-prefix Monthly description "Monthly snapshot image" target scp ip 192.168.20.30 path /var/log/my_snapshots/ username backup_user password 123456gaia>gaia> set snapshot-scheduled recurrence monthly month all days 1 time 22:00gaia>gaia> show snapshot-scheduledScheduled snapshot configuration:name: Monthlydescription: Monthlyactivation: disabledtarget: scpusername: backup_userip: 192.168.20.30uploadPath: /var/log/my_snapshots/Every month on day 1 at 22:00gaia>gaia> set snapshot-scheduled activation enabledgaia>gaia> save config
Troubleshooting
If a scheduled snapshot task fails, there is no notification about it. You must manually check if a snapshot was created.
-
If a snapshot was not created, examine these files:
/var/log/messages* -
If a snapshot was created, but there were some issues, examine this file:
/var/log/CPsnapshot/<Snapshot Name>_<Timestamp>