From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1NP9Vo-0003uj-RN for mharc-grub-devel@gnu.org; Mon, 28 Dec 2009 01:55:28 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NP9Vk-0003t3-GV for grub-devel@gnu.org; Mon, 28 Dec 2009 01:55:24 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NP9Vf-0003px-A8 for grub-devel@gnu.org; Mon, 28 Dec 2009 01:55:23 -0500 Received: from [199.232.76.173] (port=48436 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NP9Vf-0003pt-23 for grub-devel@gnu.org; Mon, 28 Dec 2009 01:55:19 -0500 Received: from mga14.intel.com ([143.182.124.37]:30087) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NP9Ve-0002fe-Pe for grub-devel@gnu.org; Mon, 28 Dec 2009 01:55:18 -0500 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga102.ch.intel.com with ESMTP; 27 Dec 2009 22:55:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.47,316,1257148800"; d="scan'208";a="227070192" Received: from debian.sh.intel.com (HELO [10.239.13.65]) ([10.239.13.65]) by azsmga001.ch.intel.com with ESMTP; 27 Dec 2009 22:55:14 -0800 From: Zhu Yi To: Robert Millan In-Reply-To: <20091224212119.GI12122@thorin> References: <1260523561-19086-1-git-send-email-yi.zhu@intel.com> <20091224212119.GI12122@thorin> Content-Type: text/plain; charset="UTF-8" Date: Mon, 28 Dec 2009 14:55:14 +0800 Message-ID: <1261983314.6037.84.camel@debian> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 Content-Transfer-Encoding: 7bit X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: The development of GNU GRUB 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, 28 Dec 2009 06:55:25 -0000 On Fri, 2009-12-25 at 05:21 +0800, Robert Millan wrote: > I think making a backup is a fine idea, but I'd rather avoid the "option > creep". It doesn't hurt to simply dump the files in /boot/grub/. If user > later discovers that valuable data was overwritten, she can figure out > how to call dd just as she can figure out the right parameters for > grub-install. OK. My only concern is the start position of grub core.img (as in disk sectors) is a variable (see find_usable_region_xxx). This ends up the backup file is not a simple dump. I used below format in my patch. <512 bytes MBR> + + Option 2 is to put the start position in a separated file. Option 3 is to use the information in boot.img (as I used in my patch as a verification method) to get the start position, i.e. `od -j92 -N8 -An -td8 $grubdir/boot.img`. Option 4 is to backup everything from MBR to the end of core.img (including the holes in the middle). This ends up with a bigger image. Option 1~3 requires the recover has the knowledge of the backup file format somehow, but a simple dd is enough for option 4. What do you think? Thanks, -yi