Re: need hints to recover lost FreeBSD partition entries in MBR ...
Le Dimanche 11 septembre 2005 à 20:24 +0200, Andreas Klemm a écrit : fdisk -u did the trick to interactively edit the partition table. Confusing was then, that the previous FreeBSD partitions /dev/ad4s3d and /dev/ad4s4d were not present anymore. I had to use /dev/ad4s3c and /dev/ad4s4. But now I luckily was able to mount my old filesystems. Am now in the process of cleaning up. Thanks for all the help. Too late but you might want to have a look at sysutils/testdisk. -- Florent Thoumie [EMAIL PROTECTED] signature.asc Description: This is a digitally signed message part
Re: need hints to recover lost FreeBSD partition entries in MBR ...
On Mon, Sep 12, 2005 at 10:30:51AM +0200, Florent Thoumie wrote: Le Dimanche 11 septembre 2005 à 20:24 +0200, Andreas Klemm a écrit : fdisk -u did the trick to interactively edit the partition table. Confusing was then, that the previous FreeBSD partitions /dev/ad4s3d and /dev/ad4s4d were not present anymore. I had to use /dev/ad4s3c and /dev/ad4s4. But now I luckily was able to mount my old filesystems. Am now in the process of cleaning up. Thanks for all the help. Too late but you might want to have a look at sysutils/testdisk. hmmm ... are you sure that it not only displays the filling of mounted filesystems ? From the ports description it looks to me: `disktool' is a good sysadmin tool for monitoring diskfull situations to avoid datafile corruption. My situation was way different, since I lost my partition table in MBR and was not able to mount anything since I needed to reconstructure the partitiontable using fdisk 1st. Andreas /// -- Andreas Klemm - Powered by FreeBSD 5.4 Need a magic printfilter today ? - http://www.apsfilter.org/ ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: need hints to recover lost FreeBSD partition entries in MBR ...
Andreas Klemm wrote: On Mon, Sep 12, 2005 at 10:30:51AM +0200, Florent Thoumie wrote: Le Dimanche 11 septembre 2005 à 20:24 +0200, Andreas Klemm a écrit : fdisk -u did the trick to interactively edit the partition table. Confusing was then, that the previous FreeBSD partitions /dev/ad4s3d and /dev/ad4s4d were not present anymore. I had to use /dev/ad4s3c and /dev/ad4s4. But now I luckily was able to mount my old filesystems. Am now in the process of cleaning up. Thanks for all the help. Too late but you might want to have a look at sysutils/testdisk. hmmm ... are you sure that it not only displays the filling of mounted filesystems ? From the ports description it looks to me: `disktool' is a good sysadmin tool for monitoring diskfull situations to avoid datafile corruption. That is sysutils/disktool, not sysutils/testdisk :-) -- Florent Thoumie FreeBSD Committer [EMAIL PROTECTED] ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: need hints to recover lost FreeBSD partition entries in MBR ...
You might want /usr/ports/sysutils/scan_ffs from the package description: scan_ffs(8) recovers accidential lost or deleted disklabels. ... This little program will take a raw disk device (which you might have to create) that covers the whole disk, and finds all probable UFS/FFS parti- tions on the disk. It has various options to make it go faster, and to print out information to help in the reconstruction of the disklabel. I have used this to rebuild slice/partition tables. Run scan_ffs on the raw disk. It will find the superblocks and print the start and length of the each FS from the superblocks. You might have to offset the numbers based on the start of the old slice as the values will probably be referenced to raw disk block 0, not the old slice block 0. Good luck! Joe Koberg joe at osoft dot us Andreas Klemm wrote: I unluckily lost the partition table of my 1st disc in a 2 disc system. Tip: avoid gag boot manager and don't do my mistakes ... Having a printout of the df command I was able to re-create all of my fat32 partitions on disc XP boot and 4x FAT32 in an extended part. Now I'm looking for suggestions how to be able to compute the correct values for Slice 3 and 4 which I could not recover so far. It irritates me a bit, that the slices 1+2 already work so well, so theoretically mounting of at least slice 3 should be possible now. Or are there some sanity checks in the kernel that only allows creating the devices in devfs if the size entries in the disklabel and the entry in the partition table of the MBR fit both ?? Maybe I'm only off-by 1 or 2 cylinders in the partition table. Do you know a tool or a method how I can compute/find the start cylinder of FreeBSD partitions ? Perhaps Im already at the right start cylinder and now only have to de-chiffre the entries of the BSD disklabel, which should be in the 1st sector of sector 312581808 ??? This I was able to restore, which works well. Disk name: ad4FDISK Partition Editor DISK Geometry: 19457 cyls/255 heads/63 sectors = 312576705 sectors (152625MB) Offset Size(ST)End Name PType Desc SubtypeFlags 0 63 62- 12 unused0 63 24579387 24579449ad4s1 7fat 11 24579450 174080340 198659789ad4s2 4 extended DOS5 198659790 113922018 312581807- 12 unused0 I only had this data available to compute the rest... Filesystem1k-blocks UsedAvail Capacity Mounted on /dev/ad4s3d 81194484 7469890 0% /test /dev/ad4s4d46026106 24134198 18209820 57% /data This resulted in that partitioning, which unluckily doesnt work. Disk name: ad4FDISK Partition Editor DISK Geometry: 19457 cyls/255 heads/63 sectors = 312576705 sectors (152625MB) Offset Size(ST)End Name PType Desc SubtypeFlags 0 63 62- 12 unused0 63 24579387 24579449ad4s1 7fat 11 24579450 174080340 198659789ad4s2 4 extended DOS5 198659790 17077095 215736884ad4s3 8freebsd 165 215736885 96839820 312576704ad4s4 8freebsd 165 312576705 5103 312581807- 12 unused0 In devfs I only see the devices rw-r- 1 root operator4, 17 11 Sep 09:56 ad4s3 crw-r- 1 root operator4, 27 11 Sep 09:56 ad4s3c crw-r- 1 root operator4, 18 11 Sep 09:56 ad4s4 crw-r- 1 root operator4, 28 11 Sep 09:56 ad4s4c But not ad4s3d and ad4s4d which would indicate I got the partition table entries for Slice 3+4 right. Andreas /// ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: need hints to recover lost FreeBSD partition entries in MBR ...
On Sun, Sep 11, 2005 at 09:42:54AM -0500, Joe Koberg wrote: You might want /usr/ports/sysutils/scan_ffs from the package description: scan_ffs(8) recovers accidential lost or deleted disklabels. Thanks for the hint. It turns out for me that for some strange reason the FreeBSD Slice 4 doesnt start exactly on a Cylinder boundary :-( DragonFly or Partition Magic, one of these tools must be the culprit. Disk name: ad4FDISK Partition Editor DISK Geometry: 19457 cyls/255 heads/63 sectors = 312576705 sectors (152625MB) Offset Size(ST)End Name PType Desc SubtypeFlags 0 63 62- 12 unused0 63 24579387 24579449ad4s1 7fat 11= 24579450 174080340 198659789ad4s2 4 extended DOS5 = 198659790 18860310 217520099ad4s3 8freebsd 165= 217520100 95061708 312581807- 12 unused0 scan_ffs -s -b 217520100 ad4 ufs2 at 217528802 size 23761975 mount /data time Mon Jan 31 16:49:36 2005 off by 8702 (217528802-217520100=8702) detected partition start doesnt start on cylinder: 217528802/255/63=13540.54 Although I try to make the previous slice 3 a little larger sysinstall doesnt allow me to make the slice greater than up to the partition boundary. So I end up with that, see above 217520100/255/63=13540.00 Using sysinstall I cannot create a slightly wrong but working partition table to access my data again. Question: What can I use now to be able to re-create Slice 4 starting not exactly at partition boundary but instead at Sector 217528802 I tried fdisk but cannot enter something like interactive mode. All it tells me is this: [EMAIL PROTECTED] ~ fdisk ad4 *** Working on device /dev/ad4 *** parameters extracted from in-core disklabel are: cylinders=310101 heads=16 sectors/track=63 (1008 blks/cyl) Figures below won't work with BIOS for partitions not in cyl 1 parameters to be used for BIOS calculations are: cylinders=310101 heads=16 sectors/track=63 (1008 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 11 (0x0b),(DOS or Windows 95 with 32 bit FAT) start 63, size 24579387 (12001 Meg), flag 0 beg: cyl 0/ head 1/ sector 1; end: cyl 1023/ head 254/ sector 63 The data for partition 2 is: sysid 5 (0x05),(Extended DOS) start 24579450, size 174080340 (85000 Meg), flag 0 beg: cyl 1023/ head 255/ sector 63; end: cyl 1023/ head 254/ sector 63 The data for partition 3 is: sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD) start 198659790, size 18860310 (9209 Meg), flag 80 (active) beg: cyl 1023/ head 255/ sector 63; end: cyl 1023/ head 254/ sector 63 The data for partition 4 is: UNUSED How can I enter interactice mode in fdisk ??? Andreas /// -- Andreas Klemm - Powered by FreeBSD 5.4 Need a magic printfilter today ? - http://www.apsfilter.org/ ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: need hints to recover lost FreeBSD partition entries in MBR ...
fdisk -u did the trick to interactively edit the partition table. Confusing was then, that the previous FreeBSD partitions /dev/ad4s3d and /dev/ad4s4d were not present anymore. I had to use /dev/ad4s3c and /dev/ad4s4. But now I luckily was able to mount my old filesystems. Am now in the process of cleaning up. Thanks for all the help. -- Andreas Klemm - Powered by FreeBSD 5.4 Need a magic printfilter today ? - http://www.apsfilter.org/ ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: need hints to recover lost FreeBSD partition entries in MBR ...
Andreas Klemm wrote this message on Sun, Sep 11, 2005 at 11:39 +0200: I unluckily lost the partition table of my 1st disc in a 2 disc system. Tip: avoid gag boot manager and don't do my mistakes ... Having a printout of the df command I was able to re-create all of my fat32 partitions on disc XP boot and 4x FAT32 in an extended part. Now I'm looking for suggestions how to be able to compute the correct values for Slice 3 and 4 which I could not recover so far. It irritates me a bit, that the slices 1+2 already work so well, so theoretically mounting of at least slice 3 should be possible now. Or are there some sanity checks in the kernel that only allows creating the devices in devfs if the size entries in the disklabel and the entry in the partition table of the MBR fit both ?? Maybe I'm only off-by 1 or 2 cylinders in the partition table. Do you know a tool or a method how I can compute/find the start cylinder of FreeBSD partitions ? I've just been working on rewriting ffsrecov in python so that it supports both UFS1 and UFS2 filesystems... I've put up a preliminary copy at http://people.FreeBSD.org/~jmg/ffsrecov/ You'll need all three files in the directory. It uses a modified version of Dug Song's dpkt for reading data from disk. It doesn't search out disklabel magic's, but can help you locate your UFS partitions... In the old days, the disklabel started as the same address as the first partion, but newer installs start the first partition 16 blocks into the disk, so this should give you options for adjusting where the disklabel might be... ffsrecov.py -f will return all the block offsets that contain a valid superblock magic... you can then use -s to print out where the file system starts... so: disk=/dev/ad0 size=`diskinfo $disk | awk '{ print $3 }' for i in `./ffsrecov.py -z $size -f $disk`; do ./ffsrecov.py -z $size -s -o $i $disk; done | sort -u will print out a list of block offsets where all the file systems start... (the reason you have to provide size is that I don't have code to detect the size of disk devices yet)... becareful, it can take a while as it scans the disk, or you can scan a smaller part of the disk by replacing disk and size with the proper settings... Then you can adjust your partition table to be either at the start of the x'th filesystem, or 16 sectors before that... Hope this helps.. Though it might be easier to search for the disklabel magic block directly... It wouldn't be too hard to modify the -f to search for a disklabel magic instead of superblock magic... Good luck! -- John-Mark Gurney Voice: +1 415 225 5579 All that I will do, has been done, All that I have, has not. ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to [EMAIL PROTECTED]