Data Domain:如何使用 sfs-dump 列出 Data Domain 檔案系統上的檔案

Summary: 本文說明如何使用 Data Domain 命令列介面 (CLI) 轉儲個別 MTree 或整個檔案系統 (FS) 的檔案和目錄清單。

This article applies to This article does not apply to This article is not tied to any specific product. Not all product versions are identified in this article.

Symptoms

Data Domain (DD) 是被動後端儲存裝置。它僅儲存備份應用程式指示的內容,並且僅在備份應用程式指示它刪除檔案時才會刪除資料。Data Domain 絕不會自行建立或刪除任何檔案。

無論採用何種擷取通訊協定,Data Domain FS 都只包含在 MTrees 中組織的檔案 (目錄內)。所有檔案 (使用中和任何雲端裝置中的檔案) 共用相同的根和命名空間;存在單一命名空間,這代表檔案和目錄清單包括使用中和雲端裝置中的檔案,沒有任何區別。

取得詳細的檔案傾印可能很實用,原因如下:
  • 比較由備份應用程式管理的檔案清單,來檢查是否有任何未由備份應用程式管理的檔案。
  • 根據特定建立時間閾值來列出所有檔案,以判斷備份應用程式是否正確強制執行備份保留

Cause

用於建立檔案清單的 CLI 工具是 sfs_dump.

Resolution

使用 SSH 工作階段記錄收集清單輸出從 DD CLI 執行以收集檔案清單的確切命令取決於使用的 Data Domain 作業系統 (DDOS) 版本。

快速連結

若要從 CLI 取得 Data Domain 中檔案的詳細清單,以及最終取得儲存在 Data Domain 中檔案 情報 的程序,取決於執行的 DDOS 版本。

收集包含檔案詳細資料的文字輸出檔案後,將輸出處理成更實用的形式一律相同,因為所有 DDOS 版本的輸出格式都是相同的 (或可使用指令檔轉換為通用格式)。

SSH 工作階段記錄:

所有 DDOS 版本的共同點是要求以系統管理員使用者身分登入 Data Domain,並使用 SSH 用戶端執行此動作,該用戶端支援將主控台輸出記錄至用戶端的文字檔 (PuTTY 適用於此方式)。配置 SSH 用戶端,使其將輸出記錄到用戶端上的文字檔(確保記錄的行數或單個行長度沒有限制)。SSH 工作階段記錄檔 (以及 DD 檔案清單) 不會寫入 Data Domain 上,而是在 (通常) 啟動 SSH 連線的桌面用戶端上。

收集 SSH 工作階段輸出時,請務必為檔案指定一個有意義的名稱 (例如新增要傾印的 Data Domain 主機名稱和 MTree 名稱),並確保有足夠的空間容納記錄檔,對於包含 100 萬個檔案的 Data Domain 來說,這大約為 200 MB。

7.13.0.0、7.10.1.15、7.7.5.25 和 6.2.1.110 之前的 DDOS 版本

這些版本仍支援 se sfs_dump 命令 (以及 -c 可選擇直接將檔案詳細資料輸出為 CSV,無需任何進一步處理),但出於安全考量,不建議您進入支援工程師 (SE) 模式,而是升級至可用的最新 DDOS 版本。

以系統管理員使用者身分登入 Data Domain, 使用設定為將輸出寫入磁碟的 SSH 用戶端,變更為 SE 權限模式,然後針對每個需要檔案詳細資料的 MTree 執行下列命令:

#### To produce the output directly as CSV
# se sfs_dump -c <mtree-path>

#### To produce the output as default format
# se sfs_dump <mtree-path>

這些版本中的命令也可以一次產生 FS 中所有檔案的清單 (而非一次一個 MTree)。若要傾印 FS 中所有檔案的檔案資訊詳細資料,請保留 MTree 路徑:

# se sfs_dump -c

完成後,請務必停止將 SSH 用戶端記錄至磁碟,並將檔案擱置一旁供進一步處理。

命令輸出的格式為每個檔案單行。如果不使用 -c,格式與上面顯示的更高版本的格式相同。在以下情況下: -c 已使用(用於 CSV 輸出),格式如下(包括顯示為輸出中第一行的標題):

name    mtime   fileid  size    seg_bytes       seg_count       redun_seg_count pre_lc_size     post_lc_size
/data/col1/backup/file       1656995350000000000     78      33554431        33668007        4016    0       33668007        34208564

DDOS 版本 7.13.0.0、7.10.1.15、7.7.5.25 和 6.2.1.110 或更新版本

要列出的 MTree 位於「MTree」關鍵字之後:

# filesys sfs-dump mtree <mtree-path>

filesys sfs_dum 命令,比較 se sfs_dump

  • 新命令不支援 -c 以 CSV (欄) 格式傾印檔案資訊的選項
  • 新命令一次只能運行一個 MTree,不支援在單個調用中針對整個 FS 運行

如果需要將所有 MTrees 的檔案詳細資料傾印至檔案,請在 Data Domain FS 中循環存取整個 MTrees 清單,並針對每個 MTrees 執行一次命令。使用者可以執行下列作業,取得系統中的 MTree 清單:

# mtree list

使用 設定為將輸出寫入磁碟的 SSH 用戶端,以系統管理員使用者身分登入 Data Domain,然後針對每個需要檔案詳細資料的 MTree 執行下列命令:

# filesys sfs-dump mtree <mtree-path>

如果需要一個以上 MTree 的檔案詳細資料,請選擇選項以將所有傾印執行至相同的輸出檔案,或在為每個 MTrees 執行命令之前,將 SSH 用戶端組態切換至不同的檔案。

或者,透過使用 SSH 執行命令,以自動方式收集輸出:

#### Releases 7.13.0.0, 7.10.1.15, 7.7.5.25 and 6.2.1.110 onwards only
# ssh sysadmin@DD-HOSTNAME "filesys sfs-dump mtree /data/col1/backup" > sfs-dump-DD-backup.txt

在任一情況下,每個檔案的輸出資訊都有一行,格式如下:

/data/col1/backup/file: mtime: 1580211658000000000 fileid: 175 size: 136794 type: 9 seg_bytes: 138282 seg_count: 18 redun_seg_count: 14 (78%) pre_lc_size: 15045 post_lc_size: 8760 (58%) mode: 02000100644 start_offset: 0 end_offset: 18446744073709551615

DDOS 版本 8.1.0.0、7.13.1.10、7.10.1.30 和 7.7.5.40 或更新版本

filesys fs-dump

  • 新增的可能性 -c 選項,因此輸出以類似 CSV 格式的版本列印(用列分隔的欄位)
  • 一次為 FS 中的所有檔案執行檔案傾印資訊的可能性
  • 使用 ssh 工作階段記錄 收集輸出。

命令將持續與前一個版本相同,含所提增強功能,總結如下:

#### File listing for all the files in a given MTree path
# filesys sfs-dump mtree <mtree-path>

#### File listing for all the files in a given MTree path, with CSV-like output
# filesys sfs-dump -c mtree <mtree-path>

#### File listing for all the files in the FS
# filesys sfs-dump

#### File listing for all the files in the FS, with CSV-like output
# filesys sfs-dump -c


此命令持續處於「隱藏」狀態,因此它不會出現在 CLI 互動式說明或文件中。

如何處理 sfs_dump 或 filesys sfs 傾印資料變成有用的內容:

使用時輸出中報告的單個檔案的格式 filesys sfs-dumpsfs_dump 不含 -c 選項可以總結如下:

/data/col1/backup/file: mtime: 1580211658000000000 fileid: 175 size: 136794 type: 9 seg_bytes: 138282 seg_count: 18 redun_seg_count: 14 (78%) pre_lc_size: 15045 post_lc_size: 8760 (58%) mode: 02000100644 start_offset: 0 end_offset: 18446744073709551615

Field 01 : filename with full path (/data/col1/backup/file)
Field 03 : file last modification time as UNIX epoch in nanoseconds (nanoseconds since January 1st 1970 at midnight)
Field 05 : file (inode) ID, inode numbers are per MTree (175)
Field 07 : pre-comp size for the file in bytes (136794)
Field 09 : type of file (9)
Field 11 : segment store bytes (this is NOT the file size), please ignore (138282)
Field 13 : segment count, or the number of segments the file consists of (18)
Field 15 : number of file segments which are redundant, or not unique (14)
Field 16 : percentage of non-unique segments to total segments (78%)
Field 18 : combined size of the file's unique segments after deduplication (15045)
Field 20 : combined size of the file's unique segments after deduplication and local compression (8760)
Field 21 : ratio of post-deduplicated + post-compressed unique segments size to post-deduplicated unique segment size (58%), shows how well local compression worked
Field 23 : file mode, please ignore

在上述範例中,原始檔案的大小為 136,794 位元組,在透過 Data Domain FS 擷取管道傳遞後,經計算出在重複資料刪除後使用 15,045 位元組,在將檔案的唯一區段壓縮至磁碟前,則為 8760 位元組。因此:

  • 檔案重複資料刪除(又名”gcomp“或全域壓縮)是一個因數 x9.09(136,794 到 15,045 位元組)
  • 檔案本機壓縮 (又稱為「lcomp“用於本地壓縮)是一個因數 x1.72(15,045 到 8760 位元組)
  • 縮減的總檔案大小預估 (稱為「壓縮率」) 為因數 x15.62 (136,794 至 8760 位元組)

或者, sfs_dump -c 輸出為類似,但更簡短:

/data/col1/backup/file       1656995350000000000     78      33554431        33668007        4016    0       33668007        34208564

Field 01 : filename with full path (/data/col1/backup/file)
Field 02 : file last modification time as UNIX epoch in nanoseconds (nanoseconds since January 1st 1970 at midnight)
Field 03 : file (inode) ID, inode numbers are per MTree
Field 04 : pre-comp size for the file in bytes (33554431)
Filed 05 : segment store bytes (this is NOT the file size), please ignore (33668007)
Field 06 : segment count, or the number of segments the file consists of (4016)
Field 07 : number of file segments which are redundant, or not unique (0)
Field 08 : combined size of the file's unique segments after deduplication (33668007)
Field 09 : combined size of the file's unique segments after deduplication and local compression (34208564)

對於此範例,可以進行與前一個相同的計算:

  • 檔案重複資料刪除(又名”gcomp“或全域壓縮)是一個因數 x0.99(33,554,431 到 33,668,007 位元組)
  • 檔案本機壓縮 (又稱為”lcomp“ 表示本機壓縮) 為係數 x0.98 (33,668,007 至 34,208,564 位元組)
  • 縮減的總檔案大小預估 (稱為「壓縮率」) 為因數 x0.98 (33,554,431 至 34208564 位元組)

相較於顯示的 -c 例如,這個沒有實現重複數據刪除(沒有冗餘段)或任何本地壓縮。這表示檔案已壓縮。
 

警示:輸出檔中有關「檔的預壓縮大小(以位元組為單位)」以外的大小的數據應被視為近似值,不能完全依賴。檔案的中繼資料是在檔案擷取時所建立,雖然它在當時是正確的,但自那時起並未曾更新,因此會隨著時間的推移而過時。此外,檔案的 post_lc_size 為指定數量,並不代表該檔案使用的磁碟空間與該數量相同,因為有許多 FS 層級負荷並未依文件層級考慮。限制與命令的已知限制相同:
mtree show compression
利用上述輸出檔案中的資訊,當中包含以適合使用者目標的方式處理數字資料。使用案例的幾個範例可能是:
  • 判斷 gcomplcomp 對應至特定路徑的檔案 (如果路徑可符合某些特定備份伺服器、用戶端、原則、工作等)
  • 計算資料量 (pre-comp) 儲存在早於給定時間量的給定位置(以確定孤立項或解決備份應用程式未按時過期備份的問題)
  • 可利用的任何其他統計資料類型
若要設定單套指示,並補償在最近版本中的 sfs_dump -c 在最近的版本中,我們的建議是將輸出數據轉換為上面的 CSV 格式,然後使用 CSV 格式的檔進行進一步處理,但是,根據您的技能,可以直接處理非 CSV 輸出。

轉換為 CSV:

要轉換非 CSV sfs_dump 輸出成一個與什麼相同的 sfs_dump -c 會列印,可以使用以下 Linux 命令列:

# cat sfs-dump-noCSV.txt | grep ^/ | awk '
BEGIN {print "name\tmtime\tfileid\tsize\tseg_bytes\tseg_count\tredun_seg_count\tpre_lc_size\tpost_lc_size"}
{
    colon_index = index($0, ":")
    filename = substr($0, 1, colon_index - 1)
    gsub(/^[[:space:]]+|[[:space:]]+$/, "", filename)
    n = split(substr($0, colon_index + 1), fields, " ")
    print filename "\t" fields[2] "\t" fields[4] "\t" fields[6] "\t" fields[10] "\t" fields[12] "\t" fields[14] "\t" fields[17] "\t" fields[19]
}' > sfs-dump-CSV.csv

 

注意:上述命令會忽略輸入檔案 (sfs-dump-noCSV.txt) 中非以斜線開頭的所有內容,因為只有以「/data」開頭的行會包含要處理的檔案詳細資料。輸出檔案的第一行作為標題,並使用製表字元 (\t) 作為欄位分隔符號。


超出此點的所有內容均以現狀提供給使用者。針對以下共用的指示,Dell 方面不提供任何保證或義務。從檔案清單詳細資訊中取得情報是使用者的工作,如何實現這一點完全取決於在檔案傾印輸出中用於進行資料採礦的工具集、要實現的目標,以及使用者處理以上詳述命令輸出資料的個人專業知識。一個使用者可以選擇使用文本檔的Linux命令行處理來轉儲某些聚合,其他使用者可能會選擇使用“gnuplot”為圖表值生成輸入,而大多數使用者被認為尋求一種更簡單(但有限)的方法,從CSV檔構建電子錶格進行分析。

Dell 已努力確保以下說明正確、有效且對使用者有用,但不能保證這些指示可以正常工作,也不提供支援,因為它們超出了支援的範圍。

將 CSV 格式的sfs_dump輸出匯入電子表格(Excel 範例):

提供檔案詳細資訊清單的 CSV 版本後,從資料中取得情報的一種方法是將資料載入到試算表軟體中。範例使用了 Microsoft Excel,不過其他軟體的說明應類似。若要將 CSV 文字檔案作為 CSV 匯入 Excel 中,請按照以下步驟操作:

  1. 開啟 Excel 並建立新的空白試算表
  2. 前往上方的資料功能表,然後按一下名為自文字/CSV 的圖示
  3. 使用該對話方塊找出 CSV 格式的檔案資料 (sfs-dump-CSV.csv 如非 CSV 格式的範例轉換指令檔中所示),選取後按一下匯入
  4. 如果輸入檔案格式正確,且 Excel 可以從前 200 行 (應可) 擷取該格式,則對話方塊應會顯示要產生的試算表預覽。查看資訊以確保其看起來正確,包括將第一行檢測為標題
  5. 如果預覽一切正常,請按兩下對話框底部的 「載入 」按鈕,新電子錶格將以良好的格式顯示,欄位標題將變為啟用搜索和篩檢程式的標題。

試算表中的資料已經很有用,例如將數字篩選器套用至大小等數字欄位 (以僅顯示高於給定大小的檔案),或在名稱欄位上套用文字篩選器,以便僅顯示 Data Domain 檔案詳細資料輸出中與給定模式相符的檔案 (僅以特定 MTree 的路徑開頭的檔案)。 並從該數據中進行其他派生計算。

正確導入的 Excel 電子表格應包含在 A 到 I 列中的數據。如果資料僅出現在 A 欄中,但橫跨螢幕,請關閉 Excel 並重試上述步驟 1 到 5。

新增額外的計算欄位:

試算表可以根據使用者需要來擴增任意數量的計算欄位。已新增的一個有趣的欄位為對應至檔案的 mtime (上次修改時間,通常是寫入 DD 的時間) 的人類可讀日期和時間。此外,根據資料的用途,計算和顯示一些依檔案的壓縮值也可能有助於說明。新欄是使用 Excel 公式所自動填入,如下所述。

時間戳記轉換:

若要將類似 UNIX 的時間戳轉換為人類可讀的日期和時間:

  1. 儲存格 J2 上按右鍵,然後選擇設定儲存格格式
  2. 在左側的類別清單中,選擇自訂
  3. 如果尚未存在,請為人類可讀的日期和時間格式建立格式 (範例中的結尾包含 EST 字串。它可能會替換為您的文本時區定義,或者如果不感興趣,請完全刪除“EST”):yyyy-mm-dd hh:mm:ss “EST”
  4. 完成後,按一下確定。現在儲存格 J2 即有自訂的資料格式。
  5. 將下列公式新增到儲存格 J2。在公式中,針對在取得「sfs-dump」資料時,於 Data Domain 中設定的時區,將 (-6*3600) 取代為對應至 UTC 的正確時區差異。例如,美國東部時間在夏季比 UTC 晚 6 小時,因此此處為「-6」。
如果對這種精確的時間調整不感興趣,則可以使用公式的縮寫形式。添加公式並避免日期和時間格式被覆蓋的最簡單方法是複製以下兩個版本中的任何一個,然後在儲存格中鍵入「等於」字元 (=) 後粘貼到儲存格 J2 中以開始編輯儲存格:
(((B2/1000000000+(-6*3600))/86400)+25569)
(((B2/1000000000)/86400)+25569)
注意:如果將文本粘貼到 J2 中而沒有先將儲存格置於 編輯模式(以便調用),則會覆蓋儲存格的格式。或者,在公式前面加上 “=”,複製整個文本,然後右鍵單擊單元格 J2 以 選擇性粘貼,然後選擇 “作為文本”,然後按兩下 “確定”。它應可得到相同的效果。如果正確完成,Excel 會自動執行以下幾項操作:
  • 將公式貼上儲存格 J2 以及試算表中其他行的每一個儲存格 
  • 計算整個試算表的公式,並以設定的格式顯示日期和時間值
  • 將列格式化為現有列,並將標題配置為 日期,並可以應用 日期篩選器,唯一要做的是為列(日期)設置正確的名稱

壓縮資訊:

可以按照上述說明為每個檔的壓縮資訊添加列。這次公式顯示包含 「=」,因此必須複製整個文本,並將 「選擇性粘貼」作為文本:

  • 複製以下公式並將 「特殊粘貼為文字」到儲存格 K2 中,以為每個檔案的重複資料刪除創建一個列,或者 gcomp
    =IF(H2=0,0,D2/H2)
  • 複製以下公式並將 「特殊粘貼為文本」到儲存格 L2 中,以為每個檔案的本地壓縮創建一個列,或者 lcomp
    =IF(I2=0,0,H2/I2)
  • 複製以下公式並在儲存格 M2 中選擇性貼上成為文字,以為依檔案的總檔案壓縮率建立一欄:
    =K2*L2

為新欄指定一個正確的名稱。如果您想要另一個壓縮值格式 (例如,限制小數位數),請按照日期和時間範例操作,並在貼上公式之前提前設定儲存格數字格式。

請務必前往檔案功能表執行,以確保您的工作安全。另存新檔,以確保已儲存檔案的類型設定為 Excel Workbook (*.xlsx),以保留格式和篩選。

完成上述操作後,您的試算表將包含以下 (相關) 欄:

  • A 包含檔案名稱
  • B 包含上次寫入檔案時的日期戳記 (在 UNIX epoch 中以奈秒為單位)
  • D 是檔案的原始大小
  • H 是全域壓縮後的大小
  • I 是全域與本機壓縮後的大小
  • J 包含上次寫入檔案時的日期戳記,採用人類可讀的形式
  • K 包含檔案的全域壓縮 (重複資料刪除)
  • L 包含檔案的本機壓縮
  • M 包含檔案的總壓縮

所有檔大小均以位元組為單位。
現在,Excel 可以根據需要進行篩選或排序,以報告數據。

  • 例如,若要僅顯示 MTree /data/col1/backup 中超過 30 天的檔案:
  1. 按一下名稱標題中的向下箭頭,選取文字篩選,然後選取開頭為,並鍵入 /data/col1/backup/ 至方塊中。結尾的斜線很重要。按一下確定
  2. 按一下上次寫入日期標題中的向下箭頭選取日期篩選,然後選取早於。使用對話方塊右側的日期選取器選擇 30 天前的日期。按一下確定
底部的狀態列會顯示與此選擇相符的行數。

Additional Information

傾印檔案位置的命令 (使用中和雲端)

有一種方法可以傾印檔案清單,指出哪些為使用中,以及哪些在任何雲端裝置中,即:

#### For the DD FS as a whole
# filesys report generate file-location

#### For an individual MTree or subdirectory
# filesys report generate file-location path /data/col1/test

任一情況下的輸出都是以下類型:

-------------------------      ----------------------      ----------------------      ---------------------------
File Name                      Location(Unit Name)         Size                        Placement Time
-------------------------      ----------------------      ----------------------      ---------------------------
/data/col1/test/file1.bin                  Cloud-Unit                  200.00 GiB      Sat Mar  5 13:24:10 2022
/data/col1/test/file2.bin                      Active                   10.00 TiB      Sat May 14 00:48:17 2022
-------------------------      ----------------------      ----------------------      ---------------------------

然而,上述命令往往不足以滿足大多數意圖,例如,大小是以人類可讀單位 (而非以位元組、MiB 或任何設定乘數為單位),且放置時間與備份到 Data Domain 的時間相符 (雲端中檔案的「放置時間」是檔案移至雲端裝置的日期與時間相符)。

此外,請注意以下命令 (以及從非 CSV 轉換而來的指令檔 sfs_dump) 在用製表符分隔的列中輸出數據。輸出中存在的標籤字元必須儲存在記錄檔中,否則上面將 CSV 匯入 Excel 的詳細步驟會無法正確分隔欄位。

sfs_dump -c

給出的說明假定您對 Excel 有一定的瞭解,但可能會翻譯成其他電子錶格軟體。

現代版本的 Excel 允許許多行,但請記住,每個檔 sfs_dump 要處理的輸出是一行,因此 Excel 必須能夠快速處理和更新具有與數據集中檔一樣多的行數的電子錶格。硬限制略高於 100 萬行,但即使檔計數遠低於此值,Excel 也可能不適合該作業(太慢)。

如果 sfs_dump 「輸出」的檔案過多,無法用於該 Excel 版本的檔案,或為了提升效能而無法處理較小位元的資料,請針對每個 MTree 嘗試執行一次程序,這樣系統就會有多個試算表。

即使是單個 MTree sfs_dump 輸出對於 Excel 來說可能太大,在這種情況下,可以使用 拆分 Linux 命令(或任何其他類似工具來在線拆分大型文本檔的結束邊界)來一次處理一個較小的 CSV 檔,例如:

# split  -b <size> <filename> <new filename prefix>  (splits by file size)
# split  -l <size> <filename> <new filename prefix>  (splits by number of lines)
# split  -n <size> <filename> <new filename prefix>  (splits by number of pieces)

例如,要將輸入文字檔案分割為各 200 MiB 的區塊,並將這些部分的開頭命名為:

"sfs_dump.out.split"

然後執行:

# split -b 200M sfs_dump.out sfs_dump.out.split


使用「filesys sfs-dump」進行檔案資料完整 FS 傾印的指令檔。

針對少數無法以 CSV 格式傾印檔案詳細資料的版本,Dell 會按原樣提供以下進一步顯示的指令檔 (不保證),讓使用者透過處理非 CSV 來達到類似的結果 sfs_dump 輸出來達到類似的結果。

由於不支援 CSV 輸出的這些版本也不允許將整個 FS 中所有檔案的資訊傾印,因此指令檔會使用 SSH 連線至目標 Data Domain,以迭代 MTrees 清單,一次執行一個 MTree 的檔案傾印以收集所有 MTree 的檔案清單,然後轉換為足以進一步處理的 CSV 格式:

#!/bin/bash

#### WARNING
####     This script is provided to you by Dell Technologies with NO GUARANTEE, as best-effort sample code to get a full FS sfs-dump collected
####     for DDOS releases which do not support "se sfs-dump", or as an alternative to it, in releases which support "filesys fs-dump"
####     That this script does not work for you, or if you need help setting it up, extending it, or resolving any issues, is not entitled to support
####     This script is not part of Dell PowerProtect / Data Domain, and hence it is not supported

#### Replace values below to suit your needs
USERNAME="sysadmin"
DD_HOSTNAME="10.n.n.172"
#### NO CHANGES NEEDED BEYOND THIS POINT

clear
echo "Script collects a full FS sfs-dump from \"${DD_HOSTNAME}\", using the command \"filesys sfs-dump\", one MTree at a time"
echo "    * Script has to be configured by settting the \"USERNAME\" and \"DD_HOSTNAME\" variables within the top of the script"
echo "    * Script expects passwordless SSH connection as \"USERNAME\" to the \"DD_HOSTNAME\" configured"
echo "    * To configure passwordless SSH login to a DataDomain, check KB at https://www.dell.com/support/kbdoc/000004033 "
echo "    * Test passwordless login is configured and working prior to going ahead with this script"
echo "    * If passwordless login is not configured, script will ask for the \"${USERNAME}\" password "
echo "          - Once for getting the MTree list"
echo "          - And once for each one of the MTrees in \"${DD_HOSTNAME}\" "
echo
echo -n "Are you sure you want to continue? (y/n) : "
read -n 1 answer
echo
if [ "${answer}" = "y" ]; then
    echo "Going ahead with the script."
    echo
else
    echo "Stopping script now. Re-run when passwordless login to \"${DD_HOSTNAME}\" as \"${USERNAME}\" works. Bye."
    exit 1
fi

echo -n "1/6 : Collecting list of MTrees from DD..."
ssh ${USERNAME}@${DD_HOSTNAME} "mtree list" 2>/dev/null | grep ^/ | awk '{print $(NF-3)}' > mtree-list.txt
echo "Done."

n_mtrees=$( wc -l mtree-list.txt | cut -d" "  -f1 )
echo -n "2/6 : Collecting per-Mtree sfs-dump information for ${n_mtrees} MTrees ..."
for mtree in `cat mtree-list.txt`; do
    name=$(echo $mtree | cut -d/ -f4)
    ssh ${USERNAME}@${DD_HOSTNAME} "filesys sfs-dump mtree ${mtree}" 2>/dev/null | grep ^/ > sfs-dump-${name}.txt
    echo -n "."
done
echo "Done."

echo -n "3/6 : Putting all the files together..."
for file in `ls sfs-dump-*.txt`; do 
    if [ -s "${file}" ]; then cat ${file} >> sfs-dump-noCSV.txt; fi
done
echo "Done."

echo -n "4/6 : Converting sfs-dump output to CSV format..."
cat sfs-dump-noCSV.txt | grep ^/ | grep -v ^$ | awk '
BEGIN {print "name\tmtime\tfileid\tsize\tseg_bytes\tseg_count\tredun_seg_count\tpre_lc_size\tpost_lc_size"}
{
    colon_index = index($0, ":")
    filename = substr($0, 1, colon_index - 1)
    gsub(/^[[:space:]]+|[[:space:]]+$/, "", filename)
    n = split(substr($0, colon_index + 1), fields, " ")
    print filename "\t" fields[2] "\t" fields[4] "\t" fields[6] "\t" fields[10] "\t" fields[12] "\t" fields[14] "\t" fields[17] "\t" fields[19]
}' > sfs-dump-CSV.csv
echo "Done."

echo -n "5/6 : Cleaning up..."
for mtree in `cat mtree-list.txt`; do name=$(echo $mtree | cut -d/ -f4); rm -f sfs-dump-${name}.txt ; done
rm sfs-dump-noCSV.txt
rm mtree-list.txt
echo "Done."


echo -n "6/6 : Summary"
echo
n_files=$( wc -l sfs-dump-CSV.csv | cut -d" "  -f1 )
echo
echo "Collecting whole FS sfs-dump data from ${HOSTNAME} completed"
echo "File includes output for ${n_mtrees} MTrees, with a combined $(( ${n_files} - 1 )) files across Active and Cloud Tiers (if applicable)"
echo "Start of file shown below for your convenience :"
echo "===================="
head -5 sfs-dump-CSV.csv
echo "===================="
echo
echo "Done."

exit 0


將非 CSV「sfs-dump」和「filesys report generate file-location」的輸出合併到 CSV 檔案的指令檔,其中包含與上述指令檔相同的所有資訊,以及每個檔案層和放置時間資訊。

下列指令檔是由 Dell 以現狀 (不保證) 提供給使用者,希望能為輸出增加價值 sfs_dump 和 filesys 報告產生上面的檔位置命令。使用者可以根據層(活動或最多兩個已配置的雲單元中的任何一個)篩選出檔,以便通過將層位置和放置時間資訊添加到輸出 CSV 中的每個檔條目,更精確地瞭解每個層的檔分佈。

指令檔需要 sfs 傾印 (不是 sfs_dump -c) 輸出作為第一個參數,FileyS 報表將檔位置輸出生成為第二個參數。輸出會寫入硬編碼的檔案名稱「sfs-dump-output-tiers.csv」,這可在指令檔本身中更改。

可以與上述相同的方式使用 Excel 處理輸出。

#!/bin/bash

#### WARNING
####     This script is provided to you by Dell Technologies with NO GUARANTEE, as best-effort sample code to match the output from commands :
####       * sfs-dump (in non CSV format)
####       * filesys report generate file-location
####     So that a new CSV with the file paths appearing on both is created for all the data in sfs-dump file with the added tier and placement time information from location report
####
####     This script is not part of Dell PowerProtect / Data Domain, and hence it is not supported
####
####     Usage : extend-sfs-dump-with-tier.sh sfs-dump-output.csv file-location-output.log
####     Output : static "sfs-dump-output-tiers.csv" file name (may be changed below)

#### Replace values below to suit your needs
OUTPUT_FILENAME="sfs-dump-output-tiers.csv"
#### NO CHANGES NEEDED BEYOND THIS POINT

clear

if [ ! $# == 2 ]; then
    echo "Combine output from sfs-dump and tier location report into a CSV file with tier and placement time information"
    echo
    echo "Usage : $0 SFS-DUMP-OUTPUT-FILE    REPORT-FILE-LOCATION-FILE"
    echo "NOTE : SFS-DUMP-OUTPUT-FILE has to be in non-CSV format"
    exit 1
fi

INPUT_SFSDUMP="$1"
INPUT_LOCATION="$2"


echo -n "1/6 : Sanity checking input files..."
if [ ! -s "${INPUT_SFSDUMP}" ]; then
    echo "Input file ${INPUT_SFSDUMP} does not exist"
    exit 1
fi
if [ ! -s "${INPUT_LOCATION}" ]; then
    echo "Input file ${INPUT_LOCATION} does not exist"
    exit 1
fi
n_files_sfsdump=`grep ^/ ${INPUT_SFSDUMP} | wc -l`
n_files_location=`grep ^/ ${INPUT_LOCATION} | wc -l`
if [ ${n_files_sfsdump} -eq ${n_files_location} ]; then
    echo -n "both have the same amount of files (${n_files_location}). "
else
    echo -n "sfs-dump has ${n_files_sfsdump} files whereas location report has ${n_files_location} files, this may be normal if the difference is small. "
fi
echo "Done."


echo -n "2/6 : Sanitize \"file-location\" input..."
cat ${INPUT_LOCATION} | awk 'BEGIN {rejected="temp-location-rejected.log"; accepted="temp-location-accepted.log"} { if ( $0 ~ "Missing -unit") { gsub(/Missing -unit/, "Missing-Cloud-Unit", $0); print $0 > rejected } else { if ($0 ~ "^/" ) print $0 > accepted } }'
if [ -s "temp-location-rejected.log" ]; then
    REJECTS_EXIST="yes"
    echo -n "Some files in location report sit in unavailable or deleted cloud units, you may need to re-run this script after fixing the issue and gathering a new location report. "
    cat temp-location-rejected.log temp-location-accepted.log | sed -e 's/\t/:\t/' | sort > temp-location-report-sorted.log
    rm temp-location-rejected.log
else
    cat temp-location-accepted.log | sed -e 's/\t/:\t/' | sort > temp-location-report-sorted.log
    REJECTS_EXIST="no"
fi
rm temp-location-accepted.log
echo "Done."


echo -n "3/6 : Sanitize \"sfs-dump\" input..."
cat ${INPUT_SFSDUMP} | grep ^/ | sort > temp-sfs-dump.log
echo "Done."


echo -n "4/6 : Merging information for sfs-dump and location report..."
join -1 1 -2 1 temp-sfs-dump.log temp-location-report-sorted.log > temp-merged-information.log
rm temp-sfs-dump.log
rm temp-location-report-sorted.log
n_files_combined=`grep ^/ temp-merged-information.log | wc -l`
if [ ${n_files_combined} -eq 0 ]; then
    echo "No files matched from input files. sfs-dump output must NOT be in CSV format. Exiting."
    rm temp-merged-information.log
    exit 1
fi
echo -n "Input files matched on ${n_files_combined} files. "
echo "Done."


echo -n "5/6 : Converting merged sfs-dump / location-report output to CSV format..."
cat temp-merged-information.log | grep ^/ | grep -v ^$ | awk '
BEGIN {print "name\tmtime\tfileid\tsize\tseg_bytes\tseg_count\tredun_seg_count\tpre_lc_size\tpost_lc_size\ttier\tplacement_time"}
{
    colon_index = index($0, ":")
    filename = substr($0, 1, colon_index - 1)
    gsub(/^[[:space:]]+|[[:space:]]+$/, "", filename)
    n = split(substr($0, colon_index + 1), fields, " ")
    print filename "\t" fields[2] "\t" fields[4] "\t" fields[6] "\t" fields[10] "\t" fields[12] "\t" fields[14] "\t" fields[17] "\t" fields[19] "\t" fields[27] \
        "\t" fields[length(fields)-4] " " fields[length(fields)-3] " " fields[length(fields)-2] " " fields[length(fields)-1] " " fields[length(fields)]
}' > ${OUTPUT_FILENAME}
rm temp-merged-information.log
echo "Done."


echo -n "6/6 : Summary"
echo
echo
echo "Merging information from sfs-dump (${INPUT_SFSDUMP}) and location-report ${INPUT_LOCATION} output completed."
echo "Output file (${OUTPUT_FILENAME}) includes information for a total ${n_files_combined} files, out of ${n_files_sfsdump} in input sfs-dump, and ${n_files_location} in input location report."
if [ "${REJECTS_EXIST}" == "yes" ]; then
    echo "Note there are some files in disconnected or deleted cloud units, for which the \"tier\" field has been replaced with \"Missing-Cloud-Unit\"."
fi
echo
echo "Start of file shown below for your convenience :"
echo "===================="
head -5 ${OUTPUT_FILENAME}
echo "===================="
echo
echo "You may follow the instructions in https://www.dell.com/support/kbdoc/000081345 to process this CSV file in an spreadhseet"
echo
echo "Done."

exit 0


對於 Veritas NetBackup 使用者:

Veritas NetBackup (NBU) 已知會在 Data Domain 中建立檔案,檔案名稱包含冒號字元。例如,當 Data Domain 用作 NBU 的後端儲存裝置時,以下是有效的 NBU 檔案名稱路徑:

/data/col1/MTREE_NAME/POLICY-NAME_1400502741_C1_F1:1400502741:VM_PRD-02:4:1::
/data/col1/MTREE_NAME/POLICY-NAME_1400502741_C1_F2:1400502741:VM_PRD-02:4:1::
/data/col1/MTREE_NAME/POLICY-NAME_1400502741_C1_HDR:1400502741:VM_PRD-02:4:1::

這會對上述範例指令檔造成問題,因為冒號字元會用作 sfs_dump 命令輸出,並執行上述指令檔會產生不正確的結果。

對於這種情況,必須按以下方式編輯腳本:

--- iterate-dd-for-fs-sfs-dump.sh       2024-01-23 06:32:16.521409000 -0500
+++ iterate-dd-for-fs-sfs-dump-NBU.sh   2024-02-27 03:26:42.808246000 -0500
@@ -55,11 +55,11 @@
 cat sfs-dump-noCSV.txt | grep ^/ | grep -v ^$ | awk '
 BEGIN {print "name\tmtime\tfileid\tsize\tseg_bytes\tseg_count\tredun_seg_count\tpre_lc_size\tpost_lc_size"}
 {
-    colon_index = index($0, ":")
-    filename = substr($0, 1, colon_index - 1)
+    colon_index = index($0, ":::")
+    filename = substr($0, 1, colon_index + 1)
     gsub(/^[[:space:]]+|[[:space:]]+$/, "", filename)
     n = split(substr($0, colon_index + 1), fields, " ")
-    print filename "\t" fields[2] "\t" fields[4] "\t" fields[6] "\t" fields[10] "\t" fields[12] "\t" fields[14] "\t" fields[17] "\t" fields[19]
+    print filename "\t" fields[3] "\t" fields[5] "\t" fields[7] "\t" fields[11] "\t" fields[13] "\t" fields[15] "\t" fields[18] "\t" fields[20] "\t"
 }' > sfs-dump-CSV.csv
 echo "Done."

雖然共用變更可供指令檔迭代 Data Domain 中的所有 MTree,以提取各 MTree sfs_dump 資料,但其他指令檔的變更皆相同。然而,指令檔本身也是如此,上述變更是由 Dell 提供,不含任何保證,希望其有用。

Affected Products

Data Domain

Products

Data Domain
Article Properties
Article Number: 000081345
Article Type: Solution
Last Modified: 08 Jun 2026
Version:  26
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.