LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 03-02-2013, 12:14 AM   #1
codergeek
Member
 
Registered: Dec 2012
Posts: 52

Rep: Reputation: 7
Backing up MBR: Should I use 512 or 1024 or higher


Hi,

dd if=/dev/sda of=mbr.img bs=512 count=1

I know how to backup my MBR but I am unsure if 512 bytes still applies to today's large size hard drives. It's been eons since I done this so I am unsure if I should still use 512 bytes or higher.

Thanks

Last edited by codergeek; 03-02-2013 at 12:19 AM.
 
Old 03-02-2013, 02:46 AM   #2
allend
Senior Member
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware-current
Posts: 3,519

Rep: Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873
Personally, I prefer to backup all of Track0 as bootloaders can place code there.
For a disk with 63 sectors/track and 512 bytes/sector
Code:
dd if=/dev/sda of=track0.img bs=512 count=63
 
Old 03-02-2013, 03:54 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,487

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
And on the contrary, except when testing the effect(s) of deliberately introducing boot level virii, I have never seen any sense in backing up just the MBR - or immediately following sectors.

Use something like s[fg]disk to backup the partition structure; having backed-up the data separately of course.
For the boot code, simply boot from a liveCD, then chroot and reinstall the loader of choice.

Nothing gets "missed", no mistakes to make.
KISS.
 
Old 03-02-2013, 04:22 AM   #4
H_TeXMeX_H
Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269
I know lilo backs up the MBR when first run, you can find it at '/boot/boot.0800', it is still 512 bytes.

I don't see any reason to back it up, because you can just re-install just as easily.
 
Old 03-02-2013, 04:25 AM   #5
bloody
Member
 
Registered: Feb 2013
Location: Berlin
Distribution: Gentoo, Debian
Posts: 158

Rep: Reputation: 23
The MBR is still, as always, only 1 sectror of 512 bytes. The bootloader, however, does not fit into the few hundred bytes available within the MBR, so it takes about 29KB (GRUB2) additional space, usually in the follow-up sectors. You *may* backup the first 62 (or 63) sectors but you need to be careful, esp. when you restore this. Make dam sure that you do not write over the beginning of the first partition, like, for example, if the layout has changed meanwhile.

Running grub-install is much safer than such lowlevel stuff.

Backing up the first sector (512 bytes) is helpful because if you restore the MBR, sfdisk will know what kind of partition scheme it is dealing with when it's called to restore the (remaining) partition table. If you're not using an extended partition, you won't even need sfdisk because the (up to) 4 primary partitions are defined in the MBR itself.
 
Old 03-02-2013, 05:41 AM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,487

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
gpt ?.
 
Old 03-02-2013, 04:02 PM   #7
codergeek
Member
 
Registered: Dec 2012
Posts: 52

Original Poster
Rep: Reputation: 7
Anyway, I will continue to use 512 byres as I done in the pass. I just though that a larger hard drive like one terabyte would use a higher number than 512 bytes for the MBR/partition area.

Thanks to all repliers for your feedback and assuring me that 512 bytes is still applied to today's larger hard drives.

Last edited by codergeek; 03-02-2013 at 04:04 PM.
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why MBR is limited to 512 bytes? RaviTezu Linux - Newbie 8 11-21-2012 08:47 AM
Question: Does the MBR still occupy the first 512 KB on new computers? crowlpa Linux - Newbie 2 03-05-2012 04:50 PM
vsftpd port higher than 1024 henkoegema Linux - Networking 3 07-16-2006 08:43 AM
GRUB MBR /boot and 1024-cylinder limit tdxloki Linux - Newbie 2 10-28-2005 02:20 PM
backing up the mbr bratchild Linux - Newbie 5 08-30-2004 08:40 PM


All times are GMT -5. The time now is 07:31 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration