Fedora Linux Support Community & Resources Center
  #1  
Old 25th November 2011, 09:05 PM
lafluer13 Offline
Registered User
 
Join Date: Nov 2011
Posts: 4
windows_7firefox
Find the path to the Master Boot Record of hard drive on Fedora 15

Hello;

I would like to know: what is the path to the Master Boot Record of my hard drive on Fedora 15?
Reply With Quote
  #2  
Old 25th November 2011, 09:39 PM
leigh123linux
Guest
 
Posts: n/a
linuxfirefox
Re: Find the path to the Master Boot Record of hard drive on Fedora 15

MBR doesn't have a path, MBR is the first 512bytes on the harddrive.


If you want to back it up try


Code:
dd if=/dev/sda of=/home/*/boot.mbr bs=512 count=1
Reply With Quote
  #3  
Old 3rd December 2011, 04:03 AM
lafluer13 Offline
Registered User
 
Join Date: Nov 2011
Posts: 4
windows_vistafirefox
Re: Find the path to the Master Boot Record of hard drive on Fedora 15

Thanks! The clarification and the method to back up the MBR on the hard drive were essential to my understanding of Linux.

Last edited by lafluer13; 3rd December 2011 at 04:04 AM. Reason: needed to make message clearer
Reply With Quote
  #4  
Old 3rd December 2011, 05:36 PM
srs5694 Offline
Registered User
 
Join Date: Jan 2011
Location: Woonsocket, RI
Posts: 521
linuxfirefox
Re: Find the path to the Master Boot Record of hard drive on Fedora 15

Be aware that the MBR holds two things:
  • The first stage of the computer's boot loader (normally GRUB's first stage, on a Fedora system).
  • The primary MBR partition table, which defines partitions /dev/sda1 through /dev/sda4 (or equivalent for /dev/sdb or other disks).

Backing up the MBR with dd, as leigh123linux suggests, backs up both these pieces of data; but if you want a backup of the partition table, this will not back up your logical partitions. (You might luck out on restoration if the extended partition data still exists on the disk, though.) Also, if you want to restore just one thing or the other, you've got to be careful to specify the correct part of the backup file to restore (via bs, seek, and/or skip options to dd). Personally, I don't usually mess with boot loader backups; instead, I re-install the boot loader using grub-install or similar commands, either using Super GRUB Disk to boot into my regular system or using an emergency CD to boot a recovery system.

For partition table backups, the following command will back up all your partitions (primary and logical) to a text file:

Code:
sfdisk -d /dev/sda > backup.txt
You can then restore them with the following command:

Code:
sfdisk -f /dev/sda < backup.txt
If your partition table is healthy, this is a bit more reliable than a binary MBR backup, especially if you've got logical partitions (numbered above 5 by Linux). The MBR backup can be better if there's something weird or damaged in your MBR and you want to back it up before attempting to fix it.

Also, all of this assumes you've got a BIOS-based computer and an MBR partition table. If your computer uses EFI firmware and boots in EFI mode, the MBR doesn't hold any boot loader code; that goes in the EFI System Partition (ESP). If the disk uses the new GUID Partition Table (GPT) partitioning system, the MBR's partition table holds nothing but a dummy placeholder partition; the real partitions are defined in the GPT data structures, which are located elsewhere on the disk. To back up GPT partitions, I recommend my GPT fdisk family (gdisk, cgdisk, or sgdisk), which includes a backup option that creates a binary backup file. Alternatively, you can use dd to back up the first 34 sectors of the disk -- change "count=1" to "count=34" in leigh123linux's command. To restore such a backup, though, you'll need to either use gdisk or do the math to figure out where to put everything and issue three separate dd commands, each with different seek and skip options.
Reply With Quote
  #5  
Old 5th December 2011, 03:53 PM
VernDog Offline
Registered User
 
Join Date: Aug 2009
Posts: 313
linuxchrome
Re: Find the path to the Master Boot Record of hard drive on Fedora 15

Quote:
Originally Posted by lafluer13 View Post
Thanks! The clarification and the method to back up the MBR on the hard drive were essential to my understanding of Linux.
I use leigh123linux's metod of MBR backup on my primary/logical partitions without any problems on retore. Just make sure you don't alter or move partitons in between restore.

Also, try downloading a small script , Boot Info Script, it will give you lots of valuable information regarding your boot partitions.
Reply With Quote
  #6  
Old 6th December 2011, 08:27 PM
srs5694 Offline
Registered User
 
Join Date: Jan 2011
Location: Woonsocket, RI
Posts: 521
linuxfirefox
Re: Find the path to the Master Boot Record of hard drive on Fedora 15

Quote:
Originally Posted by VernDog View Post
I use leigh123linux's metod of MBR backup on my primary/logical partitions without any problems on retore. Just make sure you don't alter or move partitons in between restore.
Be aware that backing up the MBR [i]does not back up logical partition data![/url] To understand why, you need to know that the MBR (that is, the first sector on the hard disk) holds information on the four primary partitions, but not the logical partition data. On a disk with logical partitions, one of those four primary partitions is an extended partition, which serves as a placeholder for logical partitions. The logical partitions themselves are defined in data structures known as Extended Boot Records (EBRs), which reside scattered about the extended partition. The first EBR is in the first sector of the extended partition, and each EBR contains a partition definition and a pointer to a following EBR (or a null pointer, for the last EBR).

Thus, when you back up an MBR, you back up the location and size of the extended partition. If you then accidentally wipe the MBR, you'll lose your primary and logical partitions. If you restore the MBR, you'll get back your primary partitions, and your logical partitions will also reappear if their EBRs have not been damaged. That's a big if, though. A malfunctioning disk utility might easily trash an EBR, in which case you could lose its partition and all the partitions that follow it. Restoring the MBR in a case like that will do absolutely no good.

This is the reason I recommended using sfdisk; unlike a dd backup of the MBR, sfdisk backs up data on all the partitions -- primary, extended, and logical. Restoring this data will work even if an EBR has been damaged. OTOH, an sfdisk backup omits information such as the cylinder/head/sector (CHS) representations of partitions' start and stop points. Such data is seldom useful, but if you happen to need it, a binary MBR backup will preserve it, at least for the primary partitions. Also, an sfdisk backup is reliable only if the partition table is valid when you run sfdisk. If your disk is already damaged, the sfdisk output may be unreliable, so using a binary MBR backup may be the best way to preserve its data before you attempt repairs.
Reply With Quote
Reply

Tags
fedora 15, mbr

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to backup and reset the master boot record and partition table of a drive plasmonics Guides & Solutions (No Questions) 1 16th October 2011 06:08 PM
[SOLVED] Master Boot Record damage Hagis Using Fedora 0 25th June 2011 02:54 AM
Rebuilding the Grub Boot Loader on Master Boot Record (MBR) w Fedora Linux Vector Guides & Solutions (No Questions) 6 1st August 2009 08:39 AM
can't get GRUB into Master Boot Record OSBORNE1934 Installation, Upgrades and Live Media 2 6th November 2006 08:55 PM
Help with Master Boot Record NCortes Using Fedora 6 27th June 2005 05:25 AM


Current GMT-time: 09:52 (Friday, 31-10-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat
Baras - Pallippatti Instagram Photos - Rheinstetten Photos