hallo,
Almost sounds like you had only the root master-boot-record /dev/mmcblk0
before and now you have added 1 main partition /dev/mmcblk0p1.

If (and only if) that is the case we have to undo the the 1st partition +
check that no nilfs is overwritten.
and I would have to urgently study fdisk to see exactly what it writes when
and where.
The last time I did tricks like these is quit a few years ago.

It is the Linux version of fdisk is it??

So here is the plan of action:
hexdump the master boot record to file.
like this:

dd if=/dev/mmcblk0 of=backup-mmcblk0.mbr count=1 bs=512

then dump any partitions of the device in a format useful as input to
sfdisk. For example,
                  % sfdisk -d /dev/mmcblk0  > mmcblk0 .out
sfdisk is a tool provided with the util-linux
package<http://www.kernel.org/pub/linux/utils/util-linux/>.


or you could use hexdump to get machine readable or man readable images.
Here is the man readable version:
hd -n512 /dev/mmcblk0 > backup-mmcblk0.mbr
hd -n512 /dev/mmcblk0p1 >backup-mmcblk0p1.mbr
etc.

By the way boor records always end with '55 AA'.

Keep your files in a safe place in case we mess something we can at least go
back to the present situation.
If you could dd the whole drive to a file, now that would be magic indeed!
but you must have the space on a harddrive.
count=... is the number of sectors in the above line (dd ...) that you dump
to file.
Hexedit will tell you the number of sectors is you start it with -s option
and then go to the last sector.
DONT stop hexedit with control-x use cntl-c.
DONT use high level or even midlevel tools on a stuffed disk, it normally
messes more than it solves.
unless of course you really,really know what you are doing.
Fiddling the bytes is in general safe and gives results, if a man keeps a
cool head.

Please send me the fdisk version, the size of the card, and the mbr dump to
feast my eyes on.

cheers,

Jan de kruyf.



On Tue, Nov 3, 2009 at 1:27 AM, Paul L <[email protected]> wrote:

> just want to add that I've always been using 1 partition on this
> device, it's actually /dev/mmcblk0p1. But hexedit /dev/mmcblk0p1
> doesn't show that 34 34 at line begining with 0x400, only hexedit
> /dev/mmcblk0 shows it. Not sure if this is a problem.
>
> Any help is greatly appreciated!
>
>
> On 11/2/09, Paul L <[email protected]> wrote:
> > Thanks for the tips. When I first used the SD card, I used fdisk to
> > create the partition.
> >
> > The device is /dev/mmcblk0, and hexedit -d -s /dev/mmcblk0 shows that
> > at the line 0x0400, it is indeed 34 34. What should I do then?
> >
> > I tried gparted, but apparently it has no support for nilfs2.
> >
> > Regards,
> > Paul Liu
> >
> > On 11/2/09, Jan de Kruyf <[email protected]> wrote:
> >> Did you first format this card with fdisk?
> >> did you give it the exact same info this time around?
> >>
> >> Can you read /dev/'sdcard' ? (sdcard being the device in the dev
> >> directory
> >> where the card lives)
> >>
> >> If yes can you run hexedit -s /dev/sdcard1  in a terminal as root?
> >> and go to address 0400 - 04B0 to see if nilfs still exists?
> >>
> >> be very careful no to save any data in hexedit, it will definitely and
> >> finally
> >> destoy your data.
> >>
> >> 0400 looks vagely like this:
> >> 00000400   02 00 00 00 00 00 34 34  00 01 00 00 D3 56 F0 B9
> >> ......44.....V..
> >> 00000410   39 BF D9 73 02 00 00 00  CA 02 00 00 00 00 00 00
> >> 9..s............
> >> 00000420   00 B4 66 65 01 00 00 00  01 00 00 00 00 00 00 00
> >> ..fe............
> >> 00000430   00 08 00 00 05 00 00 00  01 00 00 00 00 00 00 00
> >> ................
> >> 00000440   01 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
> >> ................
> >> 00000450   00 48 16 00 00 00 00 00  73 95 DC 4A 00 00 00 00
> >> .H......s..J....
> >> 00000460   00 00 00 00 00 00 00 00  73 95 DC 4A 00 00 00 00
> >> ........s..J....
> >> 00000470   00 00 32 00 01 00 01 00  73 95 DC 4A 00 00 00 00
> >> ..2.....s..J....
> >> 00000480   00 4E ED 00 00 00 00 00  00 00 00 00 0B 00 00 00
> >> .N..............
> >> 00000490   80 00 20 00 C0 00 10 00  4C 73 DD 3D 01 EC 45 85  ..
> >> .....Ls.=..E.
> >> 000004A0   94 28 44 42 3D F6 EF EC  56 61 72 36 34 00 00 00
> >> .(DB=...Var64...
> >> 000004B0   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
> >> ................
> >> 000004C0   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
> >> ................
> >>
> >> the 34 34 in the top line say this is nilfs.
> >>
> >>
> >> cheers
> >>
> >> jan de kruyf
> >>
> >>
> >>
> >>
> >> On Mon, Nov 2, 2009 at 9:06 PM, Paul L <[email protected]> wrote:
> >>
> >>> Due to some careless handling of my laptop, the SD card popped out
> >>> when the machine is still running. When I put it back in and reboot
> >>> the machine, it says "partition table error". I then ran fdisk and
> >>> recreated the single partition. Then I can no longer mount the nilfs2
> >>> partition that was on the SD card!
> >>>
> >>> Can any one help to me recover the file system? I believe all data are
> >>> still there, but just some bits and pieces are missing for the mount
> >>> to work. Any help is greatly appreciated!
> >>>
> >>> PS: I've a deadline to meet in 4 hours, not sure if I can get my stuff
> >>> back in time... so help please!
> >>>
> >>> --
> >>> Regards,
> >>> Paul Liu
> >>>
> >>> Yale Haskell Group
> >>> http://www.haskell.org/yale
> >>> _______________________________________________
> >>> users mailing list
> >>> [email protected]
> >>> https://www.nilfs.org/mailman/listinfo/users
> >>>
> >>
> >
> >
> > --
> > Regards,
> > Paul Liu
> >
> > Yale Haskell Group
> > http://www.haskell.org/yale
> >
>
>
> --
> Regards,
> Paul Liu
>
> Yale Haskell Group
> http://www.haskell.org/yale
> _______________________________________________
> users mailing list
> [email protected]
> https://www.nilfs.org/mailman/listinfo/users
>
_______________________________________________
users mailing list
[email protected]
https://www.nilfs.org/mailman/listinfo/users

Reply via email to