问题标签 [hardlink]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
261 浏览

shell - 将一个子目录中包含的文件创建到另一个子目录的硬链接

嘿伙计们,我正在使用 Ubuntu,我在使用 ln 命令查找文件时遇到问题

目前我有一个名为 myName.2 的文件夹,其中包含 3 个文件夹笔记、作业和网络。在笔记中我创建了 3 个名为 linux.txt、unix.txt 和 shell.txt 的文件,现在我已经重定向了自己,所以我在 web 文件夹中并想在此处创建指向这些文件的硬链接,例如我输入命令

但是终端告诉我,

我去了linux文本文件的属性并直接从那里复制并粘贴路径

任何提示将不胜感激谢谢!

0 投票
2 回答
5213 浏览

shell - 创建与目标文件同名的软链接

我想在目标 dir1 中创建一个软链接,文件名与 dir2 中的源文件名相同

0 投票
1 回答
2771 浏览

c++ - 如何确定驱动器是否支持 Windows XP 中的硬链接?

我找到了以下解决方案来确定驱动器是否支持硬链接:

但是,根据MSDNFILE_SUPPORTS_HARD_LINKS ,直到 Windows Server 2008 R2 和 Windows 7 才支持该标志。

我还考虑过使用CreateHardLink()它来尝试创建一个虚拟硬链接。如果创建了硬链接,那么我知道可以在相应的驱动器上创建硬链接。但是,我可能没有访问该驱动器的权限。在这种情况下,我假设这种方法会失败。

有谁知道如何确定驱动器是否支持 Windows XP 中的硬链接而不需要对该驱动器的写访问权限?

0 投票
1 回答
2724 浏览

ios - Is it possible to create hard links to files in an iOS application bundle?

In order to save on server side bandwidth costs associated with my iOS application, I've packaged a bunch of assets that would otherwise be downloadable at runtime into my iOS application bundle. In the context of the application as written, it would be ideal for me if I could access the files from one of the user writeable directories (e.g. [App Dir]/Library/Application Support/My Custom Subfolder/) without having to copy the files there directly at runtime (e.g. at startup, first run, whatever).

While I've been able to successfully create symbolic links in .../My Custom Subfolder/ to the files in the bundle using the NSFileManager API createSymbolicLinkAtURL:withDestinationURL:error:, some of the framework APIs I then use to access the content later on get goofed up and give me back attributes and data pertaining to the symbolic links instead of the underlying file. I could probably mitigate those issues by utilizing some other framework APIs but it might end up being a lot of work depending on the scope of the incorrect usages.

On the simulator I was able to successfully circumvent this issue by creating hard links to the bundle content using the NSFileManager API linkItemAtURL:toURL:error:. The hard links worked great for all the file access APIs utilized throughout the app and everything was peachy. On DEVICE however (tested on iPhone 5c running iOS 7.0.2 and iPad running iOS 7.1), I would receive an NSCocoaErrorDomain 513 error (Operation could not be completed. Operation not permitted.). I could create a test file in .../My Custom Subfolder/ and create a hard link to that in the same folder just fine, but if I try to hardlink to anything in the read-only application bundle, I get the 513 error.

Does anyone know if there's a way to get around the permissions error in order to accomplish what I'm trying to do?

0 投票
1 回答
773 浏览

azure - [kernel32.dll]CreateHardLink 在 RavenDb Embedded 备份期间在 Azure 网站上失败并显示“当该文件已存在时无法创建文件”

我在 Azure 网站内运行 RavenDb.Embedded v2.0.2370。

除了备份之外,所有这些都按预期工作。启动的备份例程EmbeddableDocumentStore.DocumentDatabase.StartBackup(...)曾经完美运行,直到我注意到最后一次成功的备份是在 1 月 30 日左右(不要问 :-)) UTC0 下午 6 点左右,而下一次备份是在 2 月 11 日左右启动的UTC0 上午 8 点失败,直到现在为止启动的所有其他失败。

因此,Azure 方面的这两个日期之间似乎必须进行某些更改,因为自 2013 年 5 月以来 Web 应用程序没有任何更改或部署

所以我做了一些调查,这是我的发现:

  • RavenDb 备份状态在每次启动备份后显示以下消息:

    无法完成备份,因为:当该文件已存在时无法创建该文件

  • 为RavenDb启用日志记录后,日志文件在运行备份时显示以下错误

    2014-04-12 10:38:20.5797,Raven.Storage.Esent.Backup.BackupOperation,错误,无法完成备份,“System.ComponentModel.Win32Exception (0x80004005):当该文件已存在于 Raven 时,无法创建该文件。 Raven.Storage.Esent.Backup.BackupOperation.Execute 的 Database.Backup.DirectoryBackup.Prepare()(忽略对象)

  • 根据Azure 网站论坛,在上次成功备份和第一次失败备份之间的这段时间里,没有计划对 Azure 网站进行维护。2013 年 12 月 9 日至 15 日和 2014 年 3 月 10 日至 14 日之间

  • 1 月 31 日,我在Azure 服务仪表板上注意到西欧地区的网站存在问题,但该网站托管在北欧地区

  • 查看(甚至是最后一个版本)有故障的RavenDb代码Raven.Database.Backup.DirectoryBackup.Prepare时,似乎在调用时抛出了异常,CreateHardLink这是一个定义为的外部方法

    奇怪的是,代码实际上检查了上面显示的特定异常(0x80004005),但仍然抛出异常......

    /li>
  • 因此,为了从等式中排除 RavenDb,我创建了以下小程序来模拟 RavenDb 在其备份例程期间以及在Azure Web 上部署可执行文件并执行它(通过新的 azure 门户上的控制台功能)之后实际执行的操作网站也失败了

    /li>
  • 为了从等式中排除我的特定 Web 应用程序,我创建了一个新的 Azure 网站并部署了上述相同的可执行文件,但它也失败了

  • 可以公平地假设它们尚未在 ReFS(不支持硬链接)上运行但仍在使用 NTFS?

tl;博士

  • Azure 网站上发生了什么变化,导致调用[kernel32.dll]CreateHardLink失败,而它以前可以工作?

  • 如何在 RavenDb 代码外部或 RavenDb 代码内部解决此问题...?

0 投票
1 回答
2284 浏览

ubuntu - 尝试运行 newaliases: newaliases: fatal: /etc/: 文件有 85 个硬链接

我刚刚更新了我的/etc/aliases文件,如下所示:

但是现在我在运行新别名时遇到错误:

现在后缀将无法启动:

0 投票
2 回答
584 浏览

cocoa - 如何确定两个路径是指向 Cocoa 中同一个文件的硬链接?

我需要在运行时为路径超过 255 个字符的文件创建硬链接(这是针对令人恼火的 Excel/Word 2011 限制的解决方法)。但是由于以后可能会再次打开同一个文件,如果我已经在第一次创建它的路径上拥有它,我不想重新创建硬链接(我有一个使用UUID)。这意味着我需要检查文件是否已经“缓存”,因为硬链接仍然确实是指向我为用户打开的文件的硬链接。所以我需要检查 2 个路径是否是指向同一个文件的硬链接。我意识到在测试时可能存在竞争条件,但硬链接完全由我的应用程序管理。

0 投票
2 回答
2361 浏览

c - 打印文件上的硬链接

我必须在 C 文件中写出所有硬链接。我不知道该怎么做。一种可能性是调用 bash 命令,但调用哪个命令?

给定:文件名'foo.txt'

查找:所有硬链接到 'foo.txt' 的文件

0 投票
1 回答
142 浏览

ssh - gerrit ssh登录问题

我在 ssh 登录 gerrit 时遇到问题。当我使用一个密钥文件时,它可以工作,但使用另一个则不能。

现在问题似乎很明显,一个密钥在服务器上,一个不在。但是,这两个密钥文件都是相同的。不仅仅是副本,还有硬链接,这意味着它们都指向磁盘上完全相同的块。

为什么这些非常相同的“两个”键会产生不同的结果?

0 投票
2 回答
1595 浏览

linux - 对服务器上的 Git 分叉进行重复数据删除

有没有办法硬链接包含多个 Git 存储库的文件夹中的所有重复对象?

解释:

我在我的公司服务器(Linux 机器)上托管了一个 Git 服务器。这个想法是有一个主要的规范存储库,每个用户都没有推送访问权限,但是每个用户都派生了规范存储库(将规范克隆到用户的主目录,从而实际上创建了硬链接)。

/canonical/Repo /Dev1/Repo(最初克隆时硬链接到 /canonical/Repo 的对象) /Dev2/Repo(最初克隆时硬链接到 /canonical/Repo 的对象)

这一切都很好。问题出现在:

Dev1:将一个巨大的提交推送到他在服务器上的 fork (/Dev1/Repo) Dev2:在他的本地系统上获取它,进行自己的更改并将其推送到他自己的服务器上的 fork (/Dev2/Repo)

(现在同一个“巨大”文件驻留在服务器上的两个开发人员的分支中。它不会自动创建硬链接。)

这疯狂地占用了我的服务器空间!

如何在两个分叉之间或规范的对象之间创建硬链接,以便节省服务器空间,并且每个开发人员在从他/她的本地计算机上的分叉克隆时获取所有数据?