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
. Looking up what 'erase' means, I found http://www.madingley.org/james/resources/flash_erase/
where it says
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
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:
$ 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:
$ 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!