LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 12-28-2012, 12:57 AM   #1
babami
LQ Newbie
 
Registered: Oct 2009
Posts: 11

Rep: Reputation: 0
Angry Ignorantly erased the wrong partition; this caused my image upgrade to fail


In LINUX environment, I was following a procedure for image upgrade, and ignorantly deleted the wrong drive. Instead of deleting /dev/mtd0, I deleted /dev/mtd1. To make matters worse, being new to this, I went ahead and deleted /dev/mtd0; which means both drives have been deleted. Obviously, my upgrade failed; is this recoverable; is there a way to mount both drives, and load new image on one of them? Thanks for your help.

Last edited by babami; 12-28-2012 at 08:52 AM.
 
Old 12-28-2012, 06:50 AM   #2
peter2012
LQ Newbie
 
Registered: Dec 2012
Distribution: Kubuntu, LUbuntu, Mint, Debian
Posts: 16

Rep: Reputation: Disabled
Would you be so kind to provide some more information for clarification? In particular:
  • You mentioned 'Linux environment'. It would be helpful to know the distribution you used and, which version of it (e.g. 'Ubuntu 10.10', 'Slackware 13.37').
  • What imaging software do you use? (e.g. Clonezilla, ddrescue, just plain dd ...).
  • It's not quite clear what you mean by 'delete'. Could you describe what you did to 'delete' /dev/md1? I know it's sometimes hard to remember when you are in the thick of a battle, but it would really help if you list the steps you took.
  • Just for clarification: You mentioned that you deleted /dev/md1 and then deleted /dev/md1. To me, both descriptors look the same '/dev/md1', /dev/md1'. Was there a typing error somewhere? Maybe you meant '/dev/md0' for the second drive?

As I said, this is for clarification - if you absolutely cannot answer some of the questions, don't worry. Just provide the information you can.

Thanks so much!
P
 
Old 12-28-2012, 09:13 AM   #3
babami
LQ Newbie
 
Registered: Oct 2009
Posts: 11

Original Poster
Rep: Reputation: 0
The Version is: Linux 3.5.4-CSRV3+ #1 PREEMPT Wed Dec 19 16:08:08 NZDT 2012 mips GNU/Linux

The drives erased where /dev/mtd1 and /dev/mtd0:

I used; flash_erase /dev/mtd1, then flash_erase /dev/mtd0 respectively.

Thank for your help.
 
Old 12-28-2012, 12:00 PM   #4
peter2012
LQ Newbie
 
Registered: Dec 2012
Distribution: Kubuntu, LUbuntu, Mint, Debian
Posts: 16

Rep: Reputation: Disabled
Uh oh this is an area which is new to me, too! I had a little look on google, and if I get it right, then flash_erase is part of the mtd-utils package. I looked high and low for the man page for this tool, but there ain't any (or my eye was blind... )

However, I suspect, flash_erase does what the name advertises - it simply deletes all data on a partition on a flash drive. I found the source code for a file "flash_erase.c" http://docs.elphel.com/elphel353-8.0...8c-source.html, and gave the code a short skim. It has a main function, so it's meant to be an executable. I'm not sure what else the program does, but it smells very much like it does what the name says - erases (parts of) the partition specified. So, you probably erased both partitions, /dev/mtd0 and /dev/mtd1. Looking up what 'erase' means, I found http://www.madingley.org/james/resources/flash_erase/ where it says

Quote:
flash_erase writes blocks consisting of 512 bytes of value 0xff to a device you choose, printing progress to stdout.
So, unfortunately, you must have overwritten both partitions with bytes of value 0xff, i.e. your data went out of the window without return ticket. I should think it's not possible to even mount these partitions now. I sincerely hope you didn't have any sensitive data on them. If so - my sympathies, I have had my share of computer battles and mistakes.

If I am correct, then you might as well bite the bullet and blindly load your image onto the partition. However, I stumbled a bit over your statement

Quote:
Obviously, my upgrade failed; is this recoverable; is there a way to mount both drives, and load new image on one of them?
I don't know whether I understand correctly what you mean by 'load an image onto...'. I understand 'image' to mean a sector by sector copy of a storage device, usually kept as a file. To work with such images, I often use the tool 'dd' which does a direct, sector by sector copy of a storage device. Now, if I use dd I never mount a partition, but I just write to it, resp. read from it. For example, to read:
Code:
$ dd if=/dev/sda1 of=/home/myuser/myimages/sda1.img
This will read the partition /dev/sda1 and write a verbatim copy of that partition to a file /home/myuser/myimages/sda1.img. When I want to 'load that image' back onto /dev/sda1, I simply say:
Code:
$ dd if=/home/myuser/myimages/sda1.img of=/dev/sda1
Now, when I 'load' images this way, it is crucial to not mount the partition I read from, resp. write to. Maybe we both have a different understanding of what 'loading an image onto...' means.

However, if we both have the same understanding, then it is good news for you - mirroring an image onto a partition will always overwrite that partition incl. any data that might be on it. So, you may not actually have incurred much damage after all, since dd would have overwritten everything anyway. But I say all this with caution, because I'm not sure what you mean by 'load an image'.

So, long answer, in short:
  • All data on both partitions has gone. I do hope for you there was nothing sensitive on it. Otherwise, my sympathies!
  • Pending our understanding being the same - if there wasn't any important data on those devices, it may not be so bad since mirroring would have erased all old data anyway.

I hope, this helps, and I (sincerely) hope you haven't been hit by data loss. Mistakes do happen, they are very annoying, but you can't undo it and everybody does them. Just keep going and make the best of every situation!

P

Last edited by peter2012; 12-28-2012 at 12:02 PM.
 
Old 01-02-2013, 10:11 PM   #5
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484
Blog Entries: 15

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Hi!babami!

Welcome to Linux Questions!

You mentioned that you:
Quote:
ignorantly deleted the wrong drive
Do you mean that you deleted the partition on the wrong drive?
And do you have more than one HDD?

If so; you may only have the choice to re-install your distribution.

The other thing to think about (I see the Win's flag in your profile) is if you are in a dual boot with another operating system-
Are you?

Last edited by Ztcoracat; 01-02-2013 at 10:19 PM. Reason: Additional question to ask member
 
Old 01-02-2013, 10:22 PM   #6
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484
Blog Entries: 15

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Open the terminal and execute this command as 'root' and post the output so we can see what partitions that you do have. The l that I am referring to is the lower case letter L-
Code:
fdisk -l
 
  


Reply



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
I erased my partition and now get this error: travix Linux - Newbie 14 08-03-2012 11:28 AM
NTFS-utils Resize caused Vista to fail to boot on SATA HDD E211 Linux - Desktop 10 02-06-2008 09:01 PM
I erased the wrong hard drive. now what Yoshimitsuspeed General 8 05-11-2006 09:35 PM
Partition erased -> Grub f****d up :( marty25 Linux - Newbie 2 05-19-2004 05:18 PM
lilo caused to fail NFS statd shanenin Linux - Software 2 09-04-2003 08:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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