FAT32 格式存储上的文件系统链接

发布于 2024-10-09 02:20:57 字数 312 浏览 4 评论 0原文

我知道 FAT32 以及 FAT16/12 既不支持符号链接,也不支持硬链接。然而我想到了这个想法:

FAT 规范描述了每个文件都与一个目录条目相关联。根据我的理解,可以说目录中的文件条目以某种方式或其他指向文件的内容。

那么,如何定义两个指向相同文件内容的目录条目?或者,什么可以阻止我这样做?

用例:我的汽车收音机有一个 USB 大容量存储设备,我想使用目录作为播放列表,因为收音机软件不支持播放列表。因此,Windows 在执行此操作时的行为方式对我来说并不重要。

I know FAT32, as well as FAT16/12 neither support symbolic links nor hard-links. However I came up with this idea:

The FAT specification describes that every file is associated with a directory-entry. In my understanding, one could say that a file-entry in a directory somehow or other points to the file's content.

So, how can I define two directory-entries which point to the same file-content? Or, what could prevent me from doing so?

Use case: I have a USB mass storage device for my car radio, and I want to use directories as playlists since the radio software doesn't support playlists. So it isn't important to me how Windows behaves when doing this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

梦归所梦 2024-10-16 02:20:57

您所说的(“两个指向相同文件内容的目录条目”)是硬链接。 chkdsk 会将它们报告为交叉链接并破坏它们,“修复”文件(实际上是制作副本)。

What you are talking about ("two directory-entries which are pointing to the same file-content") are hard links. chkdsk will report them as cross-links and break them, "repairing" the files (in fact making the copies).

凉宸 2024-10-16 02:20:57

这应该适用于简单的问题。即它作为一种黑客/解决方法,我不知道如果您重命名/移动/删除文件会发生什么。因此,您不应该在主硬盘上执行此操作。

我使用十六进制编辑器手动编辑目录条目。我修改了集群和文件大小并成功伪造了硬链接。我的汽车收音机甚至 Windows(7、64 位)在播放我使用的原始文件和“硬链接”mp3 文件时都没有问题。

当我在十六进制编辑器中再次打开设备时,我的任何修改都不会更改回来(请参阅答案#1中的 chkdsk 问题 - 但据我所知,无论如何,chkdsk 必须手动启动。

This should work for simple issues. I.e. it works as a hack / workaround and I don't know what happens if you rename / move / remove files. So, you should not do this on your main hdd.

I edited the directory-entries manually using a hex editor. I modified clusters as well as file-sizes and successfully faked hardlinks. My car-radio and even Windows (7, 64Bit) have no problems with playing back the original and "hard-linked" mp3-Files I used.

When I'm opening the device again in the hex-editor none of my modifications are changed back (See chkdsk issue in answer #1 - but as far as I know chkdsk has to be started manually, anyways.

梦境 2024-10-16 02:20:57

MichaelPh 在 SuperUser 上发布了说明:

https://superuser.com/a/486829/51237

可以使用Disk Probe(仅在XP上,我还没有让它在Win7上写入更改)来修改FAT目录引用的集群。此方法可用于重定向 DCIM 文件夹(或子文件夹)以指向不同扫描设备使用的文件夹。

这是否是一个好主意是另一回事,您需要自行承担使用它的风险。

  1. 将 Eye-Fi 卡插入 USB 读卡器或直接插入 SSD 插槽,并记下其安装的驱动器盘符(为简单起见,假设为 F:\)
  2. 确保该卡和子目录的所有 Windows 资源管理器窗口均已关闭。
  3. 运行磁盘探测
  4. 选择驱动器 -> 逻辑卷
  5. 在“打开逻辑卷”对话框中,双击逻辑卷列表中的 F:\
  6. 单击已选择的句柄 F: 的“设置活动”按钮。您现在可以将该句柄保留为只读。
  7. 选择工具 -> 搜索部门...
  8. 选中详尽搜索,在“输入要搜索的字符”和“搜索”中输入 DCIM
  9. 您应该找到一个匹配项(我的是 8192)。在“找到匹配项...”对话框中选择“否”以取消其余搜索。
  10. 选择“扇区”->“读取扇区数”并将“扇区数”增加到至少两个,以便包含整个目录表。
  11. 在“Disk Probe”屏幕右侧的 ASCII 中找到 DCIM,这是该目录的 FAT 条目的开头。记下记录第 27 个字节的十六进制值(每个条目为 32 字节),这是目录簇引用。如果需要,需要此值才能将 DCIM 目录恢复正常使用。
  12. 找到要将 DCIM 重定向到的目录条目,并再次记下记录中的第 27 个字节。
  13. 返回到 DCIM 记录的第 27 个字节,并将其更改为第 11 步中记下的值。
  14. 选择“Sectors”->“Write”,然后在“Write Sector”对话框中单击“Write it”。如果您以只读方式打开扇区,则会出现警告。如果您愿意进行更改,请覆盖。

在 Windows 资源管理器中打开 DCIM 目录现在将显示目标目录的内容。

MichaelPh posted instructions on SuperUser:

https://superuser.com/a/486829/51237

It's possible to use Disk Probe (on XP only, I've yet to get it to write the changes on Win7) to modify the cluster a FAT Directory references. This method can be used to redirect the DCIM folder (or a subfolder) to point to the folder used by a different scan device.

Whether this is a good idea or not is a different matter and you use this at your own risk.

  1. Insert the Eye-Fi card either in it's USB Card Reader or directly into an SSD slot and note the drive letter it's installed as (assumed to be F:\ for simplicity)
  2. Ensure all Windows Explorer windows for the card and sub-directories are closed.
  3. Run Disk Probe
  4. Select Drives->Logical Volume
  5. In the Open Logical Volume dialog double-click F:\ in the Logical Volumes list
  6. Click the Set Active button for the Handle F: has been selected as. You can leave the handle as read-only for now.
  7. Select Tools->Search Sectors...
  8. Check Exhaustive Search, enter DCIM in Enter characters to search for and Search
  9. You should find a match (mine is at 8192). Select No on the "Found match..." dialog to cancel the rest of the search.
  10. Select Sectors->Read and increase Number of Sectors to at least two so that the whole directory table is included.
  11. Find DCIM in the ASCII on the right of the Disk Probe screen, this is the start of the FAT entry for the directory. Make a note of the hex value of the 27th byte of the record (each entry is 32bytes), this is the directory cluster reference. This value is require to revert the DCIM directory back to normal use if required.
  12. Find the entry for the directory you want to redirect DCIM to and again make a note of the 27th byte in the record.
  13. Go back to the 27th byte of the DCIM record and change it to the value noted in step 11.
  14. Select Sectors->Write and then click Write it on the Write Sector dialog. A warning will come up if you opened the sectors as read-only. Yes to overwrite if you're happy to make the change.

Opening the DCIM directory in Windows Explorer will now show the contents of the target directory.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文