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

Summary: 本文說明如何使用 Data Domain CLI,為個別 MTree 或整個檔案系統 (FS) 傾印檔案和目錄清單。這可讓使用者從備份應用程式中找出 Data Domain 中儲存的內容。

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

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

取得詳細的檔案傾印可能很實用,原因如下:
  • 比較由備份應用程式管理的檔案清單,來檢查是否有任何未由備份應用程式管理的檔案。
  • 根據特定建立時間閾值來列出所有檔案,以判斷備份應用程式是否正確強制執行備份保留
由於最近在 DDOS 中所做的變更,用於從 Data Domain 系統收集檔案清單的命令已隨時間而變更。這些只能從 DD CLI 取得,並視版本而定:
  • 適用於早於 7.13.0.0、7.10.1.15、7.7.5.25 和 6.2.1.110 的 DDOS
se sfs_dump
  • 適用於等於或晚於 7.13.0.0、7.10.1.15、7.7.5.25、6.2.1.110 的任何 DDOS
filesys sfs-dump

Cause

DDOS 版本 7.13.0.0、7.10.1.15、7.7.5.25 和 6.2.1.110 及更新版本不再提供於 SE 模式下存取下列命令的功能:
sfs_dump
存取此功能所需的 SE 模式已淘汰,如 DSA-2023-412 中所述:適用於多個安全性漏洞的 Dell Technologies PowerProtect 安全性更新

在過渡期間,不提供 SE 模式下舊 sfs_dump 命令中的一些功能,但已在稍後階段重新導入。因此,此 KB 嘗試解釋差異,以及如何處理在每種情況下的命令輸出。

Resolution

若要從 CLI 取得 Data Domain 中檔案的詳細清單,以及最終取得儲存在 Data Domain 中檔案情報的程序,取決於執行的 DDOS 版本。收集包含檔案詳細資料的文字輸出檔案後,將輸出處理成更實用的形式一律相同,因為所有 DDOS 版本的輸出格式都相同 (或者可以使用指令檔轉換為一般格式)。

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

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

從 DD CLI 執行以收集檔案清單的確切命令取決於所使用的 DDOS 版本,摘要如下。
 

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

這些版本仍支援 se sfs_dump 命令 (以及 -c 選項,可直接將檔案詳細資料輸出為 CSV,無需任何進一步處理),但基於安全考量,不建議您進入 SE 模式,請改為升級至可用的最新 LTS 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 或更新版本:

此版本不再提供從 SE 模式至 sfs_dump 的存取權限 (以下內容無法使用):
se sfs_dump
由於發現安全性問題,已淘汰 SE 模式。以下為要使用的替代命令。請注意命令名稱略有不同,在此範例中,要列出的 MTree 位於「MTree」關鍵字之後:
# filesys sfs-dump mtree <mtree-path>
對於標題中的版本,此 sfs-dump 命令相較於 se sfsa_dump
  • 新命令不支援以 CSV (欄) 格式傾印檔案資訊的 -c 選項
  • 新命令一次只能執行一個 MTree,不支援在單一調用中針對整個 FS 執行
對於這些版本中的客戶,如果需要將所有 MTree 的檔案詳細資料傾印至檔案,則必須在 Data Domain FS 中迭代整個 MTree 清單,並針對每一個執行一次命令。使用者可以執行下列作業,取得系統中的 MTree 清單:
# mtree list
下列命令的輸出與先前 se sfs_dump 命令輸出相同,使用時不含 -c 選項。
filesys sfs-dump
請確定您以系統管理員使用者身分登入 Data Domain,並使用設定為將輸出寫入磁碟的 SSH 用戶端,然後針對您想要檔案詳細資料的每個 MTree 執行下列命令:
# filesys sfs-dump mtree <mtree-path>

如果您要取得多個 MTree 的檔案詳細資料,請選擇將所有傾印複製到相同的輸出檔案,或在針對每個 MTree 執行命令之前,將 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 或更新版本:

由於客戶需求,在舊 se sfs_dump 命令中的一些功能已重新導入,現在可用於 filesys sfs-dump 命令,即:
  • 新增 -c 選項的可能性,因此輸出會以類似 CSV 格式的版本列印 (依欄分隔的欄位)
  • 一次為 FS 中的所有檔案執行檔案傾印資訊的可能性
命令將持續與前一個版本相同,含所提增強功能,總結如下:
 
#### 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_dumpfilesys sfs-dump 資料處理成有用的東西:

在輸出中報告的個別檔案格式 (當使用 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 至 34208564 位元組)
  • 縮減的總檔案大小預估 (稱為「壓縮率」) 為因數 x0.98 (33,554,431 至 34208564 位元組)
相較於所示檔案,針對無 -c 範例,這個並未實現重複資料刪除 (沒有備援區段) 或任何本機壓縮。這表示檔案已壓縮。
 
警示:輸出檔案中有關「檔案的壓縮前大小 (以位元組為單位)」以外的大小資料應被視為近似值,不能完全依賴。檔案的中繼資料是在檔案擷取時所建立,雖然它在當時是正確的,但自那時起並未曾更新,因此會隨著時間的推移而過時。此外,檔案的 post_lc_size 為指定數量,並不代表該檔案使用的磁碟空間與該數量相同,因為有許多 FS 層級負荷並未依文件層級考慮。限制與命令的已知限制相同:
mtree show compression
利用上述輸出檔案中的資訊,當中包含以適合使用者目標的方式處理數字資料。使用案例的幾個範例可能是:
  • 判斷用於對應至特定路徑上檔案的 gcomp 和 lcomp (如果路徑可符合一些特定備份伺服器、用戶端、原則、工作等)
  • 計算在早於指定時間的指定位置中儲存了多少資料 (壓縮前) (以判斷孤立或故障診斷備份應用程式未讓已到期的備份及時到期的問題)
  • 可利用的任何其他統計資料類型
若要設定單套指示,並補償在最近版本中的 sfs_dump -c 選項,我們的建議是將輸出資料轉換為以上的 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 來說都可能太大,在這種情況下,您可以使用 split 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


要對整個檔案資料的 FS 傾印使用 "filesys sfs-dump" 的指令檔

針對少數無法以 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.60.36.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 report generate file-location 命令增加價值。使用者可以根據層 (使用中或兩個已配置的雲端裝置中的任何一個) 篩選出檔案,以透過將層位置和放置時間資訊新增到輸出 CSV 中的每個檔案項目,更精確地瞭解每個層的檔案分佈。

指令檔預期 sfs-dump (不是 sfs_dump -c) 輸出作為第一個參數,filesys report generate file-location 輸出作為第二個參數。輸出會寫入硬編碼的檔案名稱「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: 27 May 2025
Version:  21
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.