Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1NPNi2-0003f5-O3 for mharc-grub-devel@gnu.org; Mon, 28 Dec 2009 17:05:02 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NPNi0-0003d0-HG for grub-devel@gnu.org; Mon, 28 Dec 2009 17:05:00 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NPNhv-0003Yu-O2 for grub-devel@gnu.org; Mon, 28 Dec 2009 17:04:59 -0500 Received: from [199.232.76.173] (port=42343 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NPNhv-0003Yn-JC for grub-devel@gnu.org; Mon, 28 Dec 2009 17:04:55 -0500 Received: from nereid.marlboro.edu ([206.192.68.76]:56448) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NPNhu-0005eB-SL for grub-devel@gnu.org; Mon, 28 Dec 2009 17:04:55 -0500 Received: from [192.168.1.102] (71-10-224-192.dhcp.oxfr.ma.charter.com [71.10.224.192]) (Authenticated sender: idupree) by nereid.marlboro.edu (Postfix) with ESMTPSA id 821692340E3; Mon, 28 Dec 2009 17:04:31 -0500 (EST) Message-ID: <4B392B6E.2060807@isaac.cedarswampstudios.org> Date: Mon, 28 Dec 2009 17:04:30 -0500 From: Isaac Dupree User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: The development of GNU GRUB References: <1260523561-19086-1-git-send-email-yi.zhu@intel.com> <20091224212119.GI12122@thorin> <1261983314.6037.84.camel@debian> In-Reply-To: <1261983314.6037.84.camel@debian> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Marlboro-Information: Please contact techsupport@marlboro.edu for more information X-Marlboro-MailScanner-ID: 821692340E3.A10DC X-Marlboro-MailScanner: clean X-Marlboro-SpamCheck: not spam, SpamAssassin (not cached, score=-4.399, required 5.5, autolearn=disabled, ALL_TRUSTED -1.80, BAYES_00 -2.60) X-Marlboro-MailScanner-From: ml@isaac.cedarswampstudios.org X-Marlboro-MailScanner-Watermark: 1262642673.33477@F7iMrZfC9nP1vOyF9J5Kpg X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) 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 22:05:01 -0000 Zhu Yi wrote: > 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? If the partitioning had been changed in the mean time, 4 would overwrite it with the older values. Similar problem for a weird setup with partitions in between (I dunno, might be possible with GPT or other weirdness). I think option 2 or 3 is soundest. Option 2 would have three separate files of information, (right?), and there must be a pretty straightforwards `dd` option to skip to the correct start position. Option 3 would omit the "start position" file... but that file is really cheap, maybe we'd better keep things simple for restorers and stick with three separate files.(Or, we could do something weird like putting start-position somewhere in the filename of the backup.) -Isaac