What to save, and how, prior to windows backup

Hi all,

I would like to make a backup of my windows 7.

However, this doesn’t work, and it seems that it’s legacy GRUB installed in the MBR of my hard disk which prevents that.

So in order to have the windows backup done, I would like to do a ‘repair’ (not my words) of the system using windows installation disk.

This on the other hand will overwrite the current contents of my MBR, as it seems.

Of course I want to run openSUSE 12.1 (by means of legacy GRUB) afterwards again.

Besides saving the original contents of the MBR, this means that I have to restore the original contents of the MBR after all that action.

How, or by using which tools, can I save the necessary data from my MBR before that, and how can I restore these data afterwards ?

I would be glad for advice!

Mike

On Fri, 08 Mar 2013 23:16:02 +0000, ratzi wrote:

> How, or by using which tools, can I save the necessary data from my MBR
> before that, and how can I restore these data afterwards ?

A quick Google search found this:

Linux: How to backup hard disk partition table (MBR)

Might be helpful. :slight_smile:

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at openSUSE Forums FAQ

To answer your question: I typically use the ‘dd’ command to backup and restore, with great care when choosing the arguments. Note mistakes not allowed :slight_smile: as ‘dd’ is a powerful command.

The technique I propose assumes you can always boot your PC to a live-CD and when running that liveCD you can insert a USB stick and access a file on the USB stick. So proceeding with that assumption … I am also assuming that your PCs hard drive is identified as ‘sda’.

To backup the MBR I like to make two backups … one with the partitioning information, and one without the partitioning information. In both cases I send a command from a konsole/terminal with root permissions. After the files are made I copy the files to a USB stick so that I can access the file later from a liveCD boot, even if I do not have hard drive access.

So in a terminal, to back up the MBR (with partitioning), with root permissions I type:


dd if=/dev/sda of=MBR-backup-512  bs=512 count=1 

which creates the file “MBR-backup-512”. I picked that name so I could easily see (by the ‘512’) that it is the MBR backup with partitioning.

In a terminal to backup the MBR (without partitioning), with root permissions I type:

    
dd if=/dev/sda of=MBR-backup-440  bs=440 count=1 

which creates the file “MBR-backup-440”. I picked that name so I could easily see (by the ‘440’) that it is the MBR backup without partitioning. This is my preferred file for recovering the MBR as I typically do NOT touch the partitioning size.

Then I copy both files to the USB stick. I typically also keep a copy of those two files on the GNU/Linux PC’s hard drive in case I have difficulty with the USB stick.

Then after MS-Windows has been installed or updated/recovered, and the MBR over written by MS-Windows, if I have chosen the ‘dd’ approach I will boot to a liveCD and plug in the USB stick (with the saved files). I will then open a terminal and navigate via commands, to where the files on the USB stick are located. Then to restore just the MBR, I will copy the contents of the MBR-backup-440 file on to the hardrive’s MBR by typing (with root permissions):


dd if=MBR-backup-440  of=/dev/sda  bs=440 count=1 

which will restore the MBR. Do not confuse the content of the “if” and the “of” arguments. Note the difference in those arguments between making the “MBR-backup-440” file and the restoration of the MBR from that file.

Alternatively one could restore the MBR and the partitioning with the command:


dd if=MBR-backup-512  of=/dev/sda  bs=512 count=1 

At this point, the MBR should be restored. You should be able to remove the USB stick and (live CD when rebooting) and reboot from the hard drive. You should again see the grub boot manager.

But another possibility other than the above, is you may only need to change the active partition and leave MS-Windows on the MBR. Lets assume MS-Windows is on sda1 and that is flagged as the active partition. Lets assume that openSUSE is on sda2.

Then you could create a Parted Magic or gparted liveCD (I like those because of the nice implementation of gparted on those liveCDs) and boot to either of those liveCDs. Run gparted and in gparted change the active hard drive partition from sda1 to sda2. Then reboot to the hard drive. You will find that either (1) the PC won’t boot at all to the hard drive, or (2) openSUSE will boot with grub. If you can not boot at all, then simply reboot with the liveCD inside and restore the active partition to sda1, after which MS-Windows will boot. At that point in time you can then go for the surefire ‘dd’ approach - but be careful with the syntax.

Note I am assuming in the above that openSUSE is on sda2 and MS-Windows on sda1. It could be different and you would need to tune that to match your setup.

Also - Note also you can learn more about your boot setup by installing the please_try_again script/program ‘updategrub’ and after installed run from a terminal the command ‘findgrub’ . That will give you all sorts of neat information as to how the MBR and your partitioning is setup. :slight_smile:

A clarification on this alternative. Ensure 1st you have an mbr backup via the ‘dd’ commands BEFORE you install/recover MS-Windows, even if you decide to try the ‘active partition’ approach. One never knows what will work and what will not and it is very useful to have an 'MBR backup. So 1st make that MBR backup with ‘dd’.

Many thanks to both of you!

Before all, I could at least post

MyHost:~ # 
MyHost:~ # fdisk -l

Disk /dev/sda: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x5535149b

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048      206847      102400    7  HPFS/NTFS/exFAT
/dev/sda2   *      206848   838860799   419326976    f  W95 Ext'd (LBA)
/dev/sda3       838860800  1375731711   268435456    7  HPFS/NTFS/exFAT
/dev/sda4      1375731712  3906699263  1265483776    7  HPFS/NTFS/exFAT
/dev/sda5          208896    33763327    16777216   82  Linux swap / Solaris
/dev/sda6        33765376   100874239    33554432   83  Linux
/dev/sda7       100876288   167985151    33554432   83  Linux
/dev/sda8       167987200   503425023   167718912   83  Linux
/dev/sda9       503427072   838860799   167716864   83  Linux
MyHost:~ # 
MyHost:~ # parted -l
Model: ATA Hitachi HDS72302 (scsi)
Disk /dev/sda: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system     Flags
 1      1049kB  106MB   105MB   primary   ntfs            type=07
 2      106MB   429GB   429GB   extended                  boot, lba, type=0f
 5      107MB   17.3GB  17.2GB  logical   linux-swap(v1)  type=82
 6      17.3GB  51.6GB  34.4GB  logical   ext3            type=83
 7      51.6GB  86.0GB  34.4GB  logical   ext3            type=83
 8      86.0GB  258GB   172GB   logical   ext3            type=83
 9      258GB   429GB   172GB   logical   ext3            type=83
 3      429GB   704GB   275GB   primary   ntfs            type=07
 4      704GB   2000GB  1296GB  primary   ntfs            type=07
                                                                                                                              
                                                                                                                              
MyHost:~ # 

This is a hand made setup created with the aim to have 2 /root partitions (within the extended partition 2)
below the 128 GB limit, that once prevented me from installing openSUSE 11.4.
My current boot partition is /dev/sda7 (logical partition/drive within /dev/sda2), booting openSUSE 12.1,
while I intend to use /dev/sda6 (not used yet) for openSUSE 12.3.

A problem that I now have, however, is that the parameters for the dd command suggested by you aren’t identical.

Following the link given by you, Jim,

the parameters would be

# dd if=/dev/sdX of=/tmp/sda-mbr.bin bs=512 count=1

for backing up, and

# dd if= sda-mbr.bin of=/dev/sdX bs=1 count=64 skip=446 seek=446

for restoring the MBR.

oldcpu, yes, I know the following is very true:

Otherwise: yes, I have an openSUSE 12.1 live CD, and the PC boots fine from that, i.e. without hiccup.

I’ll take your advice to have more than one backup of the MBR.
And clearly I’ll make a backup before any windows ‘recover’ or ‘repair’.
That’s why I was posting here before taking any action :wink:

You suggested

What isn’t clear to me is what are the advantages/disadvantages of making a backup with partitioning (suggested filename ‘MBR-backup-512’)
or without partitioning (suggested filename ‘MBR-backup-440’).

Otherwise I would prefer the parameters given by you for restoring the MBR, because these are respectively identical to those used for
backing up the MBR using dd, which I implicitly prefer, and which is different from following the link given by Jim.

Thank both of you again
Mike

On 2013-03-09 02:46, ratzi wrote:
> What isn’t clear to me is what are the advantages/disadvantages of
> making a backup with partitioning (suggested filename ‘MBR-backup-512’)
> or without partitioning (suggested filename ‘MBR-backup-440’).

You can not restore the full MBR (512 bytes) if the partitioning table
was changed after the backup was made, because you reset the table to
what it was - and the partitions are not there, they were changed in
number or size or whatever.


Cheers / Saludos,

Carlos E. R.
(from 11.4, with Evergreen, x86_64 “Celadon” (Minas Tirith))

Hi Carlos!

This is clear to me.

I don’t expect the windows ‘recovery’/‘repair’ to change the size of the partitions (nor their number!).

Do you think I’m too optimistic here?

Yours
Mike

From what I can see, with the asterix beside sda2 (the extended partition), it is likely there is boot code on sda2 that points to the sda7 (logical partition) where your / with grub resides. …

I understand your MS-Windows install is on sda1 and with the understanding it is possible to install your MS-Windows update, before updating/installing you may need to change the active partition from sda2 to sda1. As soon as you do that, MS-Windows should still boot, but openSUSE no longer will boot, until the active partition is restored to sda2.

The ‘findgrub’ application on ‘update’ grub would have made this clear (and taken away the mystery) … although I suspect it an academic exercise and would not have changed the approach. I will make two subsequent posts illustrating what ‘findgrub’ brings to the table. I also have some cautions about installing 12.3 on /dev/sda6 (in a subsequent post).

To change the active partition - its possible MS-Windows install won’t do this, and you may need to do it your self with a Parted Magic liveCD or a gparted liveCD like I suggested.

I edited your quote below. Do NOT use that 446 value as I am concerned it could be wrong. There is history here (read the bugzilla that I link to) and I am concerned that the article Jim quoted is out of date and is more applicable to WinXP than it is to WinVisa/Win7. I am concerned it could cause problems.

Use this:


# dd if=/dev/sda of=MBR-backup-440 bs=440 count=1

for backing up, and for restoring the MBR:


# dd if=MBR-backup-440 of=/dev/sda bs=440 count=1

Be careful where you put ‘spaces’ etc and other syntax in that command.

and just ensure your prompt is inside any directory where the file ‘sda-mbr-440.bin’ is stored.

I like the file name MBR-backup-440. But it can be any name. You could call it “my-sda-mbr-backup-with-four-forty” instead, for example.

I never have had cause to use the 512 myself, even though I do create the 512 version. Instead I have always used the 440 version. Note again 446 is wrong and when you restore with 446 in place it may break your MS-Windows (it breaks it under certain circumstances).

440 only backs up the MBR. 512 backups the MBR and partitioning. So you may ask, why would you want the partitioning backed up with 512 if it is not likely to change and if users like me always use 440 ? Lets say after the backup is complete you very briefly access an NTFS drive on the extended partition from MS-Windows and you get a power outage during write acccess to that NTFS. There is a very small risk (very small) that could damage the partitioning, in which case you can recover it since you have it backed up. Or possibly some other very remote failure could occur causing the partitioning information to be damaged. So having a partitioning backup (with 512) is useful, but do not use it unless absolutely necessary.

Hence typically I do two backups (440 and the 512) but I only use the 440. Sometimes I backup both the 440 and 512 and I use neither, because after installing MS-Windows, when I change the active partition back from sda1 to sda2 (in your case) I need to do no further as with sda2 active, the sda2 pointer to sda7 is again found, grub is found in sda7 and the PC boots fine.

I believe there may be mistakes in what you quoted from the article Jim pointed you to ? (I have not checked that article myself, only the code you posted).

Below I have quoted from my PC. Note this is MY PC and not your PC. I only post this to illustrate the utility of findgrub application.

Here is the “fdisk -l” and the “findgrub” from my PC which has:

  • sda1 - winXP
  • sda2 - / of openSUSE-12.1
  • sda3 - / of openSUSE-12.3 RC2
  • sda4 - extended
  • sda5 - swap
  • sda6 - /home of openSUSE-12.3 RC2
  • sda7 - /home of openSUSE-12.1

Here is the “fdisk -l” from that PC (again in this case I have winXP on sda1):


   Device Boot      Start         End      Blocks   Id  System
/dev/sda1              63   204796619   102398278+   7  HPFS/NTFS/exFAT
/dev/sda2   *   204796620   266229179    30716280   83  Linux                                                                       
/dev/sda3       266229180   296945459    15358140   83  Linux
/dev/sda4       296945664  2930276351  1316665344    5  Extended                                                                     
/dev/sda5       296947712   310259711     6656000   82  Linux swap / Solaris
/dev/sda6       310261760   381941759    35840000   83  Linux                                                                          
/dev/sda7       381943808  2930276351  1274166272   83  Linux

Now because my drive is a 1.5 TB drive, I deliberately put my large sda7 at the end. I found if I did not do that, with my hard disk I had problems with my MBR.

Now below is an edited ‘findgrub’ output from same computer:


Find Grub Version 3.7.2 - Written for openSUSE Forums

 - reading MBR on disk /dev/sda                       ... **--> SUSE Generic MBR (Sig: 0x4fab09)**
 - searching partition /dev/sda1      (NTFS)          ... --> Windows NT/2K/XP Loader found in /dev/sda1
...
 - reading bootsector  /dev/sda2   *  (LINUX)         ... --> Legacy GRUB  found in** /dev/sda2   => sda2**   0x83 (openSUSE)
 - reading bootsector  /dev/sda3      (LINUX)         ... --> Legacy GRUB  found in /dev/sda3   => sda3   0x83 (openSUSE)
 - reading bootsector  /dev/sda4      (Extended)      ...
 - skipping partition  /dev/sda5      (swap)         
 - reading bootsector  /dev/sda6      (LINUX)         ...
 - reading bootsector  /dev/sda7      (LINUX)         ...

Note the MBR entry (in red).

Note sda2 has an ‘asterix’ and hence it is the primary active boot partition. Its legacy grub points to itself. This is my openSUSE-12.1.

Note sda3 also has a legacy grub that points to itself.

I have an entry in the openSUSE-12.1 (sda2) grub menu.lst file that allows me to boot the openSUSE-12.3 RC2 install. When installing openSUSE-12.3 RC2 I also selected legacy grub on the openSUSE-12.3 RC2 (when I installed it) because I do not understand the new grub2 yet. When installing openSUSE-12.3 RC2 I also deselected the install on MBR option, and I had only the ‘boot from root partition’ option seleted in the openSUSE installer. This meant openSUSE-12.3 RC2 could NOT boot if I had not inadvance put an entry in the openSUSE-12.1 (sda2) menu.lst , giving it a boot selection for sda3 (ie I anticipated in advance the openSUSE-12.3 install). However if I were now to remove openSUSE-12.1 on sda2 then with the active partition openSUSE pointed to sda2, my openSUSE-12.3 RC2 would NOT boot. But if I were then to change the active partition from sda2 to sda3, the openSUSE-12.3 on sda3 would boot.

Clear as mud ? ie I am trying to illustrate the importance of the active partition (in the boot process) and illustrate how one can keep the MBR relatively clean and only mess about with the pointers (flags ? I don’t know the proper name) on the individual partitions.

This example does not illustrate having openSUSE root on an extended (like your setup). In this case, if I wanted to re-install winXP, I may need to change the active partition from my sda2 to sda1 BEFORE re-installing winXP. As soon as I made that change of active partition to sda1 (and before re-installing winXP) only winXP would boot. But if I then went back and changed the active partition to sda2, then openSUSE would again boot.

Overall, above illustrates the beauty of ‘findgrub’. It clears the fog and shows what is what in the boot partition pointing. I’ll give you a more complex example next of a PC with 2 hard drives.

Here is the hard drive setup of my ‘sandbox’ PC where I have two (rather old) hard drives installed. BOTH hard drives on this PC were in fact ‘cannibalized’ from other old now defunct PCs. My BIOS is set to boot to drive sda. That is important.

  • sda1 - freedos (a primary partition)
  • sda2 - / for openSUSE-12.1 (and also the active partition on this drive)
  • sda3 - a swap
  • sda4 - an extended which houses the logical partitions sda5, sda6, and sda7
  • sda5 - /home for the above openSUSE-12.1 system
  • sda6 - / for a Tumbleweed install
  • sda7 - /home for a Tumbleweed install
    .
  • sdb1 - / for an openSUSE-12.3 RC2 install (this is a primary partition on sdb)
  • sdb2 - a primary partition - not in use currently but I once before used it as a / for an old openSUSE install
  • sdb3 - a swap (I don’t need 2 swaps but this is a ‘hangover’ from a previous dedicated use of this hard drive
  • sdb4 - an extended partition which houses logical partitions sdb5 and sdb6
  • sdb5 - /home which houses the ‘/home’ for the openSUSE-12.3 RC2 install
  • sdb6 - not in use currently, but in the past I have used this as a /home together with the sdb2

Lets look now at the fdisk :


mini-tumbleweed:/home/oldcpu # fdisk -l

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000bcd34

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1              63     1044224      522081    6  FAT16
/dev/sda2   *     1044225    52243379    25599577+  83  Linux
/dev/sda3        52243380    54283634     1020127+  82  Linux swap / Solaris
/dev/sda4        54283635   625137344   285426855    5  Extended
/dev/sda5        54283698   515076029   230396166   83  Linux
/dev/sda6       515076093   566275184    25599546   83  Linux
/dev/sda7       566275248   625137344    29431048+  83  Linux

Disk /dev/sdb: 163.9 GB, 163928604672 bytes
255 heads, 63 sectors/track, 19929 cylinders, total 320173056 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00070b93

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048    52436991    26217472   83  Linux
/dev/sdb2        52436992   104871935    26217472   83  Linux
/dev/sdb3       104871936   110446591     2787328   82  Linux swap / Solaris
/dev/sdb4       110446592   320172031   104862720    f  W95 Ext'd (LBA)
/dev/sdb5       110448640   215302143    52426752   83  Linux
/dev/sdb6       215304192   320143359    52419584   83  Linux

Since the BIOS has sda as the boot drive, the boot code on sdb is importantly only in so much as it is called by the sda2 grub. I don’t believe the sdb1 being labelled on sdb1 important as long as sda is selected in the BIOS as the boot drive.

Now lets look at the find grub to remove the mystery as to how everything boots :


Find Grub Version 4.4.1 - Written for openSUSE Forums

 - reading MBR on disk /dev/sda                       ... --> SUSE Generic MBR (Sig: 0xcd340b)
 - searching partition /dev/sda1      (FAT16)         ...
 - reading bootsector  /dev/sda2   *  (LINUX)         ... --> Legacy GRUB  found in /dev/sda2   => sda2   0x83 (openSUSE)
 - skipping partition  /dev/sda3      (swap)         
 - reading bootsector  /dev/sda4      (Extended)      ... --> Legacy GRUB  found in /dev/sda4   => sda6   0x83 (openSUSE)
 - reading bootsector  /dev/sda5      (LINUX)         ...
 - reading bootsector  /dev/sda6      (LINUX)         ... --> Legacy GRUB  found in /dev/sda6   => sda6   0x83 (openSUSE)
 - reading bootsector  /dev/sda7      (LINUX)         ...

 - reading MBR on disk /dev/sdb                       ... --> Legacy GRUB  found in sdb MBR     => sdb5   0x83 (openSUSE)
 - reading bootsector  /dev/sdb1   *  (LINUX)         ... --> Legacy GRUB  found in /dev/sdb1   => sdb1   0x83 (openSUSE)
 - reading bootsector  /dev/sdb2      (LINUX)         ... --> Legacy GRUB  found in /dev/sdb2   => sdb2   0x83 (openSUSE)
 - skipping partition  /dev/sdb3      (swap)         
 - reading bootsector  /dev/sdb4      (Extended)      ...
 - reading bootsector  /dev/sdb5      (LINUX)         ...
 - reading bootsector  /dev/sdb6      (LINUX)         ...

Again, the bios is set to treat sda as the primary drive. The MBR on sda is a generic openSUSE MBR and the " * " beside the sda2 in the sda drive, is the active partition, and with the generic MBR the PC will boot to active partition on the BIOS labelled boot drive. That is my openSUSE-12.1 system which has legacy grub boot manager and in that /dev/sda2 boot manager’s menu.lst I have hand edits to be able to boot all other openSUSE GNU/Linux systems on the PC.

ie that sda2 menu.lst has an entry to boot to the sda4 (extended partition). But of course there is no operating system on the sda4 as that just houses the extended partitions. But when sda4 is reached during the boot it immediately points to sda6. And sda6 points to itself. Of course I could also label my menu.lst in the sda2 to instead point directly to the sda6 (and not get there via the sda4).

Now to boot openSUSE-12.3 RC2, note that I also have in the /dev/sda2 boot manager entries to take me to /dev/sdb1 where the openSUSE-12.3 RC2 boot code resides. sdb1 points to itself (sdb1).

The remainder of the stuff on sdb are from a long time ago when that was the only drive in a PC, so the sdb MBR code pointing to sdb5 is worthless and not used. The sdb2 code is also not used. If I ever had to use that sdb hard drive as a stand alone or primary hard drive, I would have to update the content of the MBR (because there is only a /home on sdb5 and here is no / on sdb5).

I hope my example helps provide you some clarity wrt hard drive setups with openSUSE GNU/Linux - and my apologies if these examples are annoying as opposed to being helpful.

Note I am far from an expert, as I have not yet learned grub2 and we have users on this forum who are far more knowledgeable than I in this.

On 2013-03-09 03:46, ratzi wrote:
> robin_listas;2533151 Wrote:
>> > and the partitions are not there, they were changed in
>> > number or size or whatever.
> I don’t expect the windows ‘recovery’/‘repair’ to change the size of
> the partitions (nor their number!).
>
> Do you think I’m too optimistic here?

No, I would be very surprised if it does.


Cheers / Saludos,

Carlos E. R.
(from 11.4, with Evergreen, x86_64 “Celadon” (Minas Tirith))

Hi oldcpu,

many thanks for all the information.

Sorry that I didn’t and won’t install updategrub/findgrub, which has a reason:
I downloaded findgrub-4.4.1.tar.gz from https://build.opensuse.org/package/show?project=home%3Aplease_try_again&package=updategrub
unpacked it and had a look at that shell script to e.g. find a function

function printbs {
hr n \~
printf "%s%s %sBootsector
" "$whi" $1 "$sgr"
hr -
dd if=$1 bs=512 count=1 2>/dev/null | tr -cd ":alnum:] :space:]"
hr n -
dd if=/dev/sda1 bs=512 count=1 2>/dev/null | od -x | awk 'BEGIN {m="'"$dmag"'"; y="'"$yel"'"; r="'"$red"'"; s="'"$sgr"'"}; {if ( NF == 9 ) {printf "%s%s|%s %s %s %s %s %s %s %s", m, $1, y, $2, $3, $4, $5, $6, $7, $8; if ( $9 == "aa55" ) printf " %s%s%s
", r, $9, s; else printf " %s%s
", $9, s}}'
hr \~
}

making use of just dd to write stuff to directly addressed blocks of the hard disk !
I would prefer if findgrub would only read from my hard disk when directly accessing such blocks !
So no, I don’t let this script do that, which in this case means I will not run it.

EDIT: Oops maybe I didn’t get the parameters of dd right in this case, will have a closer look at that.

Instead, here’s the menu.lst of my current boot partition (/dev/sda7)

MyHost:~ # 
MyHost:~ # more /boot/grub/menu.lst
# Modified by YaST2. Last modification on Mon Jul 30 13:51:19 CEST 2012
# THIS FILE WILL BE PARTIALLY OVERWRITTEN by perl-Bootloader
# For the new kernel it try to figure out old parameters. In case we are not able to recognize it (e.g. change of flavor or st
range install order ) it it use as fallback installation parameters from /etc/sysconfig/bootloader

default 0
timeout 8
gfxmenu (hd0,6)/boot/message
##YaST - activate

###Don't change this comment - YaST2 identifier: Original name: linux###
title Desktop -- openSUSE 12.1 - 3.1.10-1.16
    root (hd0,6)
    kernel /boot/vmlinuz-3.1.10-1.16-desktop root=/dev/disk/by-id/ata-Hitachi_HDS723020BLA642_MN3220F33TJJDE-part7 resume=/dev
/disk/by-id/ata-Hitachi_HDS723020BLA642_MN3220F33TJJDE-part5 splash=silent quiet showopts vga=0x31a
    initrd /boot/initrd-3.1.10-1.16-desktop

###Don't change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe -- openSUSE 12.1 - 3.1.10-1.16
    root (hd0,6)
    kernel /boot/vmlinuz-3.1.10-1.16-desktop root=/dev/disk/by-id/ata-Hitachi_HDS723020BLA642_MN3220F33TJJDE-part7 showopts ap
m=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe vga=0x31a
    initrd /boot/initrd-3.1.10-1.16-desktop

###Don't change this comment - YaST2 identifier: Original name:  Desktop -- openSUSE 12.1 - 3.1.10-1.9 (/dev/sda6)###
title NoFlash -- openSUSE 12.1 - 3.1.10-1.9 (/dev/sda6)
    root (hd0,5)
    configfile /boot/grub/menu.lst

###Don't change this comment - YaST2 identifier: Original name: windows 1###
title windows
    rootnoverify (hd0,0)
    chainloader +1
MyHost:~ # 

I usually boot using the 1st entry in this.

The 2nd entry could probably be removed since openSUSE is running without any problems on this PC.

The 3rd entry is funny: I never use it, but it points to another menu.lst on /dev/sda6, which I currently don’t use.
Don’t remember what I played around with.
I’ll keep that entry which can probably serve to boot openSUSE 12.3 from /dev/sda6 after installing that there.

The 4th entry is interesting: This in fact points to the 1st partition.
And this is a good hint with respect to which partition should be selected as active using Parted Magic/gparted.

However, as the output of ‘parted -l’ showed which I pasted in a previous posting,
this is an only small partition of 105MB size which is created when installing windows 7 (this is different from XP)
and which by windows is called ‘system reserved’ (name translated).

This small ‘reserved’ partition is a primary one, further reducing the possible number of
partitions left for e.g. openSUSE on a hard disk with MBR by one (max was 4 true partitions, wasn’t it),
which hurts a bit.

So the layout on my hard disk is:
(1) small windows 7 system reserved (primary)
(2) extended partition containing logical volumes for Linux
(3) windows/ntfs partition (‘drive’) C: (primary)
(4) windows/ntfs partition (‘drive’) D: (primary) for data exchange.

Different from your systems, due to this small extra primary ‘reserved’ partition I don’t even have
the chance to install openSUSE in a true separate primary partition outside the
extended partition, as long as I want to have the ntfs partition (‘drive’) D: for data exchange
and common access of openSUSE and windows.

So to select the GRUB config file (and GRUB itself) indirectly by selecting the active partition,
as you described it, unfortunately doesn’t work for me.
It would have been nice.

Thinking about it again now I come to the conclusion that I could have had it different,
by chosing a logical drive within the extended partition for windows ‘drive’ D:,
and have at least one primary partition for root (/) of openSUSE.
But I won’t delete all but one partitions on my hard disk now to get this done.

A ‘ls -vl’ in this small ‘reserved’ partition besides gives

total 388
-rw-r--r-- 1 root users   8192 May 24  2012 BOOTSECT.BAK
drwxr-xr-x 1 root users   4096 May 24  2012 Boot
drwxr-xr-x 1 root users      0 May 24  2012 System Volume Information
-rw-r--r-- 1 root users 383786 Nov 21  2010 bootmgr

and a ‘ls -vl */’

Boot/:
total 588
-rw-r--r-- 1 root users  24576 May 25  2012 BCD
-rw-r--r-- 1 root users  21504 May 25  2012 BCD.LOG
-rw-r--r-- 2 root users      0 May 24  2012 BCD.LOG1
-rw-r--r-- 2 root users      0 May 24  2012 BCD.LOG2
-rw-r--r-- 1 root users  65536 May 24  2012 BOOTSTAT.DAT
drwxr-xr-x 1 root users      0 May 24  2012 Fonts
drwxr-xr-x 1 root users      0 May 24  2012 cs-CZ
drwxr-xr-x 1 root users      0 May 24  2012 da-DK
drwxr-xr-x 1 root users      0 May 24  2012 de-DE
drwxr-xr-x 1 root users      0 May 24  2012 el-GR
drwxr-xr-x 1 root users      0 May 24  2012 en-US
drwxr-xr-x 1 root users      0 May 24  2012 es-ES
drwxr-xr-x 1 root users      0 May 24  2012 fi-FI
drwxr-xr-x 1 root users      0 May 24  2012 fr-FR
drwxr-xr-x 1 root users      0 May 24  2012 hu-HU
drwxr-xr-x 1 root users      0 May 24  2012 it-IT
drwxr-xr-x 1 root users      0 May 24  2012 ja-JP
drwxr-xr-x 1 root users      0 May 24  2012 ko-KR
-rw-r--r-- 1 root users 485760 Nov 21  2010 memtest.exe
drwxr-xr-x 1 root users      0 May 24  2012 nb-NO
drwxr-xr-x 1 root users      0 May 24  2012 nl-NL
drwxr-xr-x 1 root users      0 May 24  2012 pl-PL
drwxr-xr-x 1 root users      0 May 24  2012 pt-BR
drwxr-xr-x 1 root users      0 May 24  2012 pt-PT
drwxr-xr-x 1 root users      0 May 24  2012 ru-RU
drwxr-xr-x 1 root users      0 May 24  2012 sv-SE
drwxr-xr-x 1 root users      0 May 24  2012 tr-TR
drwxr-xr-x 1 root users      0 May 24  2012 zh-CN
drwxr-xr-x 1 root users      0 May 24  2012 zh-HK
drwxr-xr-x 1 root users      0 May 24  2012 zh-TW

System Volume Information/:
total 20
-rw-r--r-- 1 root users 20480 May 24  2012 tracking.log

Perfectly explained !

I don’t think so. I got to that page

which is a page dated July 10 2006, and I just used copy&paste.

Your bugzilla link

on the other hand points to an entry dated 2008-06-07 wich is 2 years later …:wink:

Thank you for your examples which helped me to understand much better what is going on in my two PCs -
as long as things work without problems one doesn’t always really think about them.

My next steps are clear now.

I’ll report back (which however may take up to 1 to 2 days).

Mike

Yes findgurb does read using dd. But it does not to the best of my knowledge write using dd.

I have run findgrub many times without writing to the disk. But I can understand your sentiment not wanting to run anything whose code is not clear to you.

If you do run it, it will ask for root permissions after you run it. Wait for it to ask.

… in any event, good luck with your efforts. Don’t forget to pay attention to the active partition selection.

Hi again.

What I did:

(1) saved commands for saving and restoring MBR in text files.

(2) made backups of MBR using the suggested commands.

(3) downloaded Parted Magic CD and checked the downloaded .iso image for md5 checksum (using ‘md5sum’ on the command line).

(4) booted from Parted Magic CD choosing ‘default settings 64’, checked that USB sticks can be accessed

(5) changed flag ‘boot’ to the ‘system reserved’ partition at /dev/sda1

(6) booted again, windows 7 coming up

(7) windows 7 did boot as default, but the following is strange: I got a blank window, besides others,
with a button with the text ‘LstSaveDlg’ on it (or something like that, unfortunately I didn’t make a photograph of that).
I couldn’t reproduce that later on, any way I tried.
Can this be a worm or a trojan?

(8) made the backups of windows - it wasn’t necessary to ‘repair’ windows, just change the booting partition

(9) booted Parted Magic again to reset the boot flag to /dev/sda2, i.e. the extended partition with openSUSE 12.1 on it

(10) openSUSE 12.1 did run fine on reboot.

No need to restore MBR.

Many thanks!

Mike

Look at acronis true image for backup. There are free versions available from disk manufacturers. It is better than the windows 7 backup and and is at least aware and can backup and restore some linux file systems. It also creates compressed backups. It uses windows shadow copy so the system can be used with care after it has been started. It is much safer than playing with dd.

Excellent !! Glad to read it went well :slight_smile:

On 2013-03-09 16:46, ratzi wrote:
> making use of just dd to write stuff to directly addressed blocks of the
> hard disk !

It is reading, not writing.


Cheers / Saludos,

Carlos E. R.
(from 11.4, with Evergreen, x86_64 “Celadon” (Minas Tirith))