Article View: aus.computers.linux
Article #59768Re: undelete / unrm / file recover for linux?
From: SaskPower
Date: Sat, 18 Nov 1995 00:00
Date: Sat, 18 Nov 1995 00:00
45 lines
2902 bytes
2902 bytes
So many people keep asking for an undelete on Linux..... (sigh).
Due to the nature of a multi-tasking (I mean a REAL one like linux)
operating systems, you cannot expect to do it the way DOS does.
DOS uses a disk allocation scheme which ensures that the NEWEST
freed up space is not reallocated for a while, so you CAN recover
a file if you have not generated a LOT of new ones before you
attempt recovery. This only works reliably if you don't have several
other concurrent users ALSO generating a bunch of files, so any
multitasking O/S generally does not do this.
What you CAN do if you must:
Use either GNU mv or BSD mv which have OPTION flags to prevent
replacement of an existing destination file by renaming them
with numbered suffixes. This so that you can 'delete' multiple
instances of files with the same name...
make a shell script, say call it delete or del like:
mv --backup -Vt $1 $HOME/trash
(This works with GNU mv, I think BSD uses different flags)
Then make sure that EVERY user has a trash directory in their
$HOME for these 'deletions' to be moved to.
Lastly, set up a root cron job to REALLY delete files after they
have aged a bit (A week should be PLENTY). This would be
a script scheduled to run at off times (Say daily at 3 in the morning)
which does:
for i in user1 user2 user3 <ad nauseum>; do cd /home/$i/trash; \
find . -atime +7 -exec rm -f {} \; ; done
cd /root/trash # root user should be your only exception...
find . -atime +7 -exec rm -f {} \;
You COULD change this to read /etc/passwd file to pick out users...
You COULD run something like this at bootup if you don't leave
your system running 24 hours a day.
The linux FAQ says this kind of thing is possible, (Question 4.1)
but does not give details... Since this question is ASKED so often,
maybe these rough details should be included...
I personally don't think Theodore T'so should be spending time
with an undelete to ext2 filesystem to handle this, as the above is
so easy to confiugure to your needs and would be more reliable
than changes to a filesystem... ext2 is just GREAT the way it is... 8^)
Technical Details
Message-ID:
<48l805$e4d@sue.cc.uregina.ca>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<EKU.95Nov17105401@delphi.philosys.de>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f5392,355ac0499e9cf894 X-Google-Attributes: gidf5392,public X-Google-Thread: 10c696,355ac0499e9cf894 X-Google-Attributes: gid10c696,public X-Google-Thread: 1103af,355ac0499e9cf894 X-Google-Attributes: gid1103af,public X-Google-Thread: 102983,355ac0499e9cf894 X-Google-Attributes: gid102983,public From: spc@leroy.cc.uregina.ca (SaskPower) Subject: Re: undelete / unrm / file recover for linux? Date: 1995/11/18 Message-ID: <48l805$e4d@sue.cc.uregina.ca> X-Deja-AN: 119632702 references: <EKU.95Nov17105401@delphi.philosys.de> organization: University of Regina newsgroups: aus.computers.linux,comp.os.linux.development.apps,comp.os.linux.misc,comp.os.linux.development.system