LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-25-2010, 12:26 AM   #1
ClodHopper
LQ Newbie
 
Registered: Jun 2010
Location: SLO CA
Distribution: Kubuntu
Posts: 5

Rep: Reputation: 0
Could use help trying to recover files from possibly hosed partition


Hello, I've been using Linux for a few years and have managed to find what I need searching (including this great site) until now. I have managed to mess up a substantial partition and don't want to possibly make a bad situation worse by bungling around an area I know next to nothing about. I'll try to explain it fully.

Case. I finally built a new PC (750GB internal HDD, 4GB RAM). I'm used to Kubuntu so I installed that (10.04 x86_64bit); partitioned sda1 1GB swap / sda2 OS 20GB ext4 / balance sda3 home ext4 for time being. Everything runs sweet. My old PC (very, PIII, but more recent 500GB internal HDD) partitioned sda1 486.31MB swap / sda2 OS 22.82GB ext4 / balance (442.46GB) sda3 home ext3 (ext3 because /home was inherited from an earlier install prior to Kubuntu going ext4). Old PC was having PSU prob. I don't have an external HDD or any other large HDD and not enough DVDRs for 280GB or so of data current in /home. So I backed up what I could risking the old PC working long enough. Got the critical stuff, business etc. There remained some 150GB or so, years of pictures, videos, info on car repairs etc (some but by no means all on semi annual DVDR backups). Free space current in new PC's /home partition ~500GB. So I took out the HDD from the old PC and put it in the new in order to copy the remainder then use it in the new PC; made sure BIOS of new PC indicated this 2nd drive did not have boot priority. The correct install booted.

To my surprise (maybe not yours?) during boot with zero indication, Kubuntu decided to use the 2nd HDD's /home partition for its new 442.46GB swap partition instead! I was horrified. I unmounted it immediately but... according to GParted the partition with all those files to copy is now:
/dev/sbd3 File System: unknown 442.46GB Used: --- Unused: --- no flags

I was surprised by kubuntu changing its partitions without input and assuming a ext3 file system on a secondary HD for a 442.46GB swap partition. But, mistake's on me. Call it a lesson. Now I need to know more but don't want to experiment unduly on this drive and possibly make things worse: What should I do next?

Thanks for reading all this.

Last edited by ClodHopper; 06-25-2010 at 12:28 AM.
 
Old 06-25-2010, 01:18 PM   #2
mpapet
Member
 
Registered: Nov 2003
Location: Los Angeles
Distribution: debian
Posts: 548

Rep: Reputation: 72
Ouch!

Booting into single-user mode to check out what got mounted where would have been wise. Still wiser would have been using a live cd and rsync to move the files.

I'll tell you how your old disk became a swap partition.
1. you plugged in the Old Drive to your new system without thinking about what device path would be given to the drives.
2. Old Drive picked up by bios, udev then gave it the device path of where your swap was. Meanwhile the drive that had your swap partition was moved to a different device path.
3. Kubuntu boots and runs fstab... Goodbye Old Drive data.


So, at this point, you need to:
A. poke around the drive with parted and see if it can discover the old partition. (not gparted)
B. If that doesn't work, you need to experiment with mounting the partition using offset values. This might work, but will take some calculations and a meaningful effort at learning about partitions and filesystems. If this works, it will be many times quicker than option C. parted should give you some block boundaries to work with.

Note: A and B are not harmful to the disk data. You are just trying to discover beginning/end of disk partitions that you may be able to infer using the block data from parted.

C. use dd to make a disk image. Then use foremost (see sourceforge) to recover files. After foremost spends hours recovering files, you will spend 10x the hours foremost ran to figure out what's in each file found. You will need lots of disk space to do all of this, but you'll get it back.

Last edited by mpapet; 06-25-2010 at 01:25 PM.
 
Old 06-25-2010, 04:58 PM   #3
ClodHopper
LQ Newbie
 
Registered: Jun 2010
Location: SLO CA
Distribution: Kubuntu
Posts: 5

Original Poster
Rep: Reputation: 0
Thank you mpapet for the information and direction. I'll give it a go with parted.
 
Old 06-27-2010, 12:13 PM   #4
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
If the swap was unused, it is possible though not likely that kubuntu did not do anything other than change the partition type in the partition table.

IN this case, changing the partition type to type 83 (ext3) COULD bring everything back, and I think the filesystem will automatically mount with an offset if the primary boot record is unavailable.
 
Old 06-27-2010, 12:21 PM   #5
bendib
Member
 
Registered: Feb 2009
Location: I'm the rat in your couch.
Distribution: Fedora on servers, Debian on PPC Mac, custom source-built for desktops
Posts: 174

Rep: Reputation: 40
Wow. I pity you. I really don't think much is going to help if your machine thought it was a swap partition and then wrote to it, but give it a go. Ouch.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Recover formatted ext3 partition files mazzo Linux - General 9 07-02-2010 08:36 AM
Recover files after formating partition in fat32 immortaltechnique Linux - Software 1 12-21-2009 02:53 AM
recover files after formating partition justwantin Slackware 10 04-18-2008 07:12 PM
Recover files from XFS partition Christof999 Linux - Software 5 07-23-2006 11:47 AM
how to mount and recover files off NTF partition lewisdw Linux - Newbie 2 06-13-2004 09:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration