diff options
author | Julien Dessaux | 2021-03-12 18:12:41 +0100 |
---|---|---|
committer | Julien Dessaux | 2021-03-12 18:13:45 +0100 |
commit | ed8e2b9e9ed67097d4fdc7913df1c6cd2d96d3f7 (patch) | |
tree | cd93f66cd66f8ca6efe91882d8a46ca6b09bdc72 /content/blog/miscellaneous/link-deleted-inode.md | |
parent | Improved home speech (diff) | |
download | www-ed8e2b9e9ed67097d4fdc7913df1c6cd2d96d3f7.tar.gz www-ed8e2b9e9ed67097d4fdc7913df1c6cd2d96d3f7.tar.bz2 www-ed8e2b9e9ed67097d4fdc7913df1c6cd2d96d3f7.zip |
Some more articles reformatting
Diffstat (limited to '')
-rw-r--r-- | content/blog/miscellaneous/link-deleted-inode.md | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/content/blog/miscellaneous/link-deleted-inode.md b/content/blog/miscellaneous/link-deleted-inode.md index 45f0417..1cba1af 100644 --- a/content/blog/miscellaneous/link-deleted-inode.md +++ b/content/blog/miscellaneous/link-deleted-inode.md @@ -1,10 +1,21 @@ --- title: "Link to a deleted inode" -linkTitle: "Link to a deleted inode" date: 2018-03-05 -description: > - Link to a deleted inode +description: How to restore a hardlink to a deleted inode +tags: + - unix --- -Get the inode number from `lsof`, then run `debugfs -w /dev/mapper/vg-home -R 'link <16008> /some/path'` where 16008 is the inode number (the < > are important, they tell debugfs you manipulate an inode). The path is relative to the root of the block device you are restoring onto. +## The problem +Sometimes a file gets deleted by mistake, but thankfully it is still opened by some software. + +## The solution + +Get the inode number from `lsof` (or from `fstat` if you are on a modern system), then run something like the following : + +{{< highlight sh >}} +debugfs -w /dev/mapper/vg-home -R 'link <16008> /some/path' +{{< /highlight >}} + +In this example 16008 is the inode number you want to link to (the < > are important, they tell debugfs you are manipulating an inode). Beware that **the path is relative to the root of the block device** you are restoring onto. |