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 11-11-2012, 08:05 AM   #1
dsschanze
Member
 
Registered: Aug 2004
Location: Gainesville, FL
Distribution: Linux Mint 12, Win7, iOS
Posts: 208

Rep: Reputation: 33
Recovering Data After Disconnecting External HD Without Unmounting


This morning in haste, I stupidly disconnected my external HD from my laptop and as a result some of my files that had just finished copying have gone missing. While the files I lost are not super critical to get back - it would be nice to be able to retrieve them. Is an application such as Photorec the easiest way to attempt their retrieval or is another application more suitable. Also it appears that space is being taken up by these files on my external HD - is there a way to reclaim this space?

Thanks!
 
Old 11-11-2012, 10:03 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
Quote:
Originally Posted by dsschanze View Post
This morning in haste, I stupidly disconnected my external HD from my laptop and as a result some of my files that had just finished copying have gone missing.
In short syncing didn't complete and as a result the files weren't written completely.


Quote:
Originally Posted by dsschanze View Post
While the files I lost are not super critical to get back - it would be nice to be able to retrieve them.
You referred to "copying" which in contrast to moving means the original is still available. That being the case I wouldn't bother with recovery.


Quote:
Originally Posted by dsschanze View Post
Is an application such as Photorec the easiest way to attempt their retrieval or is another application more suitable.
Photorec, Scalpel and Foremost all can or can't make heads or tails of it but IMHO something being suitable depends on an understanding of the tools and the situation. Think files that are incomplete anyway, files that don't have proper header / footer signatures or an OP forgetting to mention he compounded the situation by already having run fsck or copied files over or something like that. Whatever you intend to use do read the manual, set the victim drive read-only, decide if you need to make an image of the drive or can live without it and always recover to a physically different medium.


Quote:
Originally Posted by dsschanze View Post
Also it appears that space is being taken up by these files on my external HD - is there a way to reclaim this space?
Running fsck on the medium should fix file systems problems if any and correct the file systems state (dirty > clean). If after that space still doesn't seem to be reclaimed you could zero out free space by dd'ing /dev/zero to a file on the medium.
 
1 members found this post helpful.
Old 11-11-2012, 10:14 AM   #3
dsschanze
Member
 
Registered: Aug 2004
Location: Gainesville, FL
Distribution: Linux Mint 12, Win7, iOS
Posts: 208

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by unSpawn View Post
In short syncing didn't complete and as a result the files weren't written completely.



You referred to "copying" which in contrast to moving means the original is still available. That being the case I wouldn't bother with recovery.


Photorec, Scalpel and Foremost all can or can't make heads or tails of it but IMHO something being suitable depends on an understanding of the tools and the situation. Think files that are incomplete anyway, files that don't have proper header / footer signatures or an OP forgetting to mention he compounded the situation by already having run fsck or copied files over or something like that. Whatever you intend to use do read the manual, set the victim drive read-only, decide if you need to make an image of the drive or can live without it and always recover to a physically different medium.



Running fsck on the medium should fix file systems problems if any and correct the file systems state (dirty > clean). If after that space still doesn't seem to be reclaimed you could zero out free space by dd'ing /dev/zero to a file on the medium.
Thanks for the suggestions...I did make a mistake in my original post - I was moving the files not copying. I'll take a look at the manuals of the different apps.

You mention that fsck will fix the any file system problems - will this fix problems on an NTFS medium or only ext3/4 filesystem?
 
Old 11-11-2012, 10:54 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
Quote:
Originally Posted by dsschanze View Post
I'll take a look at the manuals of the different apps.
You'll probably find Photorec to be the easiest to use with the largest amount of ready-made signatures. Note its companion app 'testdisk' can be used to have a "Live view" of the victim disk: umount the partition or remount it read-only then point testdisk at it, for example 'cd /tmp; testdisk /debug /log /dev/sdc1' and then you can "browse" the file system: ( Proceed > Choose partition table type ("none" if mounting a partition) > Advanced > Undelete).


Quote:
Originally Posted by dsschanze View Post
You mention that fsck will fix the any file system problems - will this fix problems on an NTFS medium or only ext3/4 filesystem?
Just to be clear: do not, I repeat, do not run fsck on partitions you still have to recover items from. Next to overwriting files it's the best way to fsck up a file system further. The best tools for any file system are those that are native to the system: NTFS specs aren't exactly secret and NTFS-3g works well enough to perform write ops w/o problems but ntfsfix isn't a "fsck for NTFS" and the manual says that too.
 
  


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
Connecting and disconnecting an external monitor javascriptninja Linux - Hardware 3 01-28-2012 12:19 PM
External hard drive unmounting itself rhjp Linux - Hardware 3 07-28-2010 03:47 PM
Unmounting external USB drives Completely Clueless Linux - Newbie 4 05-03-2010 12:48 PM
external HDD disconnecting biggles1963 Linux - Newbie 8 07-10-2009 07:29 PM
Toshiba external unmounting problem florian224545 Linux - Newbie 6 02-19-2009 06:57 PM

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

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