Skip to contentSkip to conversation

Automatic backup with grub

DISCUSSION E Leibovich 5 participants 8 messages Oct 27, 2005 – Oct 28, 2005

lore
Share & tools
lore
#0 lore raw

Goal: Make the computer load a linux system every certain amount of times, this system would restoe from backup other system installed on a different partition.
Reason: When untechnical users (aka my little brother at my father's house) are using the windows system they tend to ruin it (installing many small programs w/o proper unistallation method causing the computer to be slower, installing viruses) this cause the technical user (aka me) to be asked for remedy by the manager (aka my father). The technical user don't have time to track and uninstall the endless junk on the system so he usually reinstalls the system. This takes quite a time, and requires the technical user to be physically near the system. Thus an idea for an automatically recovery system has sprung to the technical user's mind and is presented below.
Specs: A home system running windows on partition /dev/hda1 wishes to have the content of /dev/hda1 partition recovered once in a while, and upon request from a file stored on a different partition. The system should also be able to update the image file from the partition upon request. Ideally this request should be able to be done also from the windows system. Every way to achieve this goal is kosher.
My General Idea:
Set up a multiboot computer. Make sure the system will boot to a specially crafted linux system once in a while. This linux system will make backups with partimage, and might display a nice configuration untility if I'll be patient enough.
Idea: Change grub into booting into linux once every period of time. Make the linux system automatically restore the partition when loading with certain options.
Is it possible with grub? even a way to load windows X times and then linux (similarily to savedefault option) is good enough for now.
Is changing grub's source to add this feature a good idea?
Any other/better ideas are welcomed.

---------------------------------
Yahoo! FareChase - Search multiple travel sites in one click.

#1 lore raw

You can use grub-set-default command (shipped with grub legacy), which should be easily ported for windows (if your boot partition is readable by win). (It is shell script.).

http://www.gnu.org/software/grub/manual/grub.html#Invoking-grub_002dset_002ddefault

Then you can do all the logic in windows (You will then have more control over this...).

I don't know if different EOL characters matter here, but you can probably use some clever script that does not "\r\n" instead of "\n".

Signature · 2 lines
                                 Tomas 'ebi' Ebenlendr
                                 http://get.to/ebik
#2 lore raw

As I'm planning to use it as a recovery console I prefer loading linux won't be dependable of loading windows, but that it'll be loaded on its on each week or each 10 boots. It seems to me that grub requires a very small patch in order to make partitionX loaded 10 times and then to go back to default - am I correct?

Quoted 8 lines · --- Tomas 'Ebik' Ebenlendr

You can use grub-set-default command (shipped with grub legacy), which
should be easily ported for windows (if your boot partition is readable by win).
(It is shell script.).

http://www.gnu.org/software/grub/manual/grub.html#Invoking-grub_002dset_002ddefault

Quoted 24 lines

Then you can do all the logic in windows (You will then have more
control over this...).

I don't know if different EOL characters matter here, but you can probably
use some clever script that does not "\r\n" instead of "\n".

Signature · 10 lines
                                 Tomas 'ebi'
Ebenlendr
                                 http://get.to/ebik
                                 


_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

__________________________________
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com

#4 lore raw
In reply to E Leibovich
Quoted 7 lines · E Leibovich

Specs: A home system running windows on partition /dev/hda1 wishes to have the content of /dev/hda1 partition recovered once in a while, and upon request from a file stored on a different partition. The system should also be able to update the image file from the partition upon request. Ideally this request should be able to be done also from the windows system. Every way to achieve this goal is kosher.

So what needs to be done is place an image back once in a while. It should be possible to create a GRUB command for that, I guess. :-)

--
Marco

#5 lore raw
Quoted 6 lines

So what needs to be done is place an image back once in a while. It should be possible to create a GRUB command for that, I guess. :-)

Why a command? A better way, IMO, is using some variables stored in file. It could be presented as array SAVED_INTEGER of integers and SAVED_FLAGS of flags. Then with command
initsaved <file>
where <file> must be created from OS (what about a tool or shell script?) then

initsaved /grub2/savedvars

if [[ SAVED_INTEGER[0] -ge 10]]; then
defwin = "";
defrest="--default";
else
defwin = "--default";
defrest="";
fi

menu $defwin windows
{
... # Load windows
((SAVED_INTEGER[0]++));
}

menu $defrest restore windows
{
... # Restore windows
SAVED_INTEGER[0]=0;
}

menu reset counter
{
SAVED_INTEGER[0]=0;
}

timeout=10;

In this way first 10 times $defwin expands to --default and "Load windows" becomes default. Afterwards $defrest expands to --default and "restore windows" becomes default

Vladimir 'phcoder' Serbinenko

#6 lore raw

Do you suggest me to run a script from linux that will make grub run windows after 10 times? I ment that the system will run windows (possibly XP) 10 times, and then run linux once. Altering grub from XP is not so simple, and exept relying on the XP to recover itself (IE switch to "boot from linux" itself) is not so wise
- what if some defect will occur and my grub.exe will be deleted.
I thought grub itself should do that. Can you run your script from grub?

Quoted 56 lines · --- Vladimir Serbinenko
Quoted 3 lines

So what needs to be done is place an image back

once in a while. It

Quoted 1 line

should be possible to create a GRUB command for

that, I guess. :-)

Quoted 2 lines

Why a command? A better way, IMO, is using some variables stored in file.
It could be presented as array SAVED_INTEGER of integers and SAVED_FLAGS
of flags.
Then with command
initsaved <file>
where <file> must be created from OS (what about a tool or shell script?)
then

initsaved /grub2/savedvars

if [[ SAVED_INTEGER[0] -ge 10]]; then

    defwin = "";
    defrest="--default";
else
    defwin = "--default";
    defrest="";

fi

menu $defwin windows
{
... # Load windows
((SAVED_INTEGER[0]++));
}

menu $defrest restore windows
{
... # Restore windows
SAVED_INTEGER[0]=0;
}

menu reset counter

{
    SAVED_INTEGER[0]=0;
}

timeout=10;

In this way first 10 times $defwin expands to --default and "Load
windows" becomes default. Afterwards $defrest expands to --default and
"restore windows" becomes default

Quoted 8 lines

Vladimir 'phcoder' Serbinenko

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

__________________________________
Start your day with Yahoo! - Make it your home page!
http://www.yahoo.com/r/hs

#3 lore raw
In reply to E Leibovich
Quoted 6 lines · E Leibovich

As I'm planning to use it as a recovery console I prefer loading linux won't be dependable of loading windows, but that it'll be loaded on its on each week or each 10 boots. It seems to me that grub requires a very small patch in order to make partitionX loaded 10 times and then to go back to default - am I correct?

No, you can use GRUB Legacy's savedefault command. See:
http://www.gnu.org/software/grub/manual/grub.html#Booting-once_002donly

That way requires 10 menu entries for booting Windows.

Signature · 2 lines
Member AFFS, WYLUG, SWP (UK), UAF, RESPECT, StWC
No to software patents!    Victory to the iraqi resistance!
#7 lore raw
In reply to Vladimir Serbinenko
Quoted 6 lines · Vladimir Serbinenko
Quoted 2 lines

So what needs to be done is place an image back once in a while. It should be possible to create a GRUB command for that, I guess. :-)

Why a command? A better way, IMO, is using some variables stored in file. It could be presented as array SAVED_INTEGER of integers and SAVED_FLAGS of flags.

An even better way would be to store environment variables in a file. That way you could for example store a cache of drive names, or any set of strings.

Signature · 2 lines
Member AFFS, WYLUG, SWP (UK), UAF, RESPECT, StWC
No to software patents!    Victory to the iraqi resistance!