recovering partitions (not slices), is it possible? (Solution)

JoséM.Fandiño freebsd4 at fadesa.es
Mon Jan 26 09:49:06 PST 2004


Hello again,

I was able to recover all deleted partitions :)

I found this program http://ls.si.ru/freebsd/find-super-blocks.c
it provides me sufficient information for recreating both
partitions.

From another FreeBSD machine it was as easy as:
prue5# ./find-super-blocks /dev/ad2s2
FS_MAGIC at sector 16: / -> 204800 sectors. bsize: 16384
FS_MAGIC at sector 409616: /var -> 196608 sectors. bsize: 16384

with this output we can give the appropriated value to
disklabel and redefine the boundary between the root and
var partitions.

8 partitions:
#        size   offset    fstype   [fsize bsize bps/cpg]
  a:   409600        0    4.2BSD        0     0     0   # (Cyl.    0 - 433*)
  c:   803250        0    unused        0     0         # (Cyl.    0 - 849)
  e:   393650   409600    4.2BSD        0     0     0   # (Cyl.  433*- 849*)

prue5# fsck -f /dev/ad2s2a
** /dev/ad2s2a
** Last Mounted on /mnt
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
2420 files, 22779 used, 77980 free (820 frags, 9645 blocks, 0.8% fragmentation)

prue5# fsck -f /dev/ad2s2e
** /dev/ad2s2e
** Last Mounted on /data2
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
1188 files, 53963 used, 43548 free (1020 frags, 5316 blocks, 1.0% fragmentation)

regards.

"José M. Fandiño" wrote:
> 
> Hello,
> 
>  I was trying to install FreeBSD 5.2 in the slice ad0s3 but
> accidentally I erased two partitions of my 4.9 system which
> were in the ad0s2 slice :(
> 
> ad0s1 -> Linux boot
> ad0s2 -> FreeBSD 4.9 (deleted partitions)
> ad0s3 -> FreeBSD 5.2
> ad0s4 -> Extended partition
> 
> they were the root and var partitions (usr and home were
> in different disks).
> strings /dev/ad2s2c | grep "/dev/ad0s2.*ufs"
> /dev/ad0s2e             /var            ufs     rw,noatime,nosuid       0       1
> /dev/ad0s2a             /               ufs     rw              1       1
> 
> As the disk hasn't been reformatted or written over all the
> data is still here.
> 
> I haven't got luck googling, so I would like to ask for
> advises. Perhaps searching some type of signature helps
> to find the deleted partitions.
> 
> thanks you.
> 
> # fdisk ad2
> ******* Working on device /dev/ad2 *******
> parameters extracted from in-core disklabel are:
> cylinders=8912 heads=15 sectors/track=63 (945 blks/cyl)
> 
> Figures below won't work with BIOS for partitions not in cyl 1
> parameters to be used for BIOS calculations are:
> cylinders=8912 heads=15 sectors/track=63 (945 blks/cyl)
> 
> Media sector size is 512
> Warning: BIOS sector numbering starts with sector 1
> Information from DOS bootblock is:
> The data for partition 1 is:
> sysid 131 (0x83),(Linux native)
>     start 63, size 16002 (7 Meg), flag 80 (active)
>         beg: cyl 0/ head 1/ sector 1;
>         end: cyl 16/ head 14/ sector 63
> The data for partition 2 is:
> sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
>     start 16065, size 803250 (392 Meg), flag 0
>         beg: cyl 17/ head 0/ sector 1;
>         end: cyl 866/ head 14/ sector 63
> The data for partition 3 is:
> sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
>     start 819315, size 2634660 (1286 Meg), flag 0
>         beg: cyl 867/ head 0/ sector 1;
>         end: cyl 1023/ head 14/ sector 63
> The data for partition 4 is:
> sysid 5 (0x05),(Extended DOS)
>     start 3453975, size 4964085 (2423 Meg), flag 0
>         beg: cyl 1023/ head 14/ sector 63;
>         end: cyl 1023/ head 14/ sector 63
> 
> # disklabel ad2s2
> # /dev/ad2s2:
> 8 partitions:
> #        size   offset    fstype   [fsize bsize bps/cpg]
>   c:   803250        0    unused        0     0         # "raw" part, don't edit
> 
> --
> -----BEGIN GEEK CODE BLOCK-----
> Version: 3.1
> GCS/IT d- s+:+() a- C+++ UBL+++$ P+ L+++ E--- W++ N+ o++ K- w---
> O+ M+ V- PS+ PE+ Y++ PGP+>+++ t+ 5 X+$ R- tv-- b+++ DI D++>+++
> G++ e- h+(++) !r !z
> ------END GEEK CODE BLOCK------
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/IT d- s+:+() a- C+++ UBL+++$ P+ L+++ E--- W++ N+ o++ K- w---
O+ M+ V- PS+ PE+ Y++ PGP+>+++ t+ 5 X+$ R- tv-- b+++ DI D++>+++
G++ e- h+(++) !r !z
------END GEEK CODE BLOCK------


More information about the freebsd-questions mailing list