Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Jun 2000 16:20:25 +0300
From:      Anatoly Vorobey <mellon@pobox.com>
To:        Charon <charon@sabotage.gr>
Cc:        chat@freebsd.org
Subject:   Re: Undelete in Unix (Was: Re: Why encourage stupid people to use *BSD)
Message-ID:  <20000605162025.A32447@happy.checkpoint.com>
In-Reply-To: <001501bfceee$34cb9a00$858c8c96@win2000.cc.ceid.upatras.gr>; from charon@sabotage.gr on Mon, Jun 05, 2000 at 04:01:46PM %2B0300
References:  <3939F26A.A405DD4A@mail.ptd.net> <LPBBJIAAFFNFMKJGNIAIIEBJCAAA.keramida@ceid.upatras.gr> <20000605081334.C25970@ecto.greenpeas.org> <001501bfceee$34cb9a00$858c8c96@win2000.cc.ceid.upatras.gr>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jun 05, 2000 at 04:01:46PM +0300, Charon wrote:
> 
> > Out of the ether, Giorgos Keramidas spewed forth the following bitstream:
> > > So, I'm also very interested to know how they had implemented
> > > such a feature.  Anybody with more knowledge on the topic?
> > 
> > alias rm 'mv $* ~/.dustbin'
> 
> Oh, I know. I know.
> I had thought of this, but then I thought of a setup where /usr is
> mounted from a different filesystem that the root filesystem, and
> this alias is executed by the superuser.

I suppose one way to do it would be to replace rm by the following scheme:

- every filesystem holds a .dustbin directory at the root of the
filesystem;
- the .dustbin directory includes symlinks of the kind 
.dustbin/originaldir-originalname --> .dustbin/43265

and hardlinks of .dustbin/43265 to the file with inode 43265.

- alias rm newrm
- newrm, before unlink'ing a file, backsteps the current directory until
it finds the mount point of the filesystem. It can do this by using statfs
for instance, and comparing fs id's in it. When it finds the mount point,
it goes into .dustbin in it and plants both the hardlink to the file
being deleted (if it's not yet there), and the symlink which preserves
the current name being deleted and directory.
- undelete dirname/filename finds the mount point of fs dirname is
supposed to reside in, goes into .dustbin, searches for the symlink,
retrieves the hardlink, and hardlinks the original name in the original
dir to it, and deletes the symlink. When there are no more dustbin
symlinks left pointing at this hardlink, it deletes the dustbin
hardlink.

This is just something which occurred to me as I read this thread today,
I never actually tried it.

-- 
Anatoly Vorobey,
mellon@pobox.com http://pobox.com/~mellon/
"Angels can fly because they take themselves lightly" - G.K.Chesterton


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-chat" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000605162025.A32447>