Can I create a link to an inode?

Jose Celestino japc at co.sapo.pt
Fri Aug 15 23:13:05 UTC 2008


Words by Doug Wyatt [Fri, Aug 15, 2008 at 01:42:27PM -0500]:
>
> Jose Celestino wrote:
>> *This message was transferred with a trial version of CommuniGate(r) Pro*
>> Words by Doug Wyatt [Fri, Aug 15, 2008 at 05:47:55AM -0500]:
>>>
>>
>> There's a much easier way. Well, you don't really relink the inode but
>> copy the original file instead:
>>
>> 1. locate the open (deleted) file you want from the opening pid on /proc/$PID/fd/*
>> 2. cp /proc/$PID/fd/$FD somewhere
>>
>
> I think I read, somewhere, that in doing that I could end up
> with garbage bytes at the end of the last block in the copy,
> and would need to use the size from the original inode to
> trim the copied file.  Don't know if that's fact or not.
>

No. That's not true. Where have you read that?

> Also, by re-linking you preserve the mtime w/o hassling with
> touch.
>

Ok, that can be an advantage ...

> Re-linking the inode seems more elegant and satisfying after
> performing a klutzy move like deleting the wrong file.
>

... but relinking the file can be potentially dangerous (debugfs is) and
it is not guaranteed to work on all filesystems.

-- 
Jose Celestino | http://japc.uncovering.org/files/japc-pgpkey.asc
----------------------------------------------------------------
"One man’s theology is another man’s belly laugh." -- Robert A. Heinlein




More information about the users mailing list