VMware Cloud Community
sandrohfict
Contributor
Contributor

Retaining only five snapshots

Hi,

I had a scheduled task which created a new snapshot everyday on all of my 12 VMs. That was a terrible idea. Meanwhile, I have deleted them all again.

Now I came up with a better idea. However, I have no clue how to achieve this.

Is it possible to create a daily snapshot, while only retaining 5 versions at a time?

Like automatically deleting the oldest snapshot upon creation of the sixth.

please help

Sandro

Tags (2)
0 Kudos
13 Replies
daphnissov
Immortal
Immortal

Why do you want to create any snapshots automatically on a schedule? What are you trying to achieve?

0 Kudos
sandrohfict
Contributor
Contributor

Is it a bad idea?

I thought it would be convenient.

If something fails I can just go back in time

Tell me your thoughts please

0 Kudos
daphnissov
Immortal
Immortal

Yes, I think that's a very bad idea. That's what backups are designed for. You need proper backup software, not scheduled snapshots.

0 Kudos
a_p_
Leadership
Leadership

I had a scheduled task which created a new snapshot everyday on all of my 12 VMs. That was a terrible idea. Meanwhile, I have deleted them all again.

So this means that too many snapshots, no space on datastore anymore​ has been resolved!?

IMO it's still not a good idea to keep snapshot., as they are not a replacement for backups. Consider a situation where you loose access to the datastore ...

Anyway, there's no out-of-the-box option that I'm aware of to delete snapshots automatically. To achieve your goal you may need to create a script (e.g. PowerCLI).

André

0 Kudos
itsmattmagbee
Contributor
Contributor

Are you snapping these in VMware? I get what you're trying to achieve, but possibly to use a backup utility or your SAN for the snaps? Seems to perform better. Either way, you can set a snap schedule and have them delete. You can also use items such as vROPS to do this for you.

0 Kudos
continuum
Immortal
Immortal

> Anyway, there's no out-of-the-box option that I'm aware of to delete snapshots automatically.
Is Autoprotect no longer working with recent ESXi ?
Some time ago I managed to configure Autoprotect so that it takes one snapshot a day and keeps a max number of one.
BTW that was the only useful implementation of Autoprotect I ever saw in action.


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

0 Kudos
sjesse
Leadership
Leadership

I think they transfer from vms managed by workstation, or exported from workstation, they create advanced variables in the vmx file that works in esxi but isn't in the interface. I've had it happen once on accident, and had to remove the advanced variables once I found them to stop the automatic snapshots.

0 Kudos
continuum
Immortal
Immortal

rollingTier parameters are poorly documented thats why they are called advanced by some.
I wrote this in 2010 I think:
VMware Continuum - Snapshot-timer

If they are used normal automatic tools like Veeam will not work.
But some constellations really are useful.


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

0 Kudos
sandrohfict
Contributor
Contributor

Hi André

I'm trying to gather a bunch of ideas to argue with, since this is a school project and opinions are not quite the same across the students

I just want to make sure that snapshotting VMs is not really a thing for disaster recovery and sorts like that. You know, basically, I just wanna hear you guys talking, to acquire some knowledge. Because this is was google can't tell you.

It's so much more easy for me to understand when I can ask a specific question to people who know the matter. The community might be big, but the pool of questions is also. It's really hard to make myself a comfy place in the world of VMware. But with you, I feel that sense of success each time.

I'm very glad about our help André in. I meanwhile btw. have Veeam set up and running to back up the VMs. Works like a charm. However the datastore of 1.3 TB is almost depleted, even though there is no real production data on the server yet. Maybe attaching an external NAS, to get rid of the problem.

Thank you

Sandro

0 Kudos
a_p_
Leadership
Leadership

I'm trying to gather a bunch of ideas to argue with, since this is a school project ...

This definitely makes a difference. So far I though that we are talking about a production environment.

Please feel free to ask questions, but consider mention that it's about learning, which will lead to different (more helpful for you) replies.

Regarding snapshot, some typical use cases are:

  • for VM based backup applications (like with Veeam)
  • prior to installing critical guest/application updates, to have a way back in case something goes wrong
  • lab VM's where you wan to quickly switch back, and forth between different state

Keeping snapshots on production systems is not recommended, and do not replace regular backups to a different system/storage.

For quick restores of e.g. accidentally deleted, or modified files in a guest OS, other option may be evaluated, e.g. VSS snapshots.

Maybe attaching an external NAS, to get rid of the problem.

That's a good idea, not only for leaning purposes regarding storage types (e.g. NFS, iSCSI, FC), but also regarding high availability, in case you have a cluster with multiple ESXi hosts, with all of them being able to access the shared storage, so that VM's can run on another hosts in case of a hardware failure.

André

0 Kudos
sjesse
Leadership
Leadership

I just want to make sure that snapshotting VMs is not really a thing for disaster recovery and sorts like that.

Take it from VMware themselves

VMware Knowledge Base

1st in the list says

Do not use snapshots as backups.

The snapshot file is only a change log of the original virtual disk, it creates a place holder disk, virtual_machine-00000x-delta.vmdk, to store data changes since the time the snapshot was created. If the base disks are deleted, the snapshot files are not sufficient to restore a virtual machine.

For me snapshots are a conveniences for quick restores, kinda like they say you shouldn't rely on raid to save your data. Sure in a lot of cases you can go back, but there could be a time you rely on it and its not there. Backups are the most reliable protection of your data, if its important and you need it, back it up.

An example where the company I work at does use snapshots. We are auto patching our Linux servers, and that process is scripted, we take a snapshot before the patching is done and then 3 days later automatically restore them. We do this as its faster to recover from then restoring from backups, but we are do nightly backups as well. So far we've never had any issues because we monitor the snapshots everyday, we look for

1.)Snapshot Age. Nothing over 3 days

2.)Snapshot Size. Nothing over a certain size.

3.)Number of snapshots. No more than one snapshot per vm.

I'm mostly ok with this, but if you want to see why I do have issues, just lookfor posts that continuum​ and I see a.p.​ also respond to. Look at the ones related to corrupt vmdks, snapshots an other ones and see the problems people have ran into. The biggest issue I see from people that use snapshots as backups is they generally run out of space. A snapshot is thin provisioned, it doesn't reserve all of its space, and can get as big as the hard drive its attached to. If you have a 500gb drive and do daily snapshots that basically do 100gb of changed data a day, the total space used by the harddrive is 1TB even the disk is only using 500gb. The last snapshot can always get to 500gb technical so if your not accounting for this extra space its easy to run out of space. This is another reason we make sure our datastores have at least 20% free always and they are sufficiently sized for the vms that will be in them.

0 Kudos
sjesse
Leadership
Leadership

Oh and the snapshotting process can cause disk latency and also increase the disk latency for that vm till its removed. I can see this in our monitoring, but we are accepting this because of the time savings we had from our process before. It works for us because we have aggressive monitoring and have alarms that are more aggressive then the built in ones so we don't accept as high of latency as some people might. Overall is worked ok, but on a daily basis we are tracking people down making sure they are remove older snapshots. I'd like to lower this to a day, but the 3 days is needed to get over the weekend.

0 Kudos
sandrohfict
Contributor
Contributor

Hi André,

Sorry, my schedule is quite busy, caring about the other classes too;)

Thank you for that information. I learned to worship the snapshots anymore. There are now one or two snapshots left per VM and I have disabled the daily snapshotting job.

I meanwhile got access to an external NAS. It's an ISCi Synology NAS. The user data on my pods are being stored on the NFS, however, I then want to rsync the data to the external NAS.

Does this combination work? ISCi and rsync? I know it's a very specific question and doesn't really belong here I suppose.

I got some DNS name starting with iqn.2000-1.com.synology:...... with credentials. no clue what to do with that. I tried the "ISCi Initiator" on windows, but couldn't even connect to it.

Any hints or clues are highly appreciated:)

Thanks,

Sandro

0 Kudos