Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1NK19Z-0008SY-BV for mharc-grub-devel@gnu.org; Sun, 13 Dec 2009 21:59:17 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NK19X-0008Qo-AO for grub-devel@gnu.org; Sun, 13 Dec 2009 21:59:15 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NK19S-0008MH-Mw for grub-devel@gnu.org; Sun, 13 Dec 2009 21:59:14 -0500 Received: from [199.232.76.173] (port=49211 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NK19S-0008MC-AN for grub-devel@gnu.org; Sun, 13 Dec 2009 21:59:10 -0500 Received: from mail-qy0-f196.google.com ([209.85.221.196]:48392) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NK19R-0002ec-T5 for grub-devel@gnu.org; Sun, 13 Dec 2009 21:59:10 -0500 Received: by mail-qy0-f196.google.com with SMTP id 34so1398626qyk.14 for ; Sun, 13 Dec 2009 18:59:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=NpJqVHh0HP5Y089LBC+l7K5r8g92fbscY5wuJpT5qGs=; b=Oc3pgKCacJpd8ywSIzUVdDxLwocKWBQn0te/tYT8fwqYrHfIQXjDl34OdjI0jmUNAa Hf6aQhMykaID/j+TpnYYk18DMsGGHu1+1VP8le2PM0V4tSGcDh2i0lRJlWKtjiUaKDIx UhgSaiTmTOFV4MBV5vLgm5O8BtUZpUVL9Ma+0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=BkfTp+gJlATNceplwvVLR5AxfRfHtklIBrz58cktPs1QWNF5XiTgE5Mq4RU9O64eKh tKruBISI9M4Mppg64HDvRPaXRYGWxvddtlINdIOo0CzKZloh4MggoaK520SBjlCC4/Va yzHAtCCO1KsEM6VxDXi4I4UPeEJtc2IR8O+PE= MIME-Version: 1.0 Received: by 10.229.131.22 with SMTP id v22mr2250120qcs.77.1260759548777; Sun, 13 Dec 2009 18:59:08 -0800 (PST) In-Reply-To: <1260758922.12157.281.camel@debian> References: <1260523561-19086-1-git-send-email-yi.zhu@intel.com> <1260524367.2832.10.camel@fz.local> <1260758922.12157.281.camel@debian> Date: Mon, 14 Dec 2009 08:29:08 +0530 Message-ID: From: kashyap garimella To: The development of GNU GRUB Content-Type: multipart/alternative; boundary=0015174be3fa0d55d2047aa77539 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: [PATCH] Backup old boot sectors before installation X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Dec 2009 02:59:15 -0000 --0015174be3fa0d55d2047aa77539 Content-Type: text/plain; charset=ISO-8859-1 On Mon, Dec 14, 2009 at 8:18 AM, Zhu Yi wrote: > On Fri, 2009-12-11 at 17:39 +0800, Felix Zielcke wrote: > > > > Someone already made a patch for this inside grub-setup > > See here and also for the discussion of it: > > http://lists.gnu.org/archive/html/grub-devel/2009-09/msg00242.html > > Thanks. If I knew this patch, I won't try to write one my own. I did do > some basic search and asked in #grub2 IRC before writing it though. > > Anyway, I did a quick review for Garimella's patch. Both the ideas of > the two patches are the same: backup the mbr and boot sectors will be > overwritten by core.img to a file before grub2 overwrites them. The > implementations slightly differ in: > > 1. The format of the backup file. > > The old boot sectors and the start of embed_region position is required > for both patches. Garimella also added some redundant fields (i.e. image > size and 0xff) for integrity checking. I think it's a good idea. But > something like a md5/sha1 checksum should be even better. > > 2. The image backup and recovery. > > Both of the patches choose to backup the old boot sectors in > grub-setup.c. On the recovery, Garimella selected to do it in > grub-setup.c and I used grub-install script with dd(1). I don't think > this is a very big deal and either way is OK. The reason I choose > grub-install is I want to keep the grub-setup.c as clean as possible. > Because given the backup file format, one can recover it with dd(1) even > without any help with grub-setup. > > md5/sha sum is a good idea. If you want, I can implement it. > 3. The backup policy. > > Garimella's patch backups every time before grub-setup overwrote the > boot sectors. There might be a problem when someone run > grub-setup/grub-install twice. So the backup image ends up with the > grub2 boot sectors. This makes the recovery for the "real" boot sectors > impossible. My patch won't overwrite if a previous backup image already > existed. grub-install will remove the backup image after a successful > recovery. > I think this is questionable. Some prefer to backup only the previous copy of mbr. Some prefer to save the oldest copy. We can take the users' opinion. > 4. Blocklists installation. > > This is not very important because blocklists is not recommended. To be > completeness, my patch backups the mbr if blocklists are used due to > embedding is not possible. This will be detected by grub-install as > well. > > > In conclusion, I believe this backup feature is useful and either > implementation should do the work. If we can merge the good parts of > them, we can get a better one. I just curious why the thread is stuck > since September. Any blocking issues with it? Can we keep the topic > moving forward? Your comments are highly welcome. > > The reason is very simple. If you are good user, you should have already backed up your copy on your own. And this feature is not necessary. -Garimella Kashyap --0015174be3fa0d55d2047aa77539 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

On Mon, Dec 14, 2009 at 8:18 AM, Zhu Yi = <yi.zhu@intel.com<= /a>> wrote:
Thanks. If I knew this patch, I won't try to write one my own. I = did do
some basic search and asked in #grub2 IRC before writing it though.

Anyway, I did a quick review for Garimella's patch. Both the ideas of the two patches are the same: backup the mbr and boot sectors will be
overwritten by core.img to a file before grub2 overwrites them. The
implementations slightly differ in:

1. The format of the backup file.

The old boot sectors and the start of embed_region position is required
for both patches. Garimella also added some redundant fields (i.e. image size and 0xff) for integrity checking. I think it's a good idea. But something like a md5/sha1 checksum should be even better.

2. The image backup and recovery.

Both of the patches choose to backup the old boot sectors in
grub-setup.c. On the recovery, Garimella selected to do it in
grub-setup.c and I used grub-install script with dd(1). I don't think this is a very big deal and either way is OK. The reason I choose
grub-install is I want to keep the grub-setup.c as clean as possible.
Because given the backup file format, one can recover it with dd(1) even without any help with grub-setup.

md5/sha sum is a good idea. If you want, I can implem= ent it.
=A0
3. The backup policy.

Garimella's patch backups every time before grub-setup overwrote the boot sectors. There might be a problem when someone run
grub-setup/grub-install twice. So the backup image ends up with the
grub2 boot sectors. This makes the recovery for the "real" boot s= ectors
impossible. My patch won't overwrite if a previous backup image already=
existed. grub-install will remove the backup image after a successful
recovery.

I think this is questionable. Some prefe= r to backup only the previous copy of mbr. Some prefer to save the oldest c= opy.
We can take the users' opinion.
=A0
4. Blocklists installation.

This is not very important because blocklists is not recommended. To be
completeness, my patch backups the mbr if blocklists are used due to
embedding is not possible. This will be detected by grub-install as
well.


In conclusion, I believe this backup feature is useful and either
implementation should do the work. If we can merge the good parts of
them, we can get a better one. I just curious why the thread is stuck
since September. Any blocking issues with it? Can we keep the topic
moving forward? Your comments are highly welcome.

The reason is very simple. If you are good user, you = should have already backed up your copy on your own. And this feature is no= t necessary.

-Garimella Kashyap


--0015174be3fa0d55d2047aa77539--