LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-26-2008, 04:34 AM   #1
Tomasu
Member
 
Registered: Sep 2006
Location: Edmonton, AB
Distribution: Debian
Posts: 30

Rep: Reputation: 15
Recover truncated file's contents on XFS?


I made a major error while trying to extend the size of a xen image, I ended up truncating the image file, and I can't seem to find any ways of recovering the image.

I don't really care about much of the data, only a few perl scripts and the subversion data directory is important.

I've already remounted read only (which I assume was another error which could have let me recover using the journal, I should have frozen the fs instead), so at least nothing will be writing to the filesystem for now.
 
Old 04-26-2008, 06:51 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
IIGC Photorec supports XFS, so it's worth a shot.
 
Old 04-26-2008, 06:29 PM   #3
Tomasu
Member
 
Registered: Sep 2006
Location: Edmonton, AB
Distribution: Debian
Posts: 30

Original Poster
Rep: Reputation: 15
The only problem is its a 596GB perfectly healthy filesystem, and all I lost was a 4GB disk image. I can't see it working properly.
 
Old 04-27-2008, 08:04 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
I wonder if remounting ro really blocks you from replaying the journal. Anyway. Why can't you run Photorec on your guest partitions directly? Now I don't run Xen but if there's a valid reason why you can't, could you at least dd it out to file or 'xm block-attach' to to some other domain?
 
Old 04-27-2008, 09:58 AM   #5
Tomasu
Member
 
Registered: Sep 2006
Location: Edmonton, AB
Distribution: Debian
Posts: 30

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by unSpawn View Post
I wonder if remounting ro really blocks you from replaying the journal. Anyway. Why can't you run Photorec on your guest partitions directly? Now I don't run Xen but if there's a valid reason why you can't, could you at least dd it out to file or 'xm block-attach' to to some other domain?
remounting likely (though I'm not totally sure) sync's (or flushes) the disk. In order to remount the filesystem I had to shut down the VMs, and I was left with a truncated file. Had the FS been ext2 or ext3, It seems it would have been saveable, but XFS doesn't have any tools to scan the tree for old metadata and try to rebuild things.
 
Old 04-27-2008, 04:35 PM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
So. What's the next step then. What's this Xen image? Partition or file? *Can* you reach it with Photorec?
 
Old 04-28-2008, 12:57 AM   #7
Tomasu
Member
 
Registered: Sep 2006
Location: Edmonton, AB
Distribution: Debian
Posts: 30

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by unSpawn View Post
So. What's the next step then. What's this Xen image? Partition or file? *Can* you reach it with Photorec?
Ah. I should have explained things a little better. Sorry. The "Xen Image" is a large 4GB file thats stores an OS install, that boots in Xen. It is a file, that lives on an XFS filesystem. And while I could run photorec on the device that the XFS filesystem lives on, theres over 500GB of valid data on there.
 
Old 04-28-2008, 05:22 AM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by Tomasu View Post
The "Xen Image" is a large 4GB file thats stores an OS install, that boots in Xen. It is a file, that lives on an XFS filesystem.
OK. With respect to the filesystem inside this Xen image, does Xen support dynamic allocation and preallocation like for instance VMware does? Was the total size of the Xen image before and after truncating the filesystem inside the image file the same? I'm asking because if Xen does it somewhat like Vmware or QEmu, then you can *enlarge* on-disk filesystem containers but you can't shrink them AFAIK, so if something gets truncated *inside* it'll be contained inside the image. If yes, then maybe this Xen image be loopmounted (losetup) or attached readonly to another domain. If no (meaning it uses resources in the host, which sounds weird to me somehow, or does allow for dynamic deallocation), then I'm out of ideas, sorry.

Last edited by unSpawn; 04-28-2008 at 05:24 AM.
 
Old 04-28-2008, 05:24 PM   #9
Tomasu
Member
 
Registered: Sep 2006
Location: Edmonton, AB
Distribution: Debian
Posts: 30

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by unSpawn View Post
OK. With respect to the filesystem inside this Xen image, does Xen support dynamic allocation and preallocation like for instance VMware does? Was the total size of the Xen image before and after truncating the filesystem inside the image file the same? I'm asking because if Xen does it somewhat like Vmware or QEmu, then you can *enlarge* on-disk filesystem containers but you can't shrink them AFAIK, so if something gets truncated *inside* it'll be contained inside the image. If yes, then maybe this Xen image be loopmounted (losetup) or attached readonly to another domain. If no (meaning it uses resources in the host, which sounds weird to me somehow, or does allow for dynamic deallocation), then I'm out of ideas, sorry.
The image was truncated outside of the VM, that is, it was done on the host. I'm pretty sure that the data is gone at this point.
 
Old 04-29-2008, 07:59 AM   #10
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Unless the area the data resided wasn't written over there would be some minute chance, but given host system activity chances for recovery would be about zilch, yes.
 
Old 04-29-2008, 08:08 AM   #11
Tomasu
Member
 
Registered: Sep 2006
Location: Edmonton, AB
Distribution: Debian
Posts: 30

Original Poster
Rep: Reputation: 15
At the time I posted, nothing besides the metadata for the file in question had been written to disk, so I could have successfully run something like photorec, but the filesystem is too large for it to be worth my time looking for the embeded files. 596GBs of data is a lot to go through.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Newby that needs to recover data from failed NAS drive (xfs formatted) MargJT Linux - Newbie 6 02-24-2008 02:13 AM
deleted /boot contents- recover? kpachopoulos Linux - General 1 03-09-2007 03:40 AM
Raid 5 XFS FC2 recover disk failure mattma Linux - Hardware 1 11-11-2006 06:12 PM
Recover files from XFS partition Christof999 Linux - Software 5 07-23-2006 11:47 AM
Help! tar file's name is truncated auden Linux - Newbie 1 03-02-2005 09:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:23 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