HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Edit a file without changing the inode number
Operating System - Linux
1829608
Members
1384
Online
109992
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2007 05:32 PM
03-19-2007 05:32 PM
When u edit a file in unix the inode number changes.
Is there any way to edit a file without changing the inode number???
Is there any way to edit a file without changing the inode number???
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2007 06:05 PM
03-19-2007 06:05 PM
Solution
Hrm, weird. Never knew that one..
Quick (hack) fix: Make a hard-link to it ('ln '). As the inode reference count will be > 1, it won't destroy the file, and re-create it, it'll use the in-place inode (as it's referenced).
That being said, I guess it depends on the editor you use, or what you're trying to do with the file.
What editor do you use? (I tested with 'vim').
Quick (hack) fix: Make a hard-link to it ('ln
That being said, I guess it depends on the editor you use, or what you're trying to do with the file.
What editor do you use? (I tested with 'vim').
One long-haired git at your service...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2007 08:46 PM
03-19-2007 08:46 PM
Re: Edit a file without changing the inode number
Thanks stuart... It works...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2007 01:56 AM
03-20-2007 01:56 AM
Re: Edit a file without changing the inode number
I think it would depend a bunch on the exact implementation of the editor chosen, and some 'luck' as well.
What Linux? What version? What Editor?
For details on what the editor exactly does use 'strace editor small-file' and study the lines after the exit commands. (Watch in horror all the 'stuff' that is being done before you get control of thr screen! :-)
Here, on my dinky 'thin client' with a Linux 2.4.25 theeditor of choice is vi and is implemented in busybox. The output file is created as:
open("xy", O_WRONLY|O_CREAT|O_TRUNC, 0664) = 3
write(3, "....
So if anything goes wrong, the data is destroyed already.
I could imagine other editors, perhaps doing a create on a new output file first, using a unique temp name, and then when this is succesfully write rename it to the real output, blowing away the original implicitly or explicitly with unlink.
Hope this helps,
Hein van den Heuvel
What Linux? What version? What Editor?
For details on what the editor exactly does use 'strace editor small-file' and study the lines after the exit commands. (Watch in horror all the 'stuff' that is being done before you get control of thr screen! :-)
Here, on my dinky 'thin client' with a Linux 2.4.25 theeditor of choice is vi and is implemented in busybox. The output file is created as:
open("xy", O_WRONLY|O_CREAT|O_TRUNC, 0664) = 3
write(3, "....
So if anything goes wrong, the data is destroyed already.
I could imagine other editors, perhaps doing a create on a new output file first, using a unique temp name, and then when this is succesfully write rename it to the real output, blowing away the original implicitly or explicitly with unlink.
Hope this helps,
Hein van den Heuvel
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP