recover data

well few days ago I noticed kernel core on one of my systems, .. FreeBSD went into a loop trying to dump the swap however it never managed, so i figured disabing the dump would work, so i got an bootable usb stick and disabled the flag from rc.conf, only to find out it still wanted to dump the swap, so i figured if i zero'd the swap file it would solve the problem because there wouldn't be any data left to dump. This was my mistake i performed dd if=/dev/zero of=/dev/ad4s1b bs=1M on the swap partition, .. only to conclude later that all my data was gone, ..

I was wondering if it is possible in any way to recover this data, because when i fdisk i can still see slices but they have no shape/size, ..

Would dumping the disk, allow me to use a file to work from, so i can already reinstall the system and collect the data later on, if it would be possible at all to recover this data?

Regards, ..
 
ok i extracted scan_ffs to /tmp directory of the fixit
Code:
scan_ffs -l -s /dev/ad4s1 > /tmp/disklabel
I get the list of drives and where they where last mounted.
got one input/output error probably the swap cause that one is missing.
Code:
bsdlabel -R -n -m amd64 ad4 /tmp/disklabel

get error unknown diskabel field. anyone suggestions.

Or does anyone got a good howto on this stuff ? Or how i can dump the disk partitions from fixit to an usb disk so i can recover them later on.

EDIT:
ok i edited the disklabel file to a d e f instead of the X now it created the device list however once i want to mount, it gives invalid argument error

on example mount /dev/ad4a /tmp/mnt same if i use -f or define type -t ufs, it seems though i should of used ad4s1 instead of ad4 though the names changed not sure if that's a problem.
 
ok in order to get rid of the error i removed the disklabel
Code:
dd if=/dev/zero of=/dev/ad4 bs=512 count=16
from ad4 then created the slice using fdisk just agreed to what fdisk already knew and wrote it to the disk, .. what is left now is restoring boot strap

after mounting the main file system to /mnt/tmp
Code:
disklabel -B -b ./boot/boot -m amd64 ad4s1a
however that last one doesn't realy work, anyone suggestions on fixing the bootstrap/record whatever
 
maybe crazy idea and i just noticed so i wonder if this would work if the mbr is 512bytes and boot0 is default mbr would dd if=/boot/boot0 of=/dev/ad4 bs=512 count=1 restore the boot record ?
 
ok i finaly figured out how to do it

Code:
fdisk -BI -b boot ad4
bsdlabel -w -b boot -m amd64 ad4s1a
then do redo the disklabel cause -w will wipe the current disklabel

ps: the trick is to copy every thing to the tmp then unmount the disks cause they won't allow write access to them if they are mounted.
 
well, .. i got to reinstall anyways cause i don't get further then bringing up the ether link but it was nice to figur out how to do this and at least i got my data back.
 
Ofloo said:
well, .. i got to reinstall anyways cause i don't get further then bringing up the ether link but it was nice to figur out how to do this and at least i got my data back.

Good! Now make a backup so you don't have to go through this again.
 
you know the funny part is i bought the disks to do backups like year ago, but i never got to it, something else always came up.
 
True most of my systems have backups however, in 10 years never needed it once. In fact this would of been the first case I was worried about a backup. This time I realised how little I backed up on this system. On the other hand I managed to get the data back, so you got to wonder if a backup is really necessary these days. It would of made things a lot easier though, though I learned a lot of new stuff, which I otherwise wouldn't of bothered reading, .. I'm thinking of setting up zfs with dual disk so I don't really have to worry about proper backups cause from what I understand is that zfs does backups .. on to fly bit like raid-1.
 
You never need a seatbelt until you have a crash either. ;)

To my mind its not a case of whether you need backups (as you got the data back), it's the ease of getting it back in the first place.
 
exactly, I'm not claiming otherwise, however i was thinking of a different system on how to backup currently i did few backups with dump and man it takes forever.
 
Back
Top