Link back open deleted files - a working solution

2007-09-13 Thread Amos Shapira
Hi (and happy new year).

I've had this idea ever since someone asked about this situation on this
forum a few months ago:

Considering that you have a long running process writing stuff into a large
file, and you accidentally delete that file.
You can still access the file's content through /proc/pid/fd/fd and
that's basically the suggestion he was given (cp /proc... new file),
but the limitations of this solution are:

1. It will loose any changes made to the deleted file after the copy.
2. It creates another copy of the data (could be a problem if there isn't
enough space on any partition).

My solution (available in http://sourceforge.net/projects/fdlink) is to
enable the user to link back the deleted file to a new name on the same
filesystem as the deleted file.

The solution involves as small kernel module and a simple program which
calls ioctl(2) on the special device created by that module.

The idea is that if someone finds themselves in that situation they should
be able to install that module and use it without having to reboot the
system (and thus loosing the whole point of it).

I have a couple of enhancement that I'm waiting to find time to implement:

1. Update the symlink content under fd/fd to point to the new file name.
2. Implement this as a system call and offer this to be included in 2.6

The module was tested under Debian 2.6.18 and later on x86_64.

Any comments/suggestions/contributions are welcome.

Cheers,

--Amos


Re: Link back open deleted files - a working solution

2007-09-13 Thread Alon Altman
Can it link back a loopmounted filesystem?

On 9/13/07, Amos Shapira [EMAIL PROTECTED] wrote:
 Hi (and happy new year).

 I've had this idea ever since someone asked about this situation on this
 forum a few months ago:

 Considering that you have a long running process writing stuff into a large
 file, and you accidentally delete that file.
 You can still access the file's content through /proc/pid/fd/fd and
 that's basically the suggestion he was given (cp /proc... new file),
 but the limitations of this solution are:

 1. It will loose any changes made to the deleted file after the copy.
 2. It creates another copy of the data (could be a problem if there isn't
 enough space on any partition).

 My solution (available in
 http://sourceforge.net/projects/fdlink) is to enable the
 user to link back the deleted file to a new name on the same filesystem as
 the deleted file.

 The solution involves as small kernel module and a simple program which
 calls ioctl(2) on the special device created by that module.

 The idea is that if someone finds themselves in that situation they should
 be able to install that module and use it without having to reboot the
 system (and thus loosing the whole point of it).

 I have a couple of enhancement that I'm waiting to find time to implement:

 1. Update the symlink content under fd/fd to point to the new file name.
 2. Implement this as a system call and offer this to be included in 2.6

 The module was tested under Debian 2.6.18 and later on x86_64.

 Any comments/suggestions/contributions are welcome.

 Cheers,

 --Amos



=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word unsubscribe in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



Re: Link back open deleted files - a working solution

2007-09-13 Thread Amos Shapira
On 13/09/2007, Alon Altman [EMAIL PROTECTED] wrote:

 Can it link back a loopmounted filesystem?


I started testing then realized why you ask :), I now have a mounted image
which I can't get rid off, ah well.

a) If you can find a way to get a file descriptor to the mounted image then
it'll work as-is.
b) If you can find a way to point to the mounted image's dentry then I can
possibly tweak it to add a link to that dentry.

So far I couldn't find a way to achieve (a), I'm trying to look at (b) for a
few minutes now.

--Amos


Re: Link back open deleted files - a working solution

2007-09-13 Thread Constantine Shulyupin
Here is  similar solution:

http://sourceforge.net/projects/vfs-undelete/

--
Constantine

=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word unsubscribe in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



Re: Link back open deleted files - a working solution

2007-09-13 Thread guy keren

Constantine Shulyupin wrote:

Here is  similar solution:

http://sourceforge.net/projects/vfs-undelete/


this looks like a dead link
there's nothing to download yet, and when browsing via CVS, i only see 
empty directories, no files. am i missing something?


it looks as if there were files there in CVS in the past - but someone 
deleted all of them


--guy



--
Constantine

=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word unsubscribe in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]




=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word unsubscribe in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



Re: Link back open deleted files - a working solution

2007-09-13 Thread Amos Shapira
On 13/09/2007, guy keren [EMAIL PROTECTED] wrote:

 Constantine Shulyupin wrote:
  Here is  similar solution:
 
  http://sourceforge.net/projects/vfs-undelete/


Yes indeed, it looks like its purpose is identical to fdlink's, though they
have much more code around the plain ioctl I provide, maybe because they
started with 2.4 and moved to 2.6 (according to the comit logs on the kernel
mode file).

In case it's not clear - my code works and ready for used by anyone, just do
a make; insmod flink_dev.ko and you area ready to use the provided
flinkapp, I don't know about theirs.

this looks like a dead link
 there's nothing to download yet, and when browsing via CVS, i only see
 empty directories, no files. am i missing something?

 it looks as if there were files there in CVS in the past - but someone
 deleted all of them


You can click on the dead files link to see the deleted files.

--Amos


Re: Link back open deleted files - a working solution

2007-09-13 Thread Constantine Shulyupin
I'll talk with author of the utility

On 9/14/07, guy keren [EMAIL PROTECTED] wrote:
 Amos Shapira wrote:
  On 13/09/2007, *guy keren* [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED] wrote:
 
  Constantine Shulyupin wrote:
Here is  similar solution:
   
http://sourceforge.net/projects/vfs-undelete/
 
 
  Yes indeed, it looks like its purpose is identical to fdlink's, though
  they have much more code around the plain ioctl I provide, maybe
  because they started with 2.4 and moved to 2.6 (according to the comit
  logs on the kernel mode file).
 
  In case it's not clear - my code works and ready for used by anyone,
  just do a make; insmod flink_dev.ko and you area ready to use the
  provided flinkapp, I don't know about theirs.
 
  this looks like a dead link
  there's nothing to download yet, and when browsing via CVS, i only see
  empty directories, no files. am i missing something?
 
  it looks as if there were files there in CVS in the past - but someone
  deleted all of them
 
 
  You can click on the dead files link to see the deleted files.

 i did, at least on one of the kernel source files. it came out empty...

 --guy

 =
 To unsubscribe, send mail to [EMAIL PROTECTED] with
 the word unsubscribe in the message body, e.g., run the command
 echo unsubscribe | mail [EMAIL PROTECTED]




-- 
Constantine Shulyupin
Freelance Embedded Linux Engineer
054-4234440
http://www.linuxdriver.co.il/

=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word unsubscribe in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



Re: Link back open deleted files - a working solution

2007-09-13 Thread guy keren

Amos Shapira wrote:
On 13/09/2007, *guy keren* [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] wrote:


Constantine Shulyupin wrote:
  Here is  similar solution:
 
  http://sourceforge.net/projects/vfs-undelete/


Yes indeed, it looks like its purpose is identical to fdlink's, though 
they have much more code around the plain ioctl I provide, maybe 
because they started with 2.4 and moved to 2.6 (according to the comit 
logs on the kernel mode file).


In case it's not clear - my code works and ready for used by anyone, 
just do a make; insmod flink_dev.ko and you area ready to use the 
provided flinkapp, I don't know about theirs.


this looks like a dead link
there's nothing to download yet, and when browsing via CVS, i only see
empty directories, no files. am i missing something?

it looks as if there were files there in CVS in the past - but someone
deleted all of them


You can click on the dead files link to see the deleted files.


i did, at least on one of the kernel source files. it came out empty...

--guy

=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word unsubscribe in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]