LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 01-14-2013, 07:20 AM   #1
rhklinux
Member
 
Registered: Jan 2010
Location: india/pune
Distribution: Arch Fedora20
Posts: 126

Rep: Reputation: 18
I backed up and zero outed mbr and kept back up on same disk


I took backup of mbr by
Code:
dd if=/dev/sda of=mbr-backup bs=512 count=1
then zero outed it
Code:
dd if=/dev/zero of=/dev/sda bs = 512 count=1
Problem here is i forgot to copy the the backup in pendrive.So i want to detect my partition (ext4) on which the mbr-backup is present so that i can restore it.

I tried testDisk:
It detects partition table type as EFI GPT
when i analyse it shows the archlinux partition but does not list the files saying .. Can't open filesystem. Filesystem seems damaged.

Any help appritiated
 
Old 01-15-2013, 03:52 PM   #2
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,590

Rep: Reputation: 412Reputation: 412Reputation: 412Reputation: 412Reputation: 412
Your file system is gone dude, you did a data dump to the drive. Your best option here is to do a fixmbr from a windows recovery disc to rebuild a new MBR.
 
Old 01-15-2013, 04:12 PM   #3
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,653
Blog Entries: 2

Rep: Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096
Since the OP only zeroed out the MBR the file-system is untouched. The fun thing is that Testdisk should be able to recover the disk, since you have made a backup copy of the MBR. Did you make a deep scan with Testdisk?
 
Old 01-15-2013, 04:49 PM   #4
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,590

Rep: Reputation: 412Reputation: 412Reputation: 412Reputation: 412Reputation: 412
Tobi, since he output the dd to /dev/sda wouldnt that kill the partition as well or am I wrong here? Sorry to the OP if I was.
 
Old 01-15-2013, 04:53 PM   #5
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,590

Rep: Reputation: 412Reputation: 412Reputation: 412Reputation: 412Reputation: 412
I see where I went wrong here, I completely overlooked the byte size and count arguments. Without those two arguments then I would be correct as the entire /dev/sda disk would have been overwritten but only the first 512byte block wouldve been over outputted to by the dd command here.

Again, sorry to the OP not sure why I didnt see that the first time through, been a long day heh
 
Old 01-15-2013, 06:06 PM   #6
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
Posts: 4,244

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Isn't it possible to just create a partition starting at the beginning of the disk with a length which is approximately the same as it was? 99 chances out of 100 you get the beginning of the partition right and you can mount the file system. Of course it would produce errors when checking the fs, but maybe you are able to get the mbr image file.

jlinkels
 
Old 01-15-2013, 06:21 PM   #7
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,653
Blog Entries: 2

Rep: Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096
Should be possible, if you can figure out if the partition should begin at sector 63 (partitioned by older Windows versions and older versions of Linux) or sector 2048. And of course assuming that the partition with the MBR copy on it was the first partition in the disk.
 
Old 01-15-2013, 07:09 PM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,501

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
Quote:
Originally Posted by rhklinux View Post
I tried testDisk:
It detects partition table type as EFI GPT
This likely means all the old presumptions about partition location are invalid.

I'm mildly surprised the OP could actually zap the dummy MBR that gpt uses for compatibility. "dd" is kinda stupid that way - it does what its told to do.
If testdisk won't find your files, you might have to resort to a scraper like photorec or foremost. Ugly, very ugly.
 
Old 01-15-2013, 09:51 PM   #9
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,653
Blog Entries: 2

Rep: Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096
It is Arch Linux. I assume that the OP would know if he used GPT or MBR for partitioning the disk.
 
Old 01-15-2013, 10:29 PM   #10
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 1,624

Rep: Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677
If the disk was, at some time in the past, partitioned with GPT, then there would be a backup GPT at the very end of the disk. If you've zeroed out the MBR and its primary partition table, testdisk is going to see that old backup GPT and think that was how the disk was last partitioned.
 
  


Reply

Tags
mbr, testdisk


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 fix mbr in linux or gparted, etc. (for a mbr partitioned disk) imayneed Linux - Newbie 2 08-26-2012 10:50 AM
[SOLVED] How can i get my mbr back? Stranger420 Linux - Newbie 2 12-09-2011 11:32 AM
Help! How do I get backed up music back? Kenny_Strawn Ubuntu 8 10-16-2010 04:00 AM
Anyone know of something like a disk-backed RAM disk? dchicks Linux - Kernel 2 11-04-2009 05:21 PM


All times are GMT -5. The time now is 06:16 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