LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-27-2010, 03:04 PM   #1
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Rep: Reputation: 31
volume boot record is the same as MBR?


Hello
If I have a HDD with 3 particions, I have 1 MBR at the begining of the HDD, and 3 VBR (volume boot record). One VBR for each partition in the begining of each partition. But what I dont understund is if first VBR in the first partition (512 bytes) are the same 512 bytes in MBR?
 
Old 10-27-2010, 03:39 PM   #2
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191
The first partition does not start at the very beginning of the hard drive.

Partitions normally start on "cylinder" boundaries, but I think the first partition normally starts one "track" later (than the start of the first "cylinder").

Of course on modern disks, "cylinder" and "track" are just units for the BIOS and don't correspond to the physical layout of the disk.
 
Old 10-27-2010, 03:54 PM   #3
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Original Poster
Rep: Reputation: 31
So, first 512 bytes of sda are diferents from first 512 bytes of sda1, right?
 
Old 10-27-2010, 04:20 PM   #4
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191
Quote:
Originally Posted by miros84 View Post
So, first 512 bytes of sda are diferents from first 512 bytes of sda1, right?
Right.

Consider this example from one of my computers:

Code:
# /sbin/fdisk -l

Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       37869   304182711   83  Linux
/dev/sda2           37870       38913     8385930   82  Linux swap / Solaris
Now do a bit of math:
37870 to 38913 inclusive is 1044 cylinders
1044 times 16065 sectors/cylinder divided by 2 sectors/block exactly equals the reported 8385930 so sda2 consists of whole cylinders.

Do the same for sda1 and you get 304182742.5 blocks, so 31.5 blocks (63 sectors) are missing. The size of sda1 is one track less than the total size of the reported range of cylinders. So in this example the first 63 sectors of sda are not part of sda1. The 64'th sector of sda is the 1'st sector of sda1.

Last edited by johnsfine; 10-27-2010 at 04:22 PM.
 
Old 10-28-2010, 07:57 AM   #5
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Original Poster
Rep: Reputation: 31
Oo, johnsfine, you understund very well hdd stuff. Thank you very much for explain that to me.

So, when I install Debian in sda1, and Windows 7 in sda2, and when I turn on my computer, and I see grub menu, thatīs why because I have:

Grub installed in first 512 bytes in sda which is called MBR. In the very begining in the HDD. Or meybe in the first 63 sectors.
Then in the first 512 bytes of sda1, which is the 64th sector I have volume boot record for Debian and in the first 512 bytes of sda2 I have the volume boot record for Windows 7.

Is that right what I understund?
 
Old 10-28-2010, 08:31 AM   #6
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191
Quote:
Originally Posted by miros84 View Post
Grub installed in first 512 bytes in sda which is called MBR. In the very begining in the HDD. Or meybe in the first 63 sectors.
No, just a simple first stage loader for grub is in the mbr. Most of grub is in files on sda1, normally in the /boot/grub directory.

Quote:
Then in the first 512 bytes of sda1, which is the 64th sector I have volume boot record for Debian
I think that sector would be unused.

Quote:
and in the first 512 bytes of sda2 I have the volume boot record for Windows 7.
That sector contains a simple loader for what in XP was named NTLDR. I'm not sure what it is named in Windows 7. But in any case, the Windows partition boot sector is a simple loader that starts the process of loading the main loader, just as your MBR contains a simple loader that starts the process of loading grub.
 
Old 10-28-2010, 11:40 AM   #7
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Original Poster
Rep: Reputation: 31
Ok, letīs see. I think I start to understand it.
In a HDD with sda1 - Debian, sda2 Windows 7 and grub installed as main boot manager.
When computer load flash Bios, and Bios load MBR, first are loaded the first 512 bytes in sda, which load grub, which shows me all SO on menu.lst. So, when I choose windows 7 or windows xp from the list, grub load the first 512 bytes from sda2, which load windows xp or windows 7 loader.
Is all this correct?
 
Old 10-28-2010, 11:59 AM   #8
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191
I think that is all correct.

There are some details (intermediate stage loaders) missing from that description, but I don't really know those details either. At the level at which you just described the process, your description is correct.
 
Old 10-29-2010, 08:40 AM   #9
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Original Poster
Rep: Reputation: 31
Hello
I have a hdd with several partitions.
sda1 - debian
sda2 - windows xp
sda3 - win 7
sda4 - ubuntu

I know how to mount each partition, but what I want is to mount sda, not sda1 or sda3. Just sda.
So later, I want to make a copy of MBR of sda.
As I know first 512 bytes from sda1 are not the same like first 512 bytes from sda.
Thatīs why I want to mount sda and with dd, copy the first 512 bytes.
The problem is how to mount sda, if some partition are ntfs and other are ext3?
 
Old 10-29-2010, 08:47 AM   #10
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
You cannot mount the entire drive all at once, but it's OK, because you do not need to do so in order to make a copy of the MBR using dd.
 
Old 10-29-2010, 09:46 AM   #11
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Original Poster
Rep: Reputation: 31
I tried dd if=/dev/sda and it works
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
GRUB install into Volume Boot Record r5. Linux - General 7 06-05-2008 09:34 AM
Moving boot record to mbr raypen Linux - General 5 04-10-2008 08:33 AM
cloning both partitions, dual boot system, master boot record, logical volume manager saranga2000 Linux - Hardware 3 01-10-2005 11:04 AM
How to Clear the Master Boot Record(MBR) hazarcon Linux - Newbie 2 09-15-2004 03:12 AM
boot record (MBR) emperor13 Linux - General 1 12-01-2001 11:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration