LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-27-2012, 03:52 AM   #1
ajayyadavmca
LQ Newbie
 
Registered: Dec 2006
Posts: 28

Rep: Reputation: 0
backup and restore boot partition


what is the best way to backup and restore boot partition.

using lvm snapshots is not right way as it doesnt deal with MBR.
tried using tar but cudnt make it successfull.

Please let me know if you have known any?
Thanks, Ajay
 
Old 06-27-2012, 08:47 AM   #2
firstfire
Member
 
Registered: Mar 2006
Location: Ekaterinburg, Russia
Distribution: Debian, Ubuntu
Posts: 709

Rep: Reputation: 428Reputation: 428Reputation: 428Reputation: 428Reputation: 428
Hi.

If you ask how to backup/restore MBR, then `dd' is your friend:

Backup:
Code:
dd if=/dev/sda of=mbr.bin bs=512 count=1
Restore:
Code:
dd if=mbr.bin of=/dev/sda bs=512 count=1
As mentioned here, `sfdisk' is another possibility.
 
Old 06-27-2012, 10:45 PM   #3
ajayyadavmca
LQ Newbie
 
Registered: Dec 2006
Posts: 28

Original Poster
Rep: Reputation: 0
thanks

thanks for reply
sfdisk should not be used for partitions, its mainly for disks.

for dd it looks to be better option, but my problem was backing up whole partition(with MBR) not just the MBR.
please let me know if anybody has done it successfully.
 
Old 06-27-2012, 11:02 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,103

Rep: Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117
The MBR is not part of any partition.

For LVM you would be better concentrating on maintaining a good backup of the LVM metadata - see "man vgcfgbackup".
 
Old 06-28-2012, 01:26 AM   #5
kinneyd
LQ Newbie
 
Registered: Oct 2011
Posts: 21

Rep: Reputation: Disabled
You mention the /boot partition. I'm assuming boot is it's own filesystem and not in a logical volume. You just use tar to get this data. If you lost the system I assume you'll be rebuilding the partition table anyway. From a rescue disk you could 1) build the partition table, 2) restore /boot from the tar 3) rebuild the rest of the system from your snapshots, 4) do a chroot and re-run grub install to re-install the boot loader in the mbr. I've done this successfully a few times when moving a system to new hardware.

If you just want to preserve the mbr, I agree with fistfire.
 
  


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
How to backup and restore a multiple partition hd? jharris1993 Linux - Software 9 03-18-2006 01:41 PM
Windows partition backup/restore golinari Linux - General 6 02-20-2005 02:26 PM
Need to backup then restore a linux partition stuart Linux - General 5 07-16-2004 07:30 AM
Why can't I restore a partition table backup containing a reiser partition? oldweasel Linux - Software 2 05-23-2004 12:11 AM
using dd to backup/restore windows partition win32sux Linux - General 9 01-26-2004 03:27 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:57 AM.

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
Open Source Consulting | Domain Registration