Btrfs

如何顯示 btrfs 快照大小

  • May 3, 2022

我在一些 btrfs 卷上有很多快照,我想知道每個快照佔用多少空間,所以我會知道何時以及是否有重要更改。

sudo btrfs subvolume show /home/
/
Name:           <FS_TREE>
UUID:           -
Parent UUID:        -
Received UUID:      -
Creation time:      -
Subvolume ID:       5
Generation:         1181373
Gen at creation:    0
Parent ID:      0
Top level ID:       0
Flags:          -
Snapshot(s):
           .snapshot/_0
           .snapshot/_1
           .snapshot/_2
           .snapshot/_3
           .snapshot/_4
           ...

但如果我使用du 他們報告整個空間

du -sh /home/.snapshot/*
1,2T    /home/.snapshot/_0
1,2T    /home/.snapshot/_1
1,2T    /home/.snapshot/_2

有沒有辦法發現空間中_1和_2之間的差異

編輯:注意:我一直在成功使用btrfs-list來簡單地顯示快照大小

為了顯示 BTRFS 子卷的使用數據,您必須首先啟用配額,如下所示:

sudo btrfs quota enable /home

然後,您可以執行類似的命令sudo btrfs subvol show /home/.snapshots/your_snapshot並獲取使用情況統計資訊。這是一個例子:

   sudo btrfs subvol show /.snapshots/1076/snapshot/
@/.snapshots/1076/snapshot
   Name:           snapshot
   UUID:           3ba9ffa0-a355-d544-be10-1b1d0a3a321e
   Parent UUID:        5c0c4206-9b15-074f-83c3-65861366e318
   Received UUID:      -
   Creation time:      2022-02-01 00:00:09 -0800
   Subvolume ID:       1445
   Generation:         66371
   Gen at creation:    66370
   Parent ID:      275
   Top level ID:       275
   Flags:          readonly
   Send transid:       0
   Send time:      2022-02-01 00:00:09 -0800
   Receive transid:    0
   Receive time:       -
   Snapshot(s):
   Quota group:        0/1445
     Limit referenced: -
     Limit exclusive:  -
     Usage referenced: 13.92GiB
     Usage exclusive:  8.25GiB

引用自:https://unix.stackexchange.com/questions/699035