如何修复 HFS+ 扩展属性文件?

如何修复 HFS+ 扩展属性文件?

有没有工具能够修复/重建扩展属性文件?

目前,我尝试fsck_hfs使用 Mac OS X 10.6.3 Retail DVD、fsck.hfsplusGParted 0.5.2 livecd 和 Paragon Partition Manager 11。但均未成功。

本手册页指出fsck_hfs-R选项可以指定需要重建哪些 B 树,但我没有找到任何fsck_hfs二进制文件可以接受此选项。

现在,我有一个带有损坏的 HFS+ 的 HDD 通过网络(通过 FreeBSD 的 GEOM 门)连接到 VirtualBox 中的 VM,因为我目前没有 SATA-USB 适配器。

答案1

指定选项为

-Re

如果您不带任何选项执行 fsck_hfs 命令,则“用法”下显示的选项列表可能少于真正可接受的选项。我相信这是一个文档错误。

更新 — 2011-07-30

如果 Mac OS X 10.6.3 中的 fsck_hfs 无法识别 -R 选项,则假定它是在 10.6.x 的更高版本中引入的 - 对于开篇文章中引用的手册页,在 10.5 和 10.6.6 之间没有任何内容。

Apple Store(英国)的 Snow Leopard 版本仍为 10.6.3因此,如果您需要具有功能更强大的 fsck_hfs 版本的可启动媒体,我建议您使用以下任一项:

作为参考,以下是 10.7 (Build 11A511) 的记录:

[macbookpro08-centrim:~] gjp22% date
Sat 30 Jul 2011 08:25:39 BST
[macbookpro08-centrim:~] gjp22% uname -a
Darwin macbookpro08-centrim.home 11.0.0 Darwin Kernel Version 11.0.0: Sat Jun 18 12:56:35 PDT 2011; root:xnu-1699.22.73~1/RELEASE_X86_64 x86_64
[macbookpro08-centrim:~] gjp22% diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *320.1 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:          Apple_CoreStorage                         318.1 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
   4:              Apple_Journal                         536.9 MB   disk0s4
   5:                  Apple_HFS scratchy                536.9 MB   disk0s5
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                  Apple_HFS speedy                 *317.8 GB   disk1
[macbookpro08-centrim:~] gjp22% sudo /sbin/fsck_hfs -R
/sbin/fsck_hfs: option requires an argument -- R
usage: fsck_hfs [-b [size] B [path] c [size] Edfglx m [mode] npqruy] special-device
  b size = size of physical blocks (in bytes) for -B option
  B path = file containing physical block numbers to map to paths
  c size = cache size (ex. 512m, 1g)
  E = exit on first major error
  d = output debugging info
  f = force fsck even if clean (preen only) 
  g = GUI output mode
  x = XML output mode
  l = live fsck (lock down and test-only)
  m arg = octal mode used when creating lost+found directory 
  n = assume a no response 
  p = just fix normal inconsistencies 
  q = quick check returns clean, dirty, or failure 
  r = rebuild catalog btree 
  u = usage 
  y = assume a yes response 
[macbookpro08-centrim:~] gjp22% sudo diskutil unmount /Volumes/scratchy
Volume scratchy on disk0s5 unmounted
[macbookpro08-centrim:~] gjp22% sudo /sbin/fsck_hfs -Re /dev/disk0s5
** /dev/rdisk0s5
   Executing fsck_hfs (version diskdev_cmds-540.1~34).
** Checking Journaled HFS Plus volume.
   The volume name is scratchy
** Checking extents overflow file.
** Checking catalog file.
** Rebuilding extents overflow B-tree.
** Rechecking volume.
** Checking Journaled HFS Plus volume.
   The volume name is scratchy
** Checking extents overflow file.
** Checking catalog file.
** Checking multi-linked files.
** Checking catalog hierarchy.
** Checking extended attributes file.
** Checking volume bitmap.
** Checking volume information.
   Invalid volume file count
   (It should be 336 instead of 226)
   Invalid volume directory count
   (It should be 37 instead of 52)
   Invalid volume free block count
   (It should be 124541 instead of 125082)
   Volume header needs minor repair
(2, 0)
** Repairing volume.
** Rechecking volume.
** Checking Journaled HFS Plus volume.
   The volume name is scratchy
** Checking extents overflow file.
** Checking catalog file.
** Checking multi-linked files.
** Checking catalog hierarchy.
** Checking extended attributes file.
** Checking volume bitmap.
** Checking volume information.
** The volume scratchy was repaired successfully.
[macbookpro08-centrim:~] gjp22% sudo /sbin/fsck_hfs -fn /dev/disk0s5
** /dev/rdisk0s5 (NO WRITE)
   Executing fsck_hfs (version diskdev_cmds-540.1~34).
** Checking Journaled HFS Plus volume.
   The volume name is scratchy
** Checking extents overflow file.
** Checking catalog file.
** Checking multi-linked files.
** Checking catalog hierarchy.
** Checking extended attributes file.
** Checking volume bitmap.
** Checking volume information.
** The volume scratchy appears to be OK.
[macbookpro08-centrim:~] gjp22% 

相关内容