How Puppet Recovering Overwritten Files ?


Puppet Recovering Overwritten Files/ We all know the benefit of using Puppet in managing huge IT infrastructures. Puppet Master will be used to send configuration or desired state of puppet agents or clients or servers we wish to manage using manifests.

The alarming thing is that puppet default behavior is to overwrite the files, if the file already exists on the puppet agent machine. Which is sometimes good, sometimes bad (if we had deleted or overwritten a right file, wrongly).

This can be real disastrous, in any production environment.

There must be a way in puppet recovering overwritten files.

Puppet creates a backup copy of any file it changes, and stores it on the machine in a place called the clientbucket – /var/lib/puppet/clientbucket – to be precise. This can be handy if you ever accidentally overwrite an important file, and want to retrieve its original contents.

Step: 1 
I created a puppet manifest. A file resource which will be creating a file /tmp/bucket.txt with some sample text. Consider this text as very important for your production server. So here I am applying the manifest for the first time. Which will create the original and right file at the right place. The original contents here are – “This is backed up under clientbucket, if overwritten”.
Original File created by puppet

Step: 2
Now, I am intentionally, editing (consider it by accident) the original file /tmp/bucket.txt using puppet manifest. Creating a scenario that the original file is overwritten, by mistake.
Editing the original file, using puppet

Step: 3
Now after applying the new puppet manifest using puppet apply testbucket.pp, the original file /tmp/bucket.txt is overwritten by our fake or wrong contents, leading to non desired results on our Linux servers. You can see the new line – “Overwriting now” appended in the file.
Overwritten file by puppet

Step: 4
Now comes the challenge. We want our original file back. We already learned that puppet, by default, make a backup of all overwritten files under a location – clientbucket – /var/lib/puppet/clientbucket. So if I go under – /var/lib/puppet/clientbucket and do a grep for the word “bucket” (which was there in the original file). I should be able to get the original contents.
Recovering overwritten file from /var/lib/puppet/clientbucket
Step: 5
Now GEEKS !! Once you know the exact location, you can go in the path displayed and recover the original file and simply use the cp command to copy it in the original location.
Copy the contents from client bucket to original location


Step: 6
This is indeed a good Puppet hack to know. But in case you don’t want, think twice that you really don’t want. You don’t want puppet to create a backup copy of the file under – /var/lib/puppet/clientbucket. That simply means you cannot recover it in case of accidental modification.

You can still tell puppet not to create backup of any overwritten file by using – backup => false – argument within the file resource.
Configuring puppet not to create backup

Avoid “Quick Formatting” Flash Drives to Prevent File Recovery

 It’s actually quite easy to recover deleted files using a free file recovery program such as Recuva But did you know that files can even be recovered from flash drives that have been formatted? Well, it’s true, and it’s just as easy as recovering files that have been “deleted”. 

If you format your drives using the “Quick Format” option, the files on the drive won’t actually be over-written as the drive is formatted. Instead, only the “pointers” to the files are wiped out, leaving the files themselves intact and easily recoverable.
This is usually not a problem, but if some of the files on a formatted drive are sensitive in nature, anyone at all could use a file recovery program to retrieve them.
Luckily, there’s a very simple solution if you really want to overwrite everything on a drive to prevent your files from being recovered. Simply uncheck the “Quick Format” option in the Format dialog box before you click the “Start” button. Refer to the screenshot below:

Format your flash drives without the “Quick Format” option and you’ll be able to rest assured that your files cannot be recovered by someone else.

How to recover deleted photos from your digital camera with DeleteFIX?





        

          If you have accidentally deleted photos in your Digital camera , no need to worry, here is the way to recover you photos.


  DeleteFIX  Photo is the only program designed specifically for digital photo recovery, it will recover photos deleted from your digital camera.


           It is the only photo recovery Software in the market that recovers every photo format from every digital camera. Each camera saves the photos in a different format, and DeleteFIX Photo is able to recover deleted photos from all of them, including specific formats for professional cameras from every brand, such as Canon, Olympus, Pentax and others.

How to recover the deleted photos?
  • Download and install DeleteFIX Photo.
  • Connect your camera to your computer.
  • Run the software and follow the simple instructions in the program's window. View how this digital photo recovery software works with images.
  • View the recovered photos in the program's viewer window.
  • Click on the "Activate" button in the program itself to obtain the activation code. That way you will be able to save your photos to your computer.
The DeleteFix Photo can also recover video and photo files from your digital camera, memory carads USB Devices and more.

Download the DeleteFix Photo from here.