Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 25 Jul 2014, 13:42
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
Back up Save file........Possible?
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 3 [32 Posts]   Goto page: 1, 2, 3 Next
Author Message
DaveS


Joined: 09 Oct 2008
Posts: 3726
Location: UK

PostPosted: Thu 02 Jul 2009, 05:27    Post subject:  Back up Save file........Possible?  

So......... frugal install to hard drive. Puppy 4.2*. All files on hard drive, no boot CD.
Is it possible to back up the save file from within the operating system while it is running? I have tried, but the backup reports errors when run. I have to create the backup using a live CD or alternate Puppy. Is there a way to avoid this please?

_________________
Spup Frugal HD and USB
Root forever!
Back to top
View user's profile Send private message 
mikeb


Joined: 23 Nov 2006
Posts: 8028

PostPosted: Thu 02 Jul 2009, 08:52    Post subject:  

yes it probably will.How are you backing up..copying / gzipping the pup_save file or internally?
What about using the remaster script (or dougals cause can just make an sfs then) as a form of backup. Then restoring your setup would simply be a case of running a fresh frugal install.

mike
Back to top
View user's profile Send private message 
DaveS


Joined: 09 Oct 2008
Posts: 3726
Location: UK

PostPosted: Thu 02 Jul 2009, 09:29    Post subject:  

mikeb wrote:
yes it probably will.How are you backing up..copying / gzipping the pup_save file or internally?
What about using the remaster script (or dougals cause can just make an sfs then) as a form of backup. Then restoring your setup would simply be a case of running a fresh frugal install.

mike


Just simple drag and drop 'copy'

_________________
Spup Frugal HD and USB
Root forever!
Back to top
View user's profile Send private message 
rcrsn51


Joined: 05 Sep 2006
Posts: 8906
Location: Stratford, Ontario

PostPosted: Thu 02 Jul 2009, 09:35    Post subject:  

If you are booting from GRUB, add another menu option that launches Puppy with the "pfix=ram" argument. Then mount the Puppy partition and do the backup. I like to use:
Code:
gzip < pup_save.2fs > pup_save.gz
Back to top
View user's profile Send private message 
mikeb


Joined: 23 Nov 2006
Posts: 8028

PostPosted: Thu 02 Jul 2009, 11:53    Post subject:  

Quote:
Just simple drag and drop 'copy'

Rox doesn't get on well with this type of operation
one problem would be whiteout and other hidden files.
cp in a terminal would probably work better eg

cp -r /initrd/pup_rw/* /path/to/backup/folder/

mike

yep that works..just tested it
then archive the folder
make sure your backup folder is on an ext2 or ext3 partition and outside of the pup_save
Back to top
View user's profile Send private message 
DaveS


Joined: 09 Oct 2008
Posts: 3726
Location: UK

PostPosted: Fri 03 Jul 2009, 11:27    Post subject:  

Thanks Mike, but I dont think that gives me quite what I want. I am looking for a way to effectively create a copy _save.sfs file while the op system is running. If I do this, the resulting file gives errors and wont load.
_________________
Spup Frugal HD and USB
Root forever!
Back to top
View user's profile Send private message 
DaveS


Joined: 09 Oct 2008
Posts: 3726
Location: UK

PostPosted: Fri 03 Jul 2009, 11:31    Post subject:  

rcrsn51 wrote:
If you are booting from GRUB, add another menu option that launches Puppy with the "pfix=ram" argument. Then mount the Puppy partition and do the backup. I like to use:
Code:
gzip < pup_save.2fs > pup_save.gz


Thanks for this too, but I can easily do this from outside the running op system just by booting another Puppy version. I just wondered if it could be done from within.......

_________________
Spup Frugal HD and USB
Root forever!
Back to top
View user's profile Send private message 
mikeb


Joined: 23 Nov 2006
Posts: 8028

PostPosted: Fri 03 Jul 2009, 11:51    Post subject:  

Ah just realised ..what errors are you reporting??

When running certain files are created and then removed/changed at shutdown....If you make a live copy then you will get the same problem as if the plug was pulled from your machine..boot errors..some tiding up would be needed

mike
Back to top
View user's profile Send private message 
PaulBx1

Joined: 16 Jun 2006
Posts: 2308
Location: Wyoming, USA

PostPosted: Sat 04 Jul 2009, 20:43    Post subject:  

Quote:
I have to create the backup using a live CD or alternate Puppy. Is there a way to avoid this please?


Copying the pupsave when using it is not such a good idea, but there is a way to avoid booting the live CD or alternate Puppy (whatever that means Smile )

I have modified my /etc/rc.d/rc.shutdown script to backup as I shut down, so I don't have to reboot to backup. It's done as follows:

In that file, find this code at the end:
Code:
#v2.16rc try this too... SAVE_LAYER defined in /etc/rc.d/PUPSTATE...
if [ "$SAVE_LAYER" ];then
 sync
 SAVEDEV="`mount | grep "/initrd${SAVE_LAYER}" | cut -f 1 -d ' '`"
 SAVEFS="`mount | grep "/initrd${SAVE_LAYER}" | cut -f 5 -d ' '`"
 busybox mount -t $SAVEFS -o remount,ro $SAVEDEV /initrd${SAVE_LAYER} 2>/dev/null
 umount-FULL -i -n -l /initrd/${SAVE_LAYER} 2>/dev/null #-l is lazy unmount.
fi


Replace it with this:
Code:
#v2.16rc try this too... SAVE_LAYER defined in /etc/rc.d/PUPSTATE...
if [ "$SAVE_LAYER" ];then
 sync
 SAVEDEV="`mount | grep "/initrd${SAVE_LAYER}" | cut -f 1 -d ' '`"
 SAVEFS="`mount | grep "/initrd${SAVE_LAYER}" | cut -f 5 -d ' '`"
 busybox mount -t $SAVEFS -o remount,ro $SAVEDEV /initrd${SAVE_LAYER} 2>/dev/null
 umount-FULL -i -n -l /initrd/${SAVE_LAYER} 2>/dev/null #-l is lazy unmount.
 if [ -f /etc/rc.d/PUPBACKUP ]; then   # Execute PUPBACKUP to specify backup info if available
  . /etc/rc.d/PUPBACKUP
 fi
 if [ "$PUPSAVEBACKUPDIR" ]; then   # A backup directory specified in PUPBACKUP?
  echo -n "Back up your pupsave to ${PUPSAVEBACKUPDIR}? : " > /dev/console
  read -t 20 response
  if [ "$?" = "0" ]; then         # User responded in timeout period?
   if [ "$response" = "y" ]; then   # User responded with "y"?
    mkdir -p $PUPSAVEBACKUPDIR
    while [ $PUPSAVEBACKUPCOUNT -gt 0 ]; do      # Shift older backup files a notch
     mv ${PUPSAVEBACKUPDIR}${SAVEFILE}$[ PUPSAVEBACKUPCOUNT - 1 ] ${PUPSAVEBACKUPDIR}${SAVEFILE}${PUPSAVEBACKUPCOUNT}
     let PUPSAVEBACKUPCOUNT=PUPSAVEBACKUPCOUNT-1
    done
    echo "${SMNTPT}${SAVEPATH}${SAVEFILE} being copied to ${PUPSAVEBACKUPDIR}${SAVEFILE}0" > /dev/console
#    CURRENTPUPSAVE="/initrd$(losetup $(mount | grep pup_rw | grep -v union |cut -f 1 -d ' ') | cut -f 3 -d ' ')"
#   cp -a ${CURRENTPUPSAVE} ${PUPSAVEBACKUPDIR}${SAVEFILE}0
#   cp -a ${SMNTPT}${SAVEPATH}${SAVEFILE} ${PUPSAVEBACKUPDIR}${SAVEFILE}0
    cp -a /initrd/mnt/dev_save${SAVEFILE} ${PUPSAVEBACKUPDIR}${SAVEFILE}0
    sync
   fi
  fi
 fi
fi


Go into /etc/rc.d and create a file "PUPBACKUP" which has these contents, or something like it:
Code:
PUPSAVEBACKUPDIR='/initrd/mnt/dev_save/backup/pupsaves'
PUPSAVEBACKUPCOUNT=3


Then create the directory you want to save your backup copies to, similar to mine at /initrd/mnt/dev_save/backup/pupsaves. When you shut down, it will ask if you want to backup. If you say "y", it will make a backup copy, and keeps several copies actually. If you say "n", or just ignore it (it will timeout in 20 seconds), it will simply shut down without creating any copies first.

Yeah, it's a bit crude, and not completely thought out (I'm not really sure how the shutdown script works, and not much of a coder either) but it does the job for me. I wish Barry would incorporate something like this in his new Puppies. Sure is a lot more convenient than the current system.

REMEMBER TO CREATE A BACKUP COPY OF YOUR PUPSAVE BEFORE CHANGING THIS SCRIPT. Otherwise, if you goof on editing, you may be in trouble.
Back to top
View user's profile Send private message 
hillside


Joined: 02 Sep 2007
Posts: 642
Location: Minnesota, USA. The frozen north.

PostPosted: Sat 04 Jul 2009, 23:32    Post subject:  

PaulBx1,

That looks like a useful script. Too bad there isn't a way to save the file on demand instead of dealing with it on each shutdown.


I wonder how hard it would be to write an app that would
1. copy a backup of the pupsave
2. check your currently running pupsave for necessary information
3. Use the information from step 2 to "repair" or "cleanup" the backup so that it would boot properly if you needed to roll back to it.

This could be run from the menu whenever you felt the need to do a backup. For example, before you made an install of a new application that you might not have a lot of faith will install properly.

Currently, if I want to mess with an install that I'm not certain will work, I have to close out of Puppy, boot back up with a different Puppy or as pfix=ram, make my backup on the unused pupsave, close Puppy, and reboot into the original Puppy again. It's certainly do-able, but a simpler system would be nice.
Back to top
View user's profile Send private message 
DaveS


Joined: 09 Oct 2008
Posts: 3726
Location: UK

PostPosted: Sun 05 Jul 2009, 01:05    Post subject:  

Hillside, that is kind of where I am at. Installing new software is not always a success, especially trying to get a non .pet app to work. When it goes wrong, I prefer to replace the _save file with a a version created prior to the attempted software install as I know it will be 'clean'. I guess I am using this something like the Wind$ Restore Point.
_________________
Spup Frugal HD and USB
Root forever!
Back to top
View user's profile Send private message 
rcrsn51


Joined: 05 Sep 2006
Posts: 8906
Location: Stratford, Ontario

PostPosted: Sun 05 Jul 2009, 11:27    Post subject:  

I have the same situation as you. I use a separate partition for compiling and testing that has a modified init script. At bootup, it gives the option of restoring a pristine pup_save file. Read here for info on how to modify the init script.

Instead of inserting the code that is listed in that post, use the attachment below. You will also need to modify the top two lines to match your Puppy configuration.

There are four options:
Enter - boot with the current pup_save file
B - make a backup copy of the current pup_save
R - restore the backup copy
N - delete the current pup_save so you can create a new one
initpatch.zip
Description 
zip

 Download 
Filename  initpatch.zip 
Filesize  482 Bytes 
Downloaded  327 Time(s) 
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 4229
Location: Gatineau (Qc), Canada

PostPosted: Sun 11 Oct 2009, 14:29    Post subject:  

Hi, rcrsn51.

Hm... I haven't tried your code, but it looks ok. I don't know about other puppyists, but me, I sometimes have more than one pupsave file for a particular puppy. My positive criticism would be that in the code as it stands, you're limited to one filename:pup_save.sfs.

Would it be possible in bash code to introduce a third variable to be defined, such as PUPSV=pup_save-musher0_091010, for example. (I know such code would be a possibility in DOS.)

This would expand the user's choice of pupsave files.

Lines 9-11 would then become:

if [ "$CHOICE" = "b" ] && [ -f /mnt/data/$PFOLDER/$PUPSV.2fs ]; then
echo "Backing up pup_save.2fs to pup_save.bak..." > /dev/console
cp /mnt/data/$PFOLDER/$PUPSV.2fs /mnt/data/$PFOLDER/$PUPSV.bak

and similarly for the rest of the program. (The echo message would not need to be changed, since the user, having previously defined $PUPSV in the third line, would know which file he is processing.)

Respectfully,

_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)
Back to top
View user's profile Send private message Visit poster's website 
musher0


Joined: 04 Jan 2009
Posts: 4229
Location: Gatineau (Qc), Canada

PostPosted: Sun 11 Oct 2009, 14:49    Post subject:  

This is what I use, however unsophisticated it may look like! Shocked

///////////////////////////////////
#!/bin/sh
# Nom du script : copderes-PupLin.sh
# automatic cleanup and semi-manual backup

# 1) nettoyage /cleanup
cd /root/.thumbnails/normal
rm *.png &

cd /root/.mozilla
rm -r * &

sleep 5

# 2) copie de réserve
cd /mnt/home/PupLin411rc
# the place of the active pup_save file
# IMPORTANT: replace this destination with your own
rox &

cd "/mnt/sdi2/_Linux/Toutou/pup4.12/09_01_27/"
# where the backup file is located
# IMPORTANT: replace this destination with your own
rox &
# 3) glide the active file to the backup place with the mouse.

# 4) make this script appear in the editor
cd ~/my-applications/Systeme
# IMPORTANT: replace this location with your own
geany copderes-PupLin.sh

# un-remark the following "cp" line in a text editor
# and re-run WHEN and IF you want
# an automatic back-up of the active file and
# a backup of the previous backup
# Re-remark the following line with a "#" to make it inactive again.
# cp -f -v --backup /mnt/home/PupLin411rc/pup_save-chr090110.2fs "/mnt/sdi2/_Linux/Toutou/pup4.12/09_01_27/"
# IMPORTANT: replace these disk locations with
# your own previously defined ones.

//////////////////////////////////

My two cents! Smile

_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)
Back to top
View user's profile Send private message Visit poster's website 
diaeresis

Joined: 16 Sep 2009
Posts: 165

PostPosted: Fri 06 Nov 2009, 16:27    Post subject:  

Hi musher0

I don't have a root/.thumbnails directory. I am using puppy 431. I am also using firefox not seamonkey so I suspect the root/mozilla directory might not be relevant, maybe something in root/.mozilla/firefox instead?

and rcrsn51
your set up actually looks as though it would be the most useful of the three suggestions offered for me.
I have tried and tried to make it work. but failed miserably.
The best I got to was the
Backing up pup_save.2fs to pup_save.bak...
message appearing but no actual copying was done.

i am using puppy 431 as I already said. I boot using the win n lin method which I believe is basically a frugal that boots from the harddrive rather than a cd. Because of this my directory structure seems to be very different to the structure outlined in your script.

I have sda1/mnt/home/puppy430/pupsave.2fs
/mnt/home also contains all my windows install, my menu.lst and both ntldr and grldr.

I tried modifying your script (shown below). I removed all the variables (possibly not the right word!) $XXXX and used actual locations. Among other changes. What is below got me to the
Backing up .....message.

Can you or anyone else possibly help me out with this as it seems so close but I just don't have the knowledge or ability to make it work.
Thanks


Original code from rcrsn51


#Modify the next two lines to match the target partition

PPARTITION="sda1"
PFOLDER="pup430" # or "." if at root of partition

mount /dev/$PPARTITION /mnt/data
echo -n "Press Enter-start B-backup R-restore N-new: " > /dev/console
read CHOICE
if [ "$CHOICE" = "b" ] && [ -f /mnt/data/$PFOLDER/pup_save.2fs ]; then
echo "Backing up pup_save.2fs to pup_save.bak..." > /dev/console
cp /mnt/data/$PFOLDER/pup_save.2fs /mnt/data/$PFOLDER/pup_save.bak
elif [ "$CHOICE" = "r" ] && [ -f /mnt/data/$PFOLDER/pup_save.bak ]; then
echo "Restoring pup_save.2fs from pup_save.bak..." > /dev/console
cp /mnt/data/$PFOLDER/pup_save.bak /mnt/data/$PFOLDER/pup_save.2fs
elif [ "$CHOICE" = "n" ]; then
echo "Starting with new pup_save..." > /dev/console
rm -f /mnt/data/$PFOLDER/pup_save.2fs
fi

umount /mnt/data


My stab at it


#Modify the next two lines to match the target partition

PPARTITION="sda1"
PFOLDER="pup430" # or "." if at root of partition

mount /dev/$PPARTITION
echo -n "Press Enter-start B-backup R-restore N-new: " > /dev/console
read CHOICE
if [ "$CHOICE" = "b" ]; then
echo "Backing up pup_save.2fs to pup_save.bak..." > /dev/console
cp /mnt/home/puppy430/pupsave.2fs /mnt/home/puppy430/pupsave.bak
elif [ "$CHOICE" = "r" ]; then
echo "Restoring pup_save.2fs from pup_save.bak..." > /dev/console
cp /mnt/home/puppy430/pupsave.bak /mnt/home/puppy430/pupsave.2fs
elif [ "$CHOICE" = "n" ]; then
echo "Starting with new pup_save..." > /dev/console
rm -f /mnt/home/puppy430/pupsave.2fs
fi

umount /dev/$PPARTITION
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 3 [32 Posts]   Goto page: 1, 2, 3 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Users ( For the regulars )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1077s ][ Queries: 12 (0.0042s) ][ GZIP on ]