Recreating a deleted hardlink to a file if I know the inode number
At risk of twisting the rules to nearly the point of breaking (if you think this goes too far mods, I apologise and accept that this should be deleted), I'm hoping someone might be able to cast a little light on the following problem regarding hard links to files.
I'm trying to relink a file someone tried to delete while a process (that we don't want to shutdown) also had a filehandle open to it.
Consequently, we've got an inode entry but no directory entry (aka 'file') for it.
I've tracked the inode number down via lsof, as well as the particular filehandle the process has within the /proc filesystem.
This filehandle is presented as a standard "file"/directory entry in /proc/<pid>/fd and I can read from it ok as I would any other file.
I was hoping to create a link to it back where it used to be but I keep getting a 'No such file or directory' error. I know I've got my ln syntax correct as I've tested it out on plain files elsewhere.
Is ln the tool to use here? Surely if I know the inode number, filehandle and what it used to be called, I can recreate it?
as kernel keeps track of user activities on a file by its INODE number and I node table .
what is the structure of Inode table. and where does this Inode table mapped into?user space or kernel space?
is the Inode Number is fixed for a file till its deletion?
thanks (1 Reply)
I'm trying to relink a file someone tried to delete while a process (that we don't want to shutdown) also had a filehandle open to it.
Consequently, we've got an inode entry but no directory entry (aka 'file') for it.
I've tracked the inode number down via lsof, as well as the particular... (0 Replies)
How we can know number of inode present in my Disk including free and occupied.
Is there any tool or program to know how much free inode are there in inode free list . (2 Replies)
How to get the filename of which has been deleted if I know the inode number.
i can use the command "istat" to get the inode number of the file.
# istat
/proc//fd/x
If this file has been deleted,but the process of this file has not been closed and handle has not been released ,so this... (3 Replies)
Hi all,
I am struggling to change the content of a file without changing the inode number. The exact issue is as below.
I have a file name test.bak which has 100 lines of text.
I am trying to to delete the first 90 lines of the text in the file.
I know that using sed/awk/head/tail I can... (3 Replies)
Hi,
I have created a file abc.log in Redhat Linux.
Inode number for a file get changes every time i update the file using vi editor.
Is there any setting that can be made , such that inode number never gets changed?
Or if we cannot restrict from inode number getting changed , is... (9 Replies)
Hi,
I have created a file a.txt in Redhat Linux.
Inode number for a file changes every time i update the file using vi editor , gedit etc.
Is there any setting that can be made , such that inode number never changes as that is supposed to be the expected behavior?
Or if we cannot... (13 Replies)
Discussion started by: srirammanohar
13 Replies
LEARN ABOUT HPUX
clri
clri(1M)clri(1M)NAME
clri - clear inode
SYNOPSIS
special i-number ...
DESCRIPTION
The command clears the inode i-number by filling it with zeros. special must be a special file name referring to a device containing a
file system. For proper results, special should not be mounted (see WARNINGS below). After is executed, all blocks in the affected file
show up as "missing" in an of special (see fsck(1M)). This command should only be used in emergencies.
Read and write permission is required on the specified special device. The inode becomes allocatable.
WARNINGS
The primary purpose of this command is to remove a file that for some reason does not appear in any directory. If it is used to clear an
inode that does appear in a directory, care should be taken to locate the entry and remove it. Otherwise, when the inode is reallocated to
some new file, the old entry in the directory will still point to that file. At that point, removing the old entry destroys the new file,
causing the new entry to point to an unallocated inode, so the whole cycle is likely to be repeated again.
If the file system is mounted, is likely to be ineffective.
DEPENDENCIES
operates only on file systems of type
SEE ALSO fsck(1M), fsdb(1M), ncheck(1M).
STANDARDS CONFORMANCE
clri: SVID2, SVID3
clri(1M)