為什麼預設的頂層子磁碟區(id=5)沒有顯示在 btrfs 子磁碟區清單 -a 中?

為什麼預設的頂層子磁碟區(id=5)沒有顯示在 btrfs 子磁碟區清單 -a 中?

關於子卷的 btrfs wiki 頁面它說預設情況下,在創建 btrfs (即make.btrfs <devicenode>)時頂層建立子磁碟區 ID=5 的子磁碟區。

新建立的檔案系統也是一個子卷,稱為頂級,內部有一個 id 5。

我嘗試使用 來顯示這個子卷btrfs subvolume list -a /btrfs.mountpoint,但它沒有顯示,為什麼?

更新 在(自助)嘗試中,我試圖找到有關此頂級子卷 ID=5 的更多信息,該子卷是(如上所述)在上面創建的。因此,我嘗試掛載到真正的 btrfs 根(我應該是子卷 id=0)並查看其內容,如下所示:

# mount a specific subvolume of a btrfs 
$> mount -t btrfs -o subvolid=0 /dev/sda /mnt
# show the output of the "."-entry of the subvolume-root (show inodevalue)
$> ls /mnt -lai | head -n 2
total 112656
 256 drwxr-xr-x  1 root root      432 May 25 09:08 .

再次卸載後我做了同樣的事情(這次使用子卷 ID=5)

# mount a specific subvolume of a btrfs 
$> mount -t btrfs -o subvolid=5 /dev/sda /mnt
# show the output of the "."-entry of the subvolume-root (show inodevalue)
$> ls /mnt -lai | head -n 2
total 112656
 256 drwxr-xr-x  1 root root      432 May 25 09:08 .

它產生與根子磁碟區和 ID=5 相同的輸出(就像子磁碟區 ID=5 一樣)。也許這說明了為什麼它不顯示在btrfs subvolume list -a命令中?

無論如何,因為即使根卷也被分配了一個子卷(至少與掛載一起使用),所以在 處沒有顯示任何內容似乎很奇怪btrfs subvolume list -a

(更新修正了貼上錯誤的btrfs subvolume指令的錯誤)

更新2

btrfs和的手冊頁btrfs-progs以及引用的 wiki 頁面(請參閱問題開頭)在闡述如何建立檔案系統磁碟區根、子磁碟區、子磁碟區......btrfs 方面並不是非常精確。

根據郵件列表上的一些解釋,這是:

[a]所有子磁碟區都可以從使用時安裝的磁碟區存取-o subvolid=0.(請注意0不是根卷的真實ID, 只是安裝它的快捷方式.) [強調](來源https://www.mail-archive.com/[電子郵件受保護]/msg17141.html

這讓我相信,儘管第一次引用,子卷 id 5 是根(至少在我的情況下)。

無論如何,幾年前 btrfs 郵件列表顯示一個案例其中,btrfs subvolume list 甚至沒有正確報告所有普通快照,這讓我相信所有不顯示子卷的問題也有可能是一個錯誤。

更重要的是,我希望有人能在回答這個問題時對此進行一些闡述。

相關內容