LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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


View Poll Results: Should Linux have native undelete features by default?
Yes, I think it is better. 9 52.94%
No, you just have to be a little bit careful. 8 47.06%
Voters: 17. You may not vote on this poll

Reply
  Search this Thread
Old 08-29-2009, 02:48 PM   #1
RaptorX
Member
 
Registered: Jun 2009
Location: Emden, Germany
Distribution: Slackware 12.2, Slax 6.1
Posts: 254

Rep: Reputation: 37
Linux Undelete?


as far as I can read almost everywhere if you use the "rm" command in linux you simply cannot retrieve the files anymore...

But today i read this (talking about chattr +u):

Quote:
If a file has the u (undelete) attribute set, then when it is deleted, its contents can still be retrieved (undeleted).
so... two questions:

1) Why isnt that the default behavior?

2) What would happen if you chattr +u your system... any stupid problem I am not aware of?

Last edited by RaptorX; 08-29-2009 at 03:48 PM.
 
Old 08-29-2009, 04:11 PM   #2
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
I was thinking the u option does not apply to current ext2 and ext3 filesystems. Only worked on the orginal ext filesystem and no like rieser or others.

Brian
 
Old 08-29-2009, 05:19 PM   #3
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
From the man chattr output:
Code:
BUGS AND LIMITATIONS
       The  ‘c’,  ’s’,   and  ‘u’ attributes are not honored by the ext2 and ext3 filesystems as
       implemented in the current mainline Linux kernels.    These attributes may be implemented
       in future versions of the ext2 and ext3 filesystems.
 
Old 08-29-2009, 08:18 PM   #4
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
I thought i read long long ago. i could not remember where. I tell you I need to use the man command more often. Thanks

Brian
 
Old 09-03-2009, 11:56 AM   #5
RaptorX
Member
 
Registered: Jun 2009
Location: Emden, Germany
Distribution: Slackware 12.2, Slax 6.1
Posts: 254

Original Poster
Rep: Reputation: 37
The thing is that i got in to some troubles by deleting something by mistake, and there is no recovery... I think at least if it is not a default option there should be a "failsafe" way to know that your files are still there...
 
Old 09-03-2009, 12:06 PM   #6
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
If it's a big concern to you, then you should look into creating an alias to move the files you're "deleting" to the trash can. Easier still is to use the GUI to delete, as that puts deleted files in the trash.
 
Old 09-03-2009, 01:03 PM   #7
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Actually even with all of the above I'm quite positive you can still retrieve the files using photorec and foremost.

I have no need for such a feature. In fact, in rox-filer I set it to delete as soon as I hit delete with no prompts whatsoever, and I have never delete anything I didn't mean to.
 
Old 09-03-2009, 01:30 PM   #8
RaptorX
Member
 
Registered: Jun 2009
Location: Emden, Germany
Distribution: Slackware 12.2, Slax 6.1
Posts: 254

Original Poster
Rep: Reputation: 37
I was not aware of that product.

and actually what i read was that when i file is deleted the linux system writes in those inodes first... so basically the place where your files were get soon overwritten... then that is not true?

Quote:
and I have never delete anything I didn't mean to.
I guess thats because you use GUI a lot... I just used a "find -exec rm" that found exactly what i wanted.... plus a folder that was not supposed to be deleted... and voila.

Last edited by RaptorX; 09-03-2009 at 01:33 PM.
 
Old 09-03-2009, 01:52 PM   #9
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Quote:
Originally Posted by RaptorX View Post
I was not aware of that product.

and actually what i read was that when i file is deleted the linux system writes in those inodes first... so basically the place where your files were get soon overwritten... then that is not true?
Well, they can get overwritten, but they may not, especially if you act ASAP.

Quote:
I guess thats because you use GUI a lot... I just used a "find -exec rm" that found exactly what i wanted.... plus a folder that was not supposed to be deleted... and voila.
Well in that case ... yes
 
Old 09-03-2009, 01:56 PM   #10
RaptorX
Member
 
Registered: Jun 2009
Location: Emden, Germany
Distribution: Slackware 12.2, Slax 6.1
Posts: 254

Original Poster
Rep: Reputation: 37
thats why i was actually asking since I saw that you actually have the attribute "u" to allow undelete natively in the fs but as they explained me it is not working at the moment, but soon it will, Im glad about that .
 
Old 09-03-2009, 02:40 PM   #11
lumak
Member
 
Registered: Aug 2008
Location: Phoenix
Distribution: Arch
Posts: 799
Blog Entries: 32

Rep: Reputation: 111Reputation: 111
if you really are paranoid about this, you can make a directory somewhere (e.g. /var/global_recycle) then write a script to go in /usr/local/bin that will replace the rm command with one that will move everything to the recycle bin of a user or system wide. Then you could clean it up with an extra flag of 'rm --empty'

EXAMPLE SCRIPT ONLY
DO NOT USE AS IS
Code:
#!/bin/sh

if [ $1 == "--empty" ]; then
  rm -rf $HOME/trash/*
else
  mv $@ $HOME/trash
fi
of course you would need some kind of database file (e.g. /var/log/recycledb) OR have a loop that runs through each file and places it in the trash with a path relative to the root system so that you know where the files go. Additionally you would want to put checks in there to avoid overwriting file names by incrementing the name AND checking for names that are too long so that the increment doesn't extend the end.

you could even make a global config file to go in /etc/recycle.conf

OR you could just get in the habit of not removing anything and just moving it all to a directory your self and delete it when you get around to it.

Enjoy making your system "Oops I didn't make a back up" proof. Me personally, I feel I deserve it when I do something stupid. Then I learn from it.


I guess this would actually be a nice feature for a system administrator when answering the question "where did my file go?!"...

Last edited by lumak; 09-03-2009 at 02:44 PM.
 
Old 09-08-2009, 04:32 PM   #12
RaptorX
Member
 
Registered: Jun 2009
Location: Emden, Germany
Distribution: Slackware 12.2, Slax 6.1
Posts: 254

Original Poster
Rep: Reputation: 37
Quote:
Enjoy making your system "Oops I didn't make a back up" proof. Me personally, I feel I deserve it when I do something stupid. Then I learn from it.


I guess this would actually be a nice feature for a system administrator when answering the question "where did my file go?!"...
I guess you are right...

The script that you proposed is actually a good practice for me since I am learning bash scripting. I will try to do something similar, just for fun though, since I guess people is right by saying that just being a little bit more careful you can avoid some things.

The problem comes when newbies like me start messing with the system (and writing shell scripts) that end up making some "magic" in the system files and then not being able to recover them.

As far as the recovery programs go, I was brain washed from windows with the idea that those only existed for windows, until now I didnt know there were programs for linux as well. As far as I could tell in linux (and mac) when you delete a file "is gone".

Thanks guys for the replays, one learns something new every day isnt that true?
 
  


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
Mac File Undelete Software, Undelete Mac files liesnsys Linux - Hardware 3 07-23-2009 09:50 PM
undelete the file in linux RMLinux Linux - Newbie 2 08-23-2006 08:10 AM

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

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