Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
10-20-2008, 02:18 PM
|
#1
|
Member
Registered: Jun 2005
Location: U.S.
Distribution: xubuntu 8.10, linux 2.6.27-11-generic
Posts: 78
Rep:
|
Recovery of partition within file
I have a ~250GB file on an ext2 installation of Ubuntu. Within this file is a partition of an ntfs win install. I believe I know the offsets for the partition, I just need to get at it somehow.
So one of two things. I either need a way to split the file into arbitrary sections in place, or I need a way I can use mount on a particular segment of that file.
Any help would be appreciated. Didn't know where to ask this, so if any admin thinks it needs to be somewhere else, please move it.
Besides Ubuntu, I can use whatever you recommend, Knoppix, Slack, etc. Thanks
|
|
|
10-20-2008, 03:56 PM
|
#2
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809
|
I don't know what it means to have a partition within a file---unless you mean a partition image. To help us understand the total picture, please post the results of:
fdisk -l
df
|
|
|
10-20-2008, 04:19 PM
|
#3
|
Member
Registered: Jun 2005
Location: U.S.
Distribution: xubuntu 8.10, linux 2.6.27-11-generic
Posts: 78
Original Poster
Rep:
|
I have a regular file on a 320GB disk. This particular file is itself a straight disk image of a 250GB disk, complete with MBR (corrupted) and 2 partitions.
The thing is I need to mount one of those partitions and retrieve data, but since MBR is corrupt, it isn't as simple as just plugging in and using mount as usual.
I got the MBR off of another machine of the same model, so theoretically, I should know exactly where the desired partition is within this image file. I just need to know how to access that middle chunk of the file.
Thanks and I'll give any more info you need, though I'm not at the machine in question right now.
Last edited by shakezilla; 10-20-2008 at 04:28 PM.
Reason: clarity
|
|
|
10-20-2008, 04:33 PM
|
#4
|
Gentoo support team
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083
|
If you really know the offsets, I guess you should be able to use dd to dump a image of the partition into a new file, that file should be mountable using a loop device I think.
|
|
|
10-20-2008, 05:02 PM
|
#5
|
Member
Registered: Jun 2005
Location: U.S.
Distribution: xubuntu 8.10, linux 2.6.27-11-generic
Posts: 78
Original Poster
Rep:
|
Yeah, but I don't have enough scratch space on that drive to write out to a completely new file.
This was my mom's Compaq, and of course they have the dumb "recovery partition" at the end, which should be a bare install of a few gigs. So the target partition is likely around 240 some odd GB. I'd give you exact numbers if I had the data handy.
Maybe I'm not explaining well, but here's a picture:
Code:
mom's disk (vista, 250GB) my disk (ubuntu, 320GB)
+------------------------+ ----+ +------------------------+
| MBR | | | MBR |
|------------------------| | |------------------------|
| | | | |
| Main Partition | | | Main Partition |
| (ntfs) | | | (ext2) |
| | | | |
| | | | Image file(250GB) |
| | +--->> | +---------------+ |
| | | | MBR | |
| | -------->> | |---------------| |
| | | | Main Part | |
| | -------->> | | | |
| | | | | |
| | -------->> | |---------------| |
| | | | Recovery Part | |
|------------------------| +----->> | +---------------+ |
| Recovery Partition | | | |
| | | | |
+------------------------+ --+ +------------------------+
I need to somehow mount that middle section of the image file, preferably without having to write it out to a new file.
So is there any way to do this without having a >500GB drive to use as scratch space? I have a 640GB, but it's not really convenient to use it, and I really don't wanna have to if there's an easier way.
Thanks
btw, for those who have to deal with vista, beware of the service packs, that's how my mom got into this mess in the first place. That and not backing up. But hey, it's mom, what are you gonna do?
|
|
|
02-27-2009, 03:38 AM
|
#6
|
Member
Registered: Jun 2005
Location: U.S.
Distribution: xubuntu 8.10, linux 2.6.27-11-generic
Posts: 78
Original Poster
Rep:
|
Replying to let everyone know what I figured out.
I never got mount to get at just a section of the file. So I ended up having to just copy the whole file to the beginning of my other HD. (And there was much backing up to be done. And lo, many dvds were burned.)
As a side note, I ended up having to use getDataBack ntfs to recover. How well did it work?
Well, first, the program must be installed onto a windows install, but it is perfectly capable of running from ubcd4win. Runtime even has a plugin for it, but I just installed it to the B: ramdisk, and it worked fine.
It found a ton of files. And LOTS were dupes, so you have to be careful when restoring. I'd say only around 10% of the files were not corrupted. I can't say if the image in question was just super p0wned, or if this is a deficiency in getDataBack. If all those files really were that corrupted, that means that vista sp1 seriously b0rked my mom's drive.
The software is $80 USD, so if you're considering buying it, I would download their trial first. The trial will let you see what files it finds, you just won't be able to back them up. But if you have to stop and exit your windows live, you can save the found file list so that you don't have to scan the HD over again. Alternatively, you can just buy a license from another machine, then take it to the machine being recovered, as you can register the software at any point during the restore process.
|
|
|
02-27-2009, 04:15 AM
|
#7
|
Moderator
Registered: May 2001
Posts: 29,415
|
I don't think you would have needed to buy software. You could have loopmounted the file. If you knew the offsets then you could have loopmounted the partitions because 'losetup' allows you to specify offsets. Without MBR and PT data you could have used 'testdisk' to find out. And while making filesystem contents visible mounting it with ntfs-3g is preferable, even in place carving with 'photorec' or 'foremost' (or pyFLAG or TCT) should work.
|
|
|
02-27-2009, 05:35 AM
|
#8
|
Member
Registered: Jun 2005
Location: U.S.
Distribution: xubuntu 8.10, linux 2.6.27-11-generic
Posts: 78
Original Poster
Rep:
|
Wish you were here earlier
I'll be looking into testdisk, thanks for the info.
|
|
|
02-27-2009, 07:51 PM
|
#9
|
Member
Registered: May 2007
Location: California
Distribution: Slackware/Ubuntu
Posts: 609
Rep:
|
If I understand you correctly, you made an image of your mom's hdd and copied it on to your hdd. Then tried to access the image on your computer.
The mbr was corrupted on your moms computer so it would no longer boot.
Couldn't you access the files on your mom's computer using a live cd such as knoppix? I believe it has ntfs-3g.
Also, if the mbr is corrupted mounting it as a loop probably would not work either.
Testdisk works rather well to recover files and it is FREE. I used it in the past.
|
|
|
02-27-2009, 07:59 PM
|
#10
|
Member
Registered: Jun 2005
Location: U.S.
Distribution: xubuntu 8.10, linux 2.6.27-11-generic
Posts: 78
Original Poster
Rep:
|
I originally tried using both knoppix and slax on my mom's machine, but neither could mount the partition, even after restoring the known good MBR. Which I guess means that the file system was too corrupted for mount to handle.
But you're correct, if I had known about testdisk at the time, I could have used it.
|
|
|
02-27-2009, 10:52 PM
|
#11
|
Member
Registered: May 2007
Location: California
Distribution: Slackware/Ubuntu
Posts: 609
Rep:
|
Quote:
Originally Posted by shakezilla
I originally tried using both knoppix and slax on my mom's machine, but neither could mount the partition, even after restoring the known good MBR. Which I guess means that the file system was too corrupted for mount to handle.
But you're correct, if I had known about testdisk at the time, I could have used it.
|
You probably did not mount it properly.
Did you try the following to mount her drive.
Quote:
fdisk -l #to find the type of device the hdd is
mkdir /vista
#Place the device name found from the fdisk -l results into <moms hdd>
mount /dev/<moms hdd> /vista -t ntfs -r
cd /vista
|
|
|
|
03-01-2009, 01:48 AM
|
#12
|
Member
Registered: Jun 2005
Location: U.S.
Distribution: xubuntu 8.10, linux 2.6.27-11-generic
Posts: 78
Original Poster
Rep:
|
Yes, I did:
Code:
mount -t ntfs /dev/sda1 (or whatever number it was) /mnt/mom
Guess it's possible I could have screwed it up, but I'm pretty comfortable with mount.
|
|
|
03-01-2009, 05:07 AM
|
#13
|
Member
Registered: Sep 2007
Location: Las Vegas, NV
Distribution: Fedora / CentOS
Posts: 674
Rep:
|
testdisk and several other nifty recovery utilities are included in the "Recovery Is Possible" Linux distro. I've had good results with this iso.
|
|
|
All times are GMT -5. The time now is 04:28 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|