Re: Can I create a link to an inode?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2008-08-15 at 13:42 -0500, Doug Wyatt wrote:
> > 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.

I can't imagine why that would be true. A file is a file is a file.

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

True.

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

Again true, but definitely more dodgy, and likely to depend a lot on the
specific filesystem type. The "cp" trick should work everywhere
(everywhere that supports the /proc system of course).

poc

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux