inode番号から対象のファイルを探す(warning: inode (id 9999999): Resource Fork xattr is missing or empty for compressed file)(error: doc-id tree: record exists for doc-id xxxxx, file-id 9999999 but no inode references this doc-id)
How to identify the file responsible for a disk error
を参考に作成しました
warning: inode (id 999999999): Resource Fork xattr is missing or empty for compressed file
error: doc-id tree: record exists for doc-id xxxxx, file-id 999999999 but no inode references this doc-id
このようなメッセージが出た場合に対象のファイルを探します
すでに、問題のあるファイルのinode番号になるので
結果、検索できない場合もあります
結果が出る場合はさほど問題ない
inodeのファイルのパスが参照出来ないのは、ちょっと問題が大きいが
今すぐフォーマットして…といった緊急性のある不具合でもない
スクリプトにinode番号をペーストしてください
コマンドライン形式でボリュームIDを付与して戻します
ターミナルにペーストしてどのファイルが対象なのか?がわかります
AppleScript サンプルコード
行番号 | ソース |
---|---|
001 | #!/usr/bin/env osascript |
002 | ----+----1----+----2----+-----3----+----4----+----5----+----6----+----7 |
003 | #こちらの記事を参考にしました |
004 | # https://eclecticlight.co/2023/08/28/how-to-identify-the-file-responsible-for-a-disk-error/ |
005 | # |
006 | #com.cocolog-nifty.quicktimer.icefloe |
007 | ----+----1----+----2----+-----3----+----4----+----5----+----6----+----7 |
008 | use AppleScript version "2.8" |
009 | use framework "Foundation" |
010 | use framework "UniformTypeIdentifiers" |
011 | use framework "AppKit" |
012 | use scripting additions |
013 | property refMe : a reference to current application |
014 | property refNSNotFound : a reference to 9.22337203685477E+18 + 5807 |
015 | |
016 | set appFileManager to refMe's NSFileManager's defaultManager() |
017 | |
018 | ######################## |
019 | ## クリップボードの中身取り出し |
020 | ######################## |
021 | ###初期化 |
022 | set appPasteboard to refMe's NSPasteboard's generalPasteboard() |
023 | ##格納されているタイプをリストにして |
024 | set ocidPastBoardTypeArray to appPasteboard's types |
025 | ###テキストがあれば |
026 | set boolContain to ocidPastBoardTypeArray's containsObject:("public.utf8-plain-text") |
027 | if (boolContain as boolean) is true then |
028 | ###値を格納する |
029 | tell application "Finder" |
030 | set strReadString to (the clipboard as text) as text |
031 | end tell |
032 | else |
033 | ###UTF8が無いなら |
034 | ##テキスト形式があるか?確認して |
035 | set boolContain to ocidPastBoardTypeArray's containsObject:(refMe's NSPasteboardTypeString) |
036 | ##テキスト形式があるなら |
037 | if (boolContain as boolean) is true then |
038 | set ocidTypeClassArray to refMe's NSMutableArray's alloc()'s initWithCapacity:(0) |
039 | ocidTypeClassArray's addObject:(refMe's NSString) |
040 | set ocidReadString to appPasteboard's readObjectsForClasses:(ocidTypeClassArray) options:(missing value) |
041 | set strReadString to ocidReadString as text |
042 | else |
043 | log "テキストなし" |
044 | set strReadString to strMes as text |
045 | end if |
046 | end if |
047 | ################# |
048 | #ダイアログ |
049 | tell current application |
050 | set strName to name as text |
051 | end tell |
052 | if strName is "osascript" then |
053 | tell application "Finder" to activate |
054 | else |
055 | tell current application to activate |
056 | end if |
057 | set aliasIconPath to (POSIX file "/System/Library/CoreServices/Finder.app/Contents/Resources/Finder.icns") as alias |
058 | try |
059 | set recordResult to (display dialog "inode番号を入れてください\nwarning: inode (id 99999999)の99999999" with title "入力してください" default answer strReadString buttons {"キャンセル", "実行"} default button "実行" cancel button "キャンセル" giving up after 20 with icon aliasIconPath without hidden answer) as record |
060 | on error |
061 | return "キャンセルしました" |
062 | end try |
063 | if (gave up of recordResult) is true then |
064 | return "時間切れです" |
065 | end if |
066 | if button returned of recordResult is "実行" then |
067 | set strReturnedText to (text returned of recordResult) as text |
068 | end if |
069 | ######## |
070 | #戻り値整形 |
071 | set ocidResponseText to (refMe's NSString's stringWithString:(strReturnedText)) |
072 | ###タブと改行を除去しておく |
073 | set ocidTextM to refMe's NSMutableString's alloc()'s initWithCapacity:(0) |
074 | ocidTextM's appendString:(ocidResponseText) |
075 | ###除去する文字列リスト |
076 | set listRemoveChar to {"\n", "\r", "\t", "¥", "¥", "cm", "CM", ",", "\\s"} as list |
077 | ##置換 |
078 | repeat with itemChar in listRemoveChar |
079 | set strPattern to itemChar as text |
080 | set strTemplate to ("") as text |
081 | set ocidOption to (refMe's NSRegularExpressionCaseInsensitive) |
082 | set listResponse to (refMe's NSRegularExpression's regularExpressionWithPattern:(strPattern) options:(ocidOption) |error| :(reference)) |
083 | if (item 2 of listResponse) ≠ (missing value) then |
084 | log (item 2 of listResponse)'s localizedDescription() as text |
085 | return "正規表現パターンに誤りがあります" |
086 | else |
087 | set ocidRegex to (item 1 of listResponse) |
088 | end if |
089 | set numLength to ocidResponseText's |length|() |
090 | set ocidRange to refMe's NSRange's NSMakeRange(0, numLength) |
091 | set ocidResponseText to (ocidRegex's stringByReplacingMatchesInString:(ocidResponseText) options:0 range:(ocidRange) withTemplate:(strTemplate)) |
092 | end repeat |
093 | ###数字以外があれば中止する |
094 | set ocidDemSet to refMe's NSCharacterSet's characterSetWithCharactersInString:("0123456789.") |
095 | ##数字以外って意味で逆セット |
096 | set ocidCharSet to ocidDemSet's invertedSet() |
097 | set ocidOption to (refMe's NSLiteralSearch) |
098 | ##数字以外の文字を探して |
099 | set ocidRange to ocidResponseText's rangeOfCharacterFromSet:(ocidCharSet) options:(ocidOption) |
100 | set ocidLocation to ocidRange's location |
101 | ##なければOK |
102 | if ocidLocation = refNSNotFound then |
103 | log "処理開始" |
104 | else if ocidLocation ≥ 0 then |
105 | tell application "Finder" |
106 | set aliasPathToMe to (path to me) as alias |
107 | end tell |
108 | log "数値以外の値があったのでやりなし" |
109 | return run script aliasPathToMe |
110 | end if |
111 | ##### |
112 | set listVolumeName to {"Hardware", "iSCPreboot", "Preboot", "Update", "VM", "xarts", "Data"} as list |
113 | |
114 | # |
115 | set appFileManager to refMe's NSFileManager's defaultManager() |
116 | set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSLibraryDirectory) inDomains:(refMe's NSSystemDomainMask)) |
117 | set ocidLibraryDirPathURL to ocidURLsArray's firstObject() |
118 | set ocidSystemRootDirPathURL to ocidLibraryDirPathURL's URLByDeletingLastPathComponent() |
119 | # |
120 | set ocidVolumesDirPathURL to ocidSystemRootDirPathURL's URLByAppendingPathComponent:("Volumes") isDirectory:(true) |
121 | # |
122 | set ocidOutPutString to refMe's NSMutableString's alloc()'s initWithCapacity:(0) |
123 | set ocidOutPutStringCom to refMe's NSMutableString's alloc()'s initWithCapacity:(0) |
124 | # |
125 | repeat with itemVolumeName in listVolumeName |
126 | set ocidVolDirPathURL to (ocidVolumesDirPathURL's URLByAppendingPathComponent:(itemVolumeName) isDirectory:(true)) |
127 | |
128 | set listResponse to (appFileManager's attributesOfItemAtPath:(ocidVolDirPathURL's |path|) |error| :(reference)) |
129 | set ocidAttributesDict to (item 1 of listResponse) |
130 | |
131 | #VolumeID |
132 | set numVolumeID to (ocidAttributesDict's objectForKey:(refMe's NSFileSystemNumber)) as integer |
133 | (ocidOutPutString's appendString:(itemVolumeName)) |
134 | (ocidOutPutString's appendString:("\n")) |
135 | set strSetValue to ("/.vol/" & numVolumeID & "/" & ocidResponseText) as text |
136 | (ocidOutPutString's appendString:(strSetValue)) |
137 | (ocidOutPutString's appendString:("\n")) |
138 | |
139 | set strSetValue to ("/usr/bin/GetFileInfo /.vol/" & numVolumeID & "/" & ocidResponseText) as text |
140 | (ocidOutPutStringCom's appendString:(strSetValue)) |
141 | (ocidOutPutStringCom's appendString:("\n")) |
142 | |
143 | end repeat |
144 | |
145 | set strMes to ocidOutPutString as text |
146 | set strAns to ocidOutPutStringCom as text |
147 | |
148 | #ダイアログ |
149 | tell current application |
150 | set strName to name as text |
151 | end tell |
152 | if strName is "osascript" then |
153 | tell application "Finder" |
154 | activate |
155 | end tell |
156 | else |
157 | tell current application |
158 | activate |
159 | end tell |
160 | end if |
161 | set aliasIconPath to (POSIX file "/System/Library/CoreServices/Finder.app/Contents/Resources/Finder.icns") as alias |
162 | try |
163 | set recordResult to (display dialog strMes with title "戻り値です" default answer strAns buttons {"クリップボードにコピー", "終了", "再実行"} default button "再実行" cancel button "終了" giving up after 20 with icon aliasIconPath without hidden answer) as record |
164 | on error |
165 | return "エラーしました" |
166 | end try |
167 | if (gave up of recordResult) is true then |
168 | return "時間切れです" |
169 | end if |
170 | ############################## |
171 | #####自分自身を再実行 |
172 | ############################## |
173 | if button returned of recordResult is "再実行" then |
174 | tell application "Finder" |
175 | set aliasPathToMe to (path to me) as alias |
176 | end tell |
177 | run script aliasPathToMe with parameters "再実行" |
178 | end if |
179 | ############################## |
180 | #####値のコピー |
181 | ############################## |
182 | if button returned of recordResult is "クリップボードにコピー" then |
183 | try |
184 | set strText to text returned of recordResult as text |
185 | ####ペーストボード宣言 |
186 | set appPasteboard to refMe's NSPasteboard's generalPasteboard() |
187 | set ocidText to (refMe's NSString's stringWithString:(strText)) |
188 | appPasteboard's clearContents() |
189 | appPasteboard's setString:(ocidText) forType:(refMe's NSPasteboardTypeString) |
190 | on error |
191 | tell application "Finder" |
192 | set the clipboard to strText as text |
193 | end tell |
194 | end try |
195 | end if |
196 | |
197 | |
198 | return 0 |
AppleScriptで生成しました |
| 固定リンク