help-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question on what sectors grub2 uses?


From: Chris Murphy
Subject: Re: Question on what sectors grub2 uses?
Date: Sat, 10 Mar 2012 14:34:10 -0700

On Mar 9, 2012, at 6:26 PM, Michael D. Setzer II wrote:

> I am the current maintainer of the G4L disk imaging project, and 
> long ago added options to backup the basic mbr being the first 
> 512 bytes of the disk. Later added an option that would backup 
> the first track (63 sectors) of the disk to include additional code 
> that was being placed there by some OSs. 
> 
> In a recent clean install of Fedora 16 I noted that first partition is 
> starting at 2048 instead of 63 from previous version. 
> 
> What would be the necessary steps to backup the mbr and grub2 
> info?

For a disk with a 1st partition starting at 63 and a core.img that exceeds the 
space between the MBR and partition 1, it's common for linux installers to 
default to using the --force option which uses blocklists for core.img. These 
means bits of grub code can be anywhere on the disk.

In most cases I've found, core.img will fit in those 62 sectors, but 
increasingly I'm reading that users are getting the error you mention in your 
subsequent thread. The solution is to use --force or move/resize the 1st 
partition so there's contiguous room.

If blocklists are used, I think you'd have to parse the contents of core.img to 
find out where the blocklists are...or just abandon supporting such a 
situation. It is less common, but I can't say how rare it is. So long as 
core.img is continguous you can record the whole MBR and everything after it up 
to but not including the start sector of partition 1. For a partition that 
starts on 2048, you're actually backing up a lot more than you need, because 
core.img isn't that big. At least not today.



> 
> dd if=/dev/sda of=mbrgrub2 bs=512 count=????
> 
> Would it be 2048, 2047, or some other number?

Ummm...I think it will be 2048 because the MBR is LBA 0. So 2048 sectors will 
capture sectors 0 to 2047. But I find myself getting confused on whether 
fdisk/parted are reporting in LBA or not. So it's a good question! You probably 
don't want to backup, and thus possibly overwrite a legitimate first sector for 
the first partition during a restore.

Chris Murphy


reply via email to

[Prev in Thread] Current Thread [Next in Thread]