LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 09-15-2012, 11:26 AM   #16
fcrok
LQ Newbie
 
Registered: Sep 2012
Distribution: archlinux
Posts: 10

Original Poster
Rep: Reputation: Disabled

No, I restored the files to a different parition and selected "unallocated space only" every time.
 
Old 09-15-2012, 11:46 AM   #17
fcrok
LQ Newbie
 
Registered: Sep 2012
Distribution: archlinux
Posts: 10

Original Poster
Rep: Reputation: Disabled
Ok, I ran photorec once again without deleting the large file (and filling up the previously reserved disk space) and it discovered only a few text files which were possibly created and deleted since dd stopped. Interesting, though, is the fact, that after deleting the large file, some files were recovered again (not nearly as much as recovered before). Although mostly small text files were spotted, this shouldn't happen, should it? Can photorec restore overwritten bits sometimes? Maybe running dd if=/dev/zero of=largefile some more times will do the trick? I'll try it out.

Last edited by fcrok; 09-15-2012 at 11:49 AM.
 
Old 09-15-2012, 11:49 AM   #18
SecretCode
Member
 
Registered: Apr 2011
Location: UK
Distribution: Kubuntu 11.10
Posts: 562

Rep: Reputation: 102Reputation: 102
Don't wait forever for the hexdump command to finish if it doesn't show anything other than those lines for a while it's fine

Quote:
Originally Posted by fcrok View Post
Maybe there is a tool which checks whether an inode refers to a given part of the partition or not? This could make my dd command safe.
An inode always refers to somewhere on the same partition (strictly, its multiple block pointers refer to somewhere on the same partition). You can't have file systems covering multiple partitions.

If you want the exact block address within the partition, I guess that is what photorec is telling you: but you have no guarantee that another process won't write another file there after you have deleted it, because the OS thinks the space is free.

Quote:
Originally Posted by fcrok View Post
No, I restored the files to a different parition and selected "unallocated space only" every time.
Now I don't understand. Are the files fully deleted or simply moved to another partition? If the files exist elsewhere on the drive, maybe photorec is scanning that as well?
 
Old 09-15-2012, 11:52 AM   #19
SecretCode
Member
 
Registered: Apr 2011
Location: UK
Distribution: Kubuntu 11.10
Posts: 562

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by fcrok View Post
Can photorec restore overwritten bits sometimes?
Definitely not! If they were recovered, they were not originally overwritten.
 
1 members found this post helpful.
Old 09-15-2012, 12:03 PM   #20
fcrok
LQ Newbie
 
Registered: Sep 2012
Distribution: archlinux
Posts: 10

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by SecretCode View Post
Now I don't understand. Are the files fully deleted or simply moved to another partition? If the files exist elsewhere on the drive, maybe photorec is scanning that as well?
The files were deleted using rm. After photorec discovered such a deleted file, it copies the contents to a new file on another partition (I restore files form sda3 and store the recovered files on sdb1)

Quote:
Originally Posted by SecretCode
Definitely not! If they were recovered, they were not originally overwritten.
Then it is very strange that photorec recovered sooo much files, because I'm definitely sure that every unallocated bit was zeroed. And it is impossible that every file was created and deleted after if removed the large file.
 
Old 09-15-2012, 12:03 PM   #21
SecretCode
Member
 
Registered: Apr 2011
Location: UK
Distribution: Kubuntu 11.10
Posts: 562

Rep: Reputation: 102Reputation: 102
One thing has occurred to me: if a block containing some of a deleted text file is then allocated to another file, which doesn't write over all of it, the text data won't be cleaned by this technique. To illustrate what I mean ...

Time 1: sensitive.txt is a 4KB file taking one 4KB block at location 1000000
Time 2: sensitive.txt is deleted. That disk block is marked free but still contains the text data
Time 3: arbitrary.tmp, a 1 byte file, is allocated to the same location. That disk block is not free, and now contains 1 (or 2 including a NUL?) bytes of the new file but still contains 4094 bytes of your text
Time 4: you run the dd largefile command. Block 1000000 isn't touched because it's not free.
Time 5: arbitrary.tmp is freed but your text data is still on the disk.
Time 6: you delete 'largefile' (or not, makes no difference)
Time 7: you run photorec and it finds that text data, with a couple of garbage characters at the front.

shred (run before deleting the file) I think would address this by overwriting the bytes in the disk block before deleting the file.


... And another thing: ext4 is a journalling file system. I have no idea what the implication of this is (how much written data is copied where), but man shred warns that it may not work on journalling file systems.
 
1 members found this post helpful.
Old 09-15-2012, 12:12 PM   #22
fcrok
LQ Newbie
 
Registered: Sep 2012
Distribution: archlinux
Posts: 10

Original Poster
Rep: Reputation: Disabled
Hey thank you, your last post seems logical. But for the main problem being solved by disabling reserved blocks, I am pleased now It just seemed strange that my first approach didn't work.

So once again thank you for your help and I'll use the button
 
Old 09-15-2012, 12:53 PM   #23
SecretCode
Member
 
Registered: Apr 2011
Location: UK
Distribution: Kubuntu 11.10
Posts: 562

Rep: Reputation: 102Reputation: 102
The only real solution to safe deletion is to put your drive into an industrial shredder.
 
  


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
[SOLVED] overwriting files that are being operated on captainentropy Programming 11 09-19-2011 10:37 AM
[SOLVED] rsync keeps overwriting some unmodified files figure002 Linux - Software 4 01-08-2010 01:16 PM
How to copy files without overwriting? Stephan_Craft Linux - Newbie 7 02-17-2009 05:28 AM
Please Help! Ubuntu keeps overwriting system files! ckr Ubuntu 2 07-13-2006 05:51 PM
php/ftp overwriting files.. prob. collen Programming 1 03-14-2005 04:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 11:41 PM.

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