From owner-freebsd-questions@FreeBSD.ORG Thu Jun 27 07:47:13 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6D0BB10B for ; Thu, 27 Jun 2013 07:47:13 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx02.qsc.de (mx02.qsc.de [213.148.130.14]) by mx1.freebsd.org (Postfix) with ESMTP id 1EB9D1022 for ; Thu, 27 Jun 2013 07:47:12 +0000 (UTC) Received: from r56.edvax.de (port-92-195-15-122.dynamic.qsc.de [92.195.15.122]) by mx02.qsc.de (Postfix) with ESMTP id 24BAE24AA6; Thu, 27 Jun 2013 09:47:10 +0200 (CEST) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id r5R7lHuw004259; Thu, 27 Jun 2013 09:47:17 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Thu, 27 Jun 2013 09:47:17 +0200 From: Polytropon To: KK CHN Subject: Re: Retrieving a FreeBSD installation Message-Id: <20130627094717.a3bab5aa.freebsd@edvax.de> In-Reply-To: References: Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-questions X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Polytropon List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2013 07:47:13 -0000 On Thu, 27 Jun 2013 07:28:49 +0000, KK CHN wrote: > List, > > I accidentally installed a Linux variant(mint OS) on my Harddisk > where FreeBSD is installed( which contains my data). > > Is there a possibility to retrieve that FreeBSD Installation which > is overwritten by Linux installation. In most cases: What has been overwritten is lost. But: What has "only" been disallocated (data still on disk) can _sometimes_ be recovered. So it depends on _what_ is still left. Anyway, do not do anything with the disk. Do not try any recovery on the disk itself. Make an image of the disk and use that image file for any further action. In case you damage it, make a new copy. Only work with copies. One wrong step can massively decrease your chances of recovery. > Any hints welcome! It will be a very hard thing. You will probably have a lot of "trial & error" experience, and you will surely learn a lot, for example about file systems. I've written about this topic on this list already, and I will again re-use some details from a previous post to make a list for what you can try. Boot from a live CD or USB stick or a different disk. Then make a copy of the disk using # dd if=/dev/ad0 of=disk.dd where /dev/ad0 is the disk you have accidentally overwritten your OS installation. In case the disk makes any trouble, use dd_rescue or ddrescue (from ports). You can also try this: # fetch -rR /dev/ad0 Also recoverdisk could be useful. Maybe there's enough information left to re-instantiate the file systems? Also try testdisk. When no file system can be re-instantiated, but you're sure your data is still somewhere, you can use photorec for recovery. It is able to recover a lot more than just photos. The ports collection contains further programs that might be worth investigating; just in case they haven't been mentioned yet: ddrescue dd_rescue <- use this to make an image of the disk! magicrescue testdisk <- restores content recoverjpeg foremost photorec Then also ffs2recov scan_ffs should be mentioned. And finally, the "cure to everything" is found in The Sleuth Kit (in ports: tsk): fls dls ils autopsy Keep in mind: Read the manpages before using the programs. It's very important to do so. You need to _know_ what you're dealing with, or you'll probably fail. There is no magical tetroplyrodon to click ^Z and get everything back. :-) Proprietary (and expensive) tools like "R-Studio" or "UFS Explorer" can still be considered worth a try. Their trial versions are for free. "UFS Explorer" even works using wine (I've tried it). If you can remember significant content of your data, you can even use # grep disk.dd to see if it's still in there. With magicrescue, you can try something like this: # magicrescue -r /usr/local/share/magicrescue/recipes -d out disk.dd where out/ is the directory where your results will be written to. Keep in mind that _this_ approach will _not_ recover file _names_! I know how bad it feels for such a "simple" mistake and I won't make fun on you, pointing you to use your backups. Of course you always have the option to send your disk to a professional recovery company. This substitutes learning and trying yourself by impressive amounts of money. ;-) Good luck! -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...