Bcachefs 進入 Linux Kernel 6.7 主線了

Bcachefs 是 Linux 下一個新的 filesystem (但也發展了好幾年),剛剛看到進入 Linux Kernel 6.7 的主線了:「Bcachefs Merged Into The Linux 6.7 Kernel」。

看起來沒搭上 6.6 的列車 (前幾天出的,2023/10/30),但以目前 Linux Kernel 的步調來看,6.7 應該是兩個月後就會釋出,Ubuntu 有機會在明年的 24.04 內建...

從官網列出來的功能可以知道,Bcachefs 實作了很多現代 filesystem 會發展的功能,像是 compression、encryption 以及 snapshots,另外底層也實作了 checksum 與 copy on write。

這樣看起來,Bcachefs 目前在 Linux 上主要的競爭對象應該會是 OpenZFS。真正的比較應該會等到 6.7 的 rc 版本就會有人下去測,到時候再看看,甚至看看有沒有機會取代 ext4 變成預設的 filesystem。

Mountpoint for Amazon S3 正式推出 (GA) 了...

三月的時候提到 AWS 搞出了自己的 Amazon S3FUSE 實作:「AWS 官方推出了自己的 Amazon S3 FUSE 套件」,現在 GA 了:「Mountpoint for Amazon S3 – Generally Available and Ready for Production Workloads」。

看起來 s3fs-fuse 還是一直有在更新,然後翻了翻好像沒看到兩者的比較... (可能是之前 Mountpoint for Amazon S3 在 alpha 版的關係?)

記得這個功能拿來塞些東西還蠻好用的...

用 try 來看檔案系統的改變

Hacker News Daily 上看到這則:「Try: run a command and inspect its effects before changing your live system (github.com/binpash)」,這是一個 GitHub 專案:「binpash/try」。

整包軟體意外的簡單,是一隻 shell script,透過 OverlayFS 取得改變的部分:

try lets you run a command and inspect its effects before changing your live system. try uses Linux's namespaces (via unshare) and the overlayfs union filesystem.

記得 OverlayFS 在 Docker 用的很多,所以穩定性應該是沒什麼問題,不過專案開頭也有提到,這只是把 filesystem 層拆出來,不是很嚴謹的 sandbox 環境,像是 /dev 這邊的東西還是有穿透性,不要跑不信任的程式:

Please note that try is a prototype and not a full sandbox, and should not be used to execute commands that you don't already trust on your system, (i.e. devices in /dev are mounted in the sandbox, and network calls are all allowed.) Please do not attempt any commands that will remove everything in /dev or write zeros to your disks.

我覺得這個很適合拿來跑各種 install.sh 這種東西?有些 install.sh 不知道塞了多少垃圾 (像是 .bashrc 或是 .profile 都有可能會被動),可以知道有哪些檔案要清會比較好。

把裡面的 try 這個檔案丟到自己的可執行目錄就裝好了,像是 ~/.local/bin 或是 ~/bin 之類的地方,看你的 $PATH 設定決定。

另外也可以從 subcommands 裡面的指令看到你可以用 try explore 啟動 shell 跑進去看:

Subcommands:
  try summary DIR   show the summary for the overlay in DIR
  try commit DIR    commit the overlay in DIR
  try explore DIR   start a shell inside the overlay in DIR

GitHub 上面的範例是用 pip 示範,同樣道理應該也可以看 npm 與其他套件。

Linux 6.2 的 Btrfs 改進

Hacker News 上看到 Btrfs 的改善消息:「Btrfs With Linux 6.2 Bringing Performance Improvements, Better RAID 5/6 Reliability」,對應的討論在「 Btrfs in Linux 6.2 brings performance improvements, better RAID 5/6 reliability (phoronix.com)」這邊。

因為 ext4 本身很成熟了,加上特殊的需求反而會去用 OpenZFS,就很久沒關注 Btrfs 了,這次看到 Btrfs 在 Linux 6.2 上的改進剛好可以重顧一下情況。

看起來是針對 RAID 模式下的改善,包括穩定性與效能,不過看起來是針對 RAID5 的部份多一點。

就目前的「情勢」看起來,Btrfs 之所以還是有繼續被發展,主要還是因為 OpenZFS 的授權條款是 CDDL,與 Linux kernel 用的 GPLv2 不相容,所以得分開維護。

但 OpenZFS 這邊的功能性與成熟度還是比 Btrfs 好不少,以現階段來說,如果架構上可以設計放 OpenZFS 的話應該還是會放 OpenZFS...

AWS 宣佈提昇 Amazon EFS 的最低效率

AWS 宣佈提昇 Amazon EFS 的最低效率:「Amazon Elastic File System increases file system minimum throughput」。

第一段裡的幾個數字差不多就是重點了:

Amazon Elastic File System (Amazon EFS) file systems using the default bursting throughput mode now have a minimum throughput of 1 MiB/s. All EFS bursting mode file systems (regardless of size) can drive 100 MiB/s of throughput, and file systems with more than 1TiB of Standard class storage can drive 100 MiB/s per TB when burst credits are available. This change increases the minimum throughput from 50KiB/s per GiB of Standard class storage to a fixed minimum of 1 MiB/s for file systems with less than 20 GiB of Standard class storage, when burst credits are exhausted.

本來最低保證效率是每 GB 提供 50KB/sec,也就是要使用到 20GB 才會提供 1MB/sec,現在對於不到 20GB 的使用者,直接拉高到固定 1MB/sec。

這對於剛開始用的使用者會方便一些,不過 EFS 主要還是方便在不同機器上共享,效率上還是本機掛 EBS 好很多 (因為 OS 可以 cache)。

先前在 AWS 上把 /home 丟到 EFS 上面,結果因為 i/o 都需要透過網路的關係,編 pyenv 超慢,後來找一天把東西都丟回 EBS 上,速度快多了...

FreeBSD 12.2 在 AWS 的 Amazon EFS 整合 (autofs)

Colin Percival 提到了 FreeBSD 12.2 上 autofs 會整合 Amazon EFS,讓掛載進來變得更方便:「Some new FreeBSD/EC2 features: EFS automount and ebsnvme-id」。

用法是先設定 autofs,然後啟用 autofs:

# echo '/efs -efs' > /etc/auto_master 
# sysrc autofs_enable="YES"

然後重開機後就可以直接切到 /efs/FSID 把 EFS 掛起來了:

Having done this, any access to the path /efs/FSID (e.g., /efs/fs-01234567) will automatically and transparently mount that filesystem.

另外加上原來對 EBS 與 ephemeral disk 的支援,這樣 storage 的部份算是該有的都有了:

Using the tool and some devd magic, FreeBSD now maintains a tree under /dev/aws/disk containing the symlinks of the forms

  • /dev/aws/disk/ebs/vol-0123456789abcdef
  • /dev/aws/disk/linuxname/sdh
  • /dev/aws/disk/ephemeral/SERIALNO

Amazon EFS 開放東京區使用,提供 Provisioned Throughput

兩篇 Amazon EFS 的消息:「Amazon Elastic File System (Amazon EFS) Available in Asia Pacific (Tokyo) Region」、「Amazon EFS Now Supports Provisioned Throughput」。

ap-northeast-1 等很久的功能終於上線了,另外本來 EFS 對速度是有限制的,現在則是提供付費方案讓你可以確保效能... (採用 credit 架構,不過一般是夠用的... 空間在 1TB 以下可以 burst 到 100MB/sec,參考「Throughput Modes」這篇的說明)

這樣有蠻多架構可以花錢來解了...