Creating a hardlink to a file


 
Thread Tools Search this Thread
Operating Systems Solaris Creating a hardlink to a file
# 1  
Old 07-28-2008
Question Creating a hardlink to a file

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.
Code:
ln /proc/<pid>/fd/<handle> /path/to/application/logs/access

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?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

creating separate output file for each input file in python

Experts, Need your help for this. Please support My motive is to create seperate output file for each Input Files(File 1 and File2) in another folder say(/tmp/finaloutput) Input files File 1(1.1.1.1.csv) a,b,c 43,17104773,3 45,17104234,4 File 2(2.2.2.2.csv) a,b,c 43,17104773,1... (2 Replies)
Discussion started by: as7951
2 Replies

2. Debian

Hardlink on wheezy by default for usb-stick?

May somebody can give me a hint. I am still using my old squeeze and it works the way I want. But my recent post about changing the owners rights, e.g. 777 or 755 anyway, it could be 644 as well. While configuring a new pc, just by chance I discovered how to enter the BIOS. And here it comes. I... (11 Replies)
Discussion started by: 1in10
11 Replies

3. Shell Programming and Scripting

Changing inode value of a hardlink

is it possible to change the inode value/ file path of a hard link? (2 Replies)
Discussion started by: fhill2
2 Replies

4. Shell Programming and Scripting

Creating a larger .xml file from a template(sample file)

Dear All, I have a template xml file like below. ....Some---Header....... <SignalPreference> ... <SignalName>STRING</SignalName> ... </SignalPreference> ......Some formatting text....... <SignalPreference> ......... ... (3 Replies)
Discussion started by: ks_reddy
3 Replies

5. Shell Programming and Scripting

KSH - help needed for creating a script to generate xml file from text file

Dear Members, I have a table in Oracle DB and one of its column name is INFO which has data in text format which we need to fetch in a script and create an xml file of a new table from the input. The contents of a single cell of INFO column is like: Area:app - aam Clean Up Criteria:... (0 Replies)
Discussion started by: Yoodit
0 Replies

6. Shell Programming and Scripting

Help with creating a text file in perl with file creation date.

Hi, I am quite new to Perl scripting and i need to create a .TXT file using perl, with fields (A,B,C,D,E), and this text file should be named with current file creation date "XYZ_CCYYMMDD.TXT" (i.e.XYZ_2011042514:33 PM). Can anyone who has done this, please share their expertise on this... (5 Replies)
Discussion started by: msrahman
5 Replies

7. UNIX for Dummies Questions & Answers

How to identify a link whether it is a Hardlink or Softlink

i am new to UNIX environment please tell me how to identify a link whether it is a Hardlink or Softlink ? what is the command? thank you all .......:o:o (2 Replies)
Discussion started by: sasith90
2 Replies

8. UNIX for Dummies Questions & Answers

creating separate directories according to file extension and keeping file in different directory as

unix program to which a directory name will be passed as parameter. This directory will contain files with various extensions. This script will create directories with the names of the extention of the files and then put the files in the corresponding folder. All files which do not have any... (2 Replies)
Discussion started by: Deekay.p
2 Replies

9. Filesystems, Disks and Memory

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. ... (6 Replies)
Discussion started by: Smiling Dragon
6 Replies

10. AIX

remove hardlink directory

I have to move a lpar from one 671 to another (aix 5.2 ML 07) when I run mksysb, It alway hangs with "archieving file list" I've tried to exlude every directory, but still not working the only thing that can be a problem, is a hardlink directory normally it should not be possible to... (4 Replies)
Discussion started by: funksen
4 Replies
Login or Register to Ask a Question
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)