partition recovery

Marcin Gryszkalis mg at
Sun Jul 13 03:50:04 PDT 2003

sorry for swapping slices/partitions - it was
too late yesterday and I had too much work...
Here's more explanation:

On 2003-07-13 06:48, Malcolm Kay wrote:
>>there was windows 2000
>>[                  ntfs                     ]

>>I made some place for FreeBSD
> How?
I used partition magic, I resized first dos-partition
and created second primary dos-partition (without
extended dos-partition).
> In FreeBSD terminalogy this is now 2 slices:-
>>[         ntfs          ][  ufs=ad0s2       ]

>>I created slices
> In FreeBSD terminology "created partitions" or
> more specifically "BSD partitions".
right, that's what I did :)
>>[         ntfs          ][( s2a )( s2b )... ]

>>after some time I removed win2000 - and just
>>did newfs on first partition (no repartitioning,
>>no slices - only newfs)
> On the first "slice" -- no "BSD partitioning".
right, the question is - is that ok, to do that?
I mean - to newfs without bsd-partitioning?
>>[        ufs=ad0s1      ][( s2a )( s2b )... ]

> The MBR (master boot record) table will still have
> the first slice marked as ntfs unless you ran fdisk to
> change it.
do you mean - the main dos-partition table?
I *think* I fixed it using gpart. The linux sfdisk says

fake:~# sfdisk -d /dev/hda
# partition table of /dev/hda
unit: sectors

/dev/hda1 : start=       63, size=125821017, Id=a5
/dev/hda2 : start=125821080, size=  3903795, Id=82
/dev/hda3 : start=129724875, size= 30346784, Id=83, bootable
/dev/hda4 : start=        0, size=        0, Id= 0

>>after some time I wanted to install debian GNU/Linux
>>(this is test-box)
>>[    ufs=ad0s1=hda1     ][swap=hda2][ext2=hda3]
>>and here something bad happened during installation
>>(few reboots/kernel panics and so on)

> It seems you have now assigned all "slices" to Linux
> at least in your mind. But what types does fdisk think they are?
I didn't touch the ad0s1 when installing linux,
I just removed ad0s2 and placed two linux-partitions there.
(hda2 - linux swap and hda3 - linux system)
(I wanted to use ad0s1 to move some data to the new system,
I expected linux to be able to mount UFS - at least r/o)

>>it CAN mount it as NTFS (and I can even see
>>some windows files!)
>>  - freebsd can see it as UFS but cannot mount

> Where is FreeBSD? -- it appeared you had given the FreeBSD slice
> ad0s2 over to Linux swap -- but then I'm not knowledgable with 
> respect to exactly what Linux means by hda2.

I run  freebsd from live-cd now (as I explained above
I removed freebsd slice (ad0s2) with all bsd-partitions

>>('bad magic number' or bad superblock),
>>using backup superblock
>>(-b 32) doesn't work.
>>What can I do to recover data from the first partition???
> What data? -- the original ntfs data or what Linux may have installed?
> I suspect that in either case it is now pretty much corrupted. The semblance 
> of windows files will have a scattering of blocks over written by newfs.

I want to recover files from UFS filesystem on ad0s1. It was NTFS before
but as I mentioned before - I did newfs, so It became UFS. I think
the windows files that can be seen are just shadows of old days
(blocks that were not overwritten during using the slice with
FreeBSD). I looked at the slice with lde (linux disk editor, I
don't like the tool but I couldn't find anything more user-friendly)
and it seems that the files I saved to UFS are in good condition.

I hope the case is more clear now :)
What do you advice to do now?

Marcin Gryszkalis

More information about the freebsd-questions mailing list