Hot Backup for Frugal Pups Updated 2011-10-1

Miscellaneous tools
Message
Author
2byte
Posts: 353
Joined: Mon 09 Oct 2006, 18:10

Hot Backup for Frugal Pups Updated 2011-10-1

#1 Post by 2byte »

Pupsave Hot Backup v1.3 Updated 2011-10-1

Users upgrading to v1.3 should uninstall any previous version.
PHB no longer installs to /root/my-applications/bin. Files are now installed with Linux FSH in mind:
/usr/bin/pupsave-hot-backup
/usr/local/pupsave-hot-backup/phb_core
/usr/share/applications/Pupsave-hot-backup.desktop

Latest testing with:
gtkdialog4 (gtkdialog-0.8.0) and gtkdialog3 (gtkdialog 0.7.20 and 0.7.21)
Bash 4.1.0(1)-release and 3.00.16(1)-release

Menu entry now included (Pupsave Hot Backup).

Fileselect dialogs now open by default to /mnt.

The default save to location now matches the partition or partition/directory of the active pupsave.

*.4fs save files supported.

The backup button is now disabled while a backup is in progress and also during the following error conditions:
1) Trying to backup to the active pupsave file.
2) The storage device is not mounted.
3) The chosen file is not a valid pupsave file (*.2fs, *.3fs, *.4fs.)
4) Not enough free disk space. (file size + 100 MB required).

Added a safety catch and popup notice if more than one backup for the same file is started before the backup name auto-regenerates (regeneration is every 60 seconds).

Code changes to prevent 'NOT ENOUGH DISK SPACE' from displaying while a backup is in progress. This would happen if a 1024 MB save file was backed up to a 1500 MB partition when the free space dropped below 1124 MB. Harmless, but kind of disconcerting.

Work-around to prevent JWM from freezing when running from a JWM menu in Lupu 5.28.

Bugfix: File named '0' no longer continuously created when using Bash 4.1.


Update Version 1.2 2011-9-27

Bash 3.0 and 4.1 compatible
gtkdialog3 and gtkdialog4 compatible (gtkdialog-0.7.21-thunor224-w5.pet)
Changed window geometry to accommodate longer file names.
Message popup when backup is finished. ( thanks 8-bit )

Bug fixes:
Fixed orphaned processes after program close.
Fixed bug that would only allow save locations to two directory levels in newer Puppies.
Removed non-functioning close button in the help window.
Misc code improvements

Tested on:
Classic Pup 214X
Puppy 4.12
Lucid Pups 5.1.1, 5.2.0, 5.2.8(Bash 4.1)
Wary 5.1.99 alpha
Lighthouse Pup 503 G (Bash 4.1)

A tiny gtkdialog utility for backing up the live pupsave file. You no longer need to reboot with pfix=ram in order to backup the savefile. Lots of built-ins and safety features make it very "oops" proof.

Auto-detects the current savefile.
Generates the backup file name with the date and time appended.
Checks the available space for the backup file.
Will not perform the backup if anything is incorrect.
Displays real-time status and progress feedback.
Supports 2fs and 3fs save file types.

It's easy fast and works very well.
.
Attachments
PupsaveHotBackup-1.3.pet
Version 1.3 Updated 2011-10-1
(4.3 KiB) Downloaded 2768 times
hotbkp.jpg
(28.31 KiB) Downloaded 17382 times
Last edited by 2byte on Sun 02 Oct 2011, 05:25, edited 16 times in total.


User avatar
abushcrafter
Posts: 1418
Joined: Fri 30 Oct 2009, 16:57
Location: England
Contact:

#2 Post by abushcrafter »

thanks

User avatar
alienpup
Posts: 9
Joined: Sun 18 Oct 2009, 16:18
Location: Arizona, USA

Re: Hot Backup for Frugal Pups

#3 Post by alienpup »

2byte wrote:A tiny gtkdialog utility for backing up the live pupsave file..
What can I say 2byte, but simple, small, clean, wonderful. Puppy has needed just such a utility for a very long time. Really very well done.

One suggestion. Gzip the backup. That'll squeeze the air out of it ;-).

Thank you very much!

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#4 Post by seaside »

Very nice gui for copying a "hot" file - But, some caution is in order.

The filesystem may be writing when you do this and problems can happen. Here's some further explanation of what to watch out for....

http://www.murga-linux.com/puppy/viewto ... 262351b559
The only surefire method to make and verify an exact copy is to not try copying a mounted image - i.e. using pfix=ram instead.

s

2byte
Posts: 353
Joined: Mon 09 Oct 2006, 18:10

#5 Post by 2byte »

@alienpup
Thanks for the compliments, I hope it serves you well.
Gzip the backup. That'll squeeze the air out of it
Yeah, deleting all of my code comments would knock a chunk out of it too :)

@seaside
Caution noted. Common sense applies here. As noted in the help dialog, shut down all of your apps before running the backup. I have been backing up in just this manner for about a year now using a hard coded script without any problems whatsoever. Also the utility runs e2fsck on the backup as a safety measure and doesn't need pfix=fsck on the next boot.

Speaking from experience, installing software or trying a new version of Puppy is much more dangerous to your savefile. :wink:
.


User avatar
alienpup
Posts: 9
Joined: Sun 18 Oct 2009, 16:18
Location: Arizona, USA

#6 Post by alienpup »

2byte wrote:@alienpup
Gzip the backup. That'll squeeze the air out of it
Yeah, deleting all of my code comments would knock a chunk out of it too :).
Perhaps you misunderstood me. I refer to compressing the newly backed pup_save file, not your code. Pup_save's are "sparse" files whose free space is highly compressible.

User avatar
abushcrafter
Posts: 1418
Joined: Fri 30 Oct 2009, 16:57
Location: England
Contact:

#7 Post by abushcrafter »

that was a joke...

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#8 Post by jemimah »

Heh, this has got me thinking about how to do a proper hot-backup, but all methods are vastly more complicated than pfix=ram.

I think if you are using pupmode 13, you're safe copying the 2fs file as long as it's not currently saving. The RAM layer should prevent block-level filesystem corruption, but maybe not logical corruption (if one of your apps was in the middle of an update when the last save occured).

However you need to be aware that the backup will only be current up to the last save.

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#9 Post by 8-bit »

There is one thing that got me wondering about the pupsave file size.
If you set up a 2 gig pupsave with the increase pupsave.2fs size and then do a Hot Backup of your pupsave file, is the free space preserved?
In other words, when Hot Backup creates a new ext2 file for copying the contents of your pupsave.sfs file to, how does it know how big to make the destination file?
Maybe that is a dumb question, but I had to ask.

I did try running an e2fsck on the backed up pupsave file that was created and it comes out clean.
My desktop widget for Puppy Space shows 1.72gig -443.18 Mib.
It previously showed 1.72gig - 800 Mib before I did an e2fsck of it from outside of it. In other words, it was not in use.
The created backup pupsave was 1.79 gig.

So I guess my main question is to if the original size of the pupsave file is preserved?

User avatar
abushcrafter
Posts: 1418
Joined: Fri 30 Oct 2009, 16:57
Location: England
Contact:

#10 Post by abushcrafter »

BUG:

After it has copied the pupsave it then uses 100% cpu and does not give you the done message.

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#11 Post by 8-bit »

ambushcrafter,
What Puppy version are you using it on?
Also, do you have any Desktop Widgets running that access information from the internet?
Any application that involves writes other than Hot Backup should not be running.

As to the bug, I also noticed that the "Done" message does not stay up.
This is due to a few lines of code that first write the word "Done" to a temporary file to be displayed, then a line that waits a specified period of time, and finally writes "" to the temporary file.
I have to agree that would be good to change to be persistent after the backup completed and cleaned up on exit from the program.

aarf

#12 Post by aarf »

i just copy mine while it is mounted and in use, both for live ssd and semi-live SD. never had problems. do a click target save immediately before the semi-live pupsave save. all are 32mb minimums containing only narcissistic mods, so what can i lose anyway. anything that is not absolutely necessarily in the pupsave isn't in there. works for me.

User avatar
abushcrafter
Posts: 1418
Joined: Fri 30 Oct 2009, 16:57
Location: England
Contact:

#13 Post by abushcrafter »

8-bit wrote:What Puppy version are you using it on?
PuppyLinuxVersion: 431
8-bit wrote:Also, do you have any Desktop Widgets running that access information from the internet?
No.
8-bit wrote:Any application that involves writes other than Hot Backup should not be running.
No apps are running.

User avatar
recycler
Posts: 120
Joined: Thu 26 Jul 2007, 02:19
Location: New Zealand

backups

#14 Post by recycler »

Backing up is a Good Thing - so much easier than trying to sort out the mess otherwise when something goes wrong.

So I install two puppies on every machine which I use or setup. One is the 'working' puppy and the other is intended only to allow backups to be made.

I usually create a separate partition for the backups of say 3gig. Booting into the first puppy which i call 'setup and backup' allows me to backup the other installation of puppy while it is not running. For extra peace of mind also back up the puppy which allows me to backup the 'working' puppy. And making a backup copy of the backup is a natural extension of this exercise! I love the frugal installation option because it does make a complete backup so easy - only one file to copy.

Hope someone finds this idea useful.

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#15 Post by 8-bit »

I am curios though as to if just copying the Pupsave file to a new location as a backup fixes a corrupt file system in it.
If you run e2fsck on the pupsave file backed up (by the copy method),
does e2fsck report it as clean?
Using Hot Backup to create a dated backup of the pupsave file does report it is clean using e2fsck.
All it takes for my pupsave file I am using to have e2fkck report stuff that needs fixing is to reboot to another Puppy and check the file.
And if I do it a number of times switching back and forth between booted versions, it seems the pupsave file never really gets unmounted cleanly.
I am open to arguments on this and a remedy.

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#16 Post by 8-bit »

One thing that would be nice to have added to your script just after the line that clears the temporary file of the word "Done" after it is displayed for 4 seconds would be to add a line

Code: Select all

xmessage "Pupsave backup completed"
.
That way if I am away from the PC and have missed the "Done" message, I know the backup has completed.

User avatar
abushcrafter
Posts: 1418
Joined: Fri 30 Oct 2009, 16:57
Location: England
Contact:

#17 Post by abushcrafter »

8-bit wrote:One thing that would be nice to have added to your script just after the line that clears the temporary file of the word "Done" after it is displayed for 4 seconds would be to add a line

Code: Select all

xmessage "Pupsave backup completed"
.
That way if I am away from the PC and have missed the "Done" message, I know the backup has completed.
+1

don922
Posts: 433
Joined: Sat 19 Jan 2008, 07:58
Location: Nong Yai Buah

How to make it work ???????

#18 Post by don922 »

Puppy 4.12 frugal install

Downloaded and extracted hotbkp.tar.gz to ~/my-applications. This resulted in one file named Pupsave-backup in ~/my-applications.

There is no menu entries and when I click on the file nothing happens.

In the console

Code: Select all

[~]/root/my-applications/Pupsave-backup
/root/my-applications/Pupsave-backup: line 204: unexpected EOF while looking for matching `)'
/root/my-applications/Pupsave-backup: line 316: syntax error: unexpected end of file
line 204: export PUPSAVE_HOT_BKP=$(cat <<EOV | sed -e 's/#.*//' # allow comments in gui
line 316: is blank

Any idea what is wrong? How is it fixed?

Fixed by downgrading bash to version 3.00.16(1) it had been upgraded to version 4.0.10(1).

Some dumb-dumb didn't pay attention to the 1st line of the 1st post or didn't remember upgrading bash...........Duh :oops: :oops: :oops:
Last edited by don922 on Fri 23 Sep 2011, 05:00, edited 1 time in total.
[color=green][i]Don -- Thailand[/i][/color]
[url=http://www.puppylinux.com][img]http://tinypic.com/4e0tojl.jpg[/img][/url]

User avatar
Baldlygo
Posts: 67
Joined: Mon 21 Mar 2011, 10:41
Location: Le Dorat, France
Contact:

Hot Backup

#19 Post by Baldlygo »

Just tried this hotbkp on my lupu520. It starts the gui OK and sees the right save file but then just stays there without showing any more info or allow any other clicks.

I do have Bash 3.00.16. Could my problem relate to me upgrading to gtkdialog3-0.7.20-patriot-e-1.pet ? (which I did to get lameSMBxplorer-0.2.3a.pet to work)

Paul
Lucid 5.20 - my preferred OS on old Dell Inspiron 8000 & Toshiba Tecra M5

2byte
Posts: 353
Joined: Mon 09 Oct 2006, 18:10

#20 Post by 2byte »

Hello Baldygo

The utility was built for official 4x series pups and many things have changed since then. I'll take a look at upgrading it for 5x series, but no promises.

I do not recommend downgrading bash or gtkdialog in order to use this utility!


Post Reply