Apple檔案系統

Apple檔案系統(英語:Apple File System,簡稱APFS)是一個適用於macOSiOStvOSwatchOS的檔案系統,目前由蘋果公司開發和部署。[5][6][7]它的目的是解決Mac OS擴充的HFS+檔案系統的核心問題。[8]APFS針對快閃記憶體固態儲存裝置進行最佳化,具有寫入時複製等設計特點,使用I/O合併改進效能。[9][10]

Apple 檔案系統
開發者蘋果公司
全稱Apple File System
發佈2017年3月27日(iOS),2017年9月25日(macOS) (iOS 10.3, macOS 10.13)
分區標識7C3457EF-0000-11AA-AA11-00306543ECAC (GPT)
結構
目錄內容B樹[1]
限制
最大檔案尺寸8 EiB[2]
最大檔案數量263
檔案名字符集UTF-8編碼的Unicode 9.0 [3]
功能
日期記錄訪問、屬性修改、內容修改、建立
日期範圍1970年1月1日 – 2554年7月21日
日期解像度1 納秒[2]
檔案系統權限UNIX權限,NFSv4存取控制串列
透明壓縮部分 (decmpfs)[4]
透明加密
寫入時複製
作業系統支援macOSiOStvOSwatchOS

特點

Apple 檔案系統使用64位元inode號碼,並允許使用更安全的儲存。與HFS+類似,為了提供更好的空間管理與效能,APFS的代碼使用TRIM命令。由於APFS採用全新的數據計算方式,裝置的讀寫速度與可用空間可能會因此提升。[11]

寫入時複製

寫入時複製可以使檔案系統快速、高效地在同個卷宗上複製檔案,且不須佔用額外儲存空間。對數據的修改將寫入其他位置,未修改的則繼續共用使用。對檔案的更改將使用差分編碼儲存,減少文件修訂和複製所需的儲存空間。[7]

快照

APFS支援建立特定時間點、檔案系統唯讀實例的快照[7]

加密

APFS將實現檔案和敏感元數據磁碟加密。它對一個容器中的每個卷支援下列加密模型:

  • 不加密
  • 單金鑰加密
  • 多金鑰加密,每個檔案使用單獨的金鑰加密,元數據再使用另一個金鑰加密。[7]

數據完整性

APFS利用現代硬件韌體中強大的校驗和錯誤糾正的優勢。為確保數據完整性,APFS 對元數據採用校驗和技術,但未同時對用戶數據採用。[12]

當機防護

APFS被設計為可以免受當機帶來的數據損失。它使用「寫入全新的元數據記錄、指向新的記錄、釋放舊的記錄」的邏輯,而非直接覆蓋現有的記錄。這能避免更新期間當機而導致的記錄損壞,也能防止重複寫入兩次更改(HFS+紀錄檔檔案系統需要將更改先寫入紀錄檔,再寫入目錄檔案)。[13]

限制與不足

第一代APFS不為用戶數據提供校驗和,但通過基於元數據的校驗和檢查來確保數據完整。[14]另外,它並不利用揮發性記憶體可位元定址這一特性,也不支援壓縮[15]

與HFS+不同的是,在macOS High Sierra測試版本之前,APFS不進行Unicode正規化[16]無法支援大多數非英語語言。[17][18]

作業系統支援

macOS

APFS於macOS Sierra中提供,但存在一些限制:

  • 使用macOS Sierra格式化所得到的磁碟可能並不會與未來版本的macOS相容,並也可能不與macOS的最終版本相容。
  • APFS的可用選項有「區分大小寫」,「加密」,「區分大小寫,加密」。
  • 關於Time MachinemacOS Catalina (10.15) 及先前版本不能備份到 APFS 格式的磁碟[19],而在macOS Big Sur(11)中支援備份至APFS格式的硬碟[20]
  • macOS 10.14 前的系統不相容Fusion Drive
  • 在macOS的磁碟工具中,可通過「選單-編輯-轉換為APFS」無失真把HFS+分區轉換為APFS分區,但不能無失真把APFS分區轉換回HFS+分區。

在macOS Sierra中可使用diskutil命令列工具將分區格式化為APFS。APFS 在 macOS High Sierra(10.13)之後將成為預設的檔案格式。

iOS、tvOS與watchOS

所有相容的裝置升級到iOS 10.3tvOS 10.2watchOS 3.2,會將HFS+檔案系統轉換為APFS。[21]有測試表明APFS不支援32位元的裝置,例如iPhone 5[22]

第三方工具

Paragon軟件公司英語Paragon_Software_Group公司發佈了一個遵循四句版BSD許可證軟件開發套件,提供對APFS驅動器的唯讀訪問支援[23]。由Joachim Metz獨立開發的實現APFS驅動器唯讀訪問的開源實現libfsapfs按GNU寬通用公共許可證第三版發佈,並已打包到DebianFedora LinuxRocky LinuxRed Hat Enterprise LinuxUbuntu等Linux發行版的軟件倉庫。[24][25][26]上述兩個工具是命令列工具,不提供通常的檔案系統驅動程式介面。Linux上有一個名為apfs-fuse的用戶空間檔案系統驅動程式,能提供APFS驅動器的唯讀訪問支援。[27]還有名為「APFS for Linux」的專案正努力將APFS支援整合到Linux內核。[28]

Paragon軟件公司推出的商業軟件APFS for Windows對Windows 7到Windows 11及Windows Server 2008 R2到Windows Server 2022的所有版本提供APFS卷的讀寫支援,但不支援格式化或驗證APFS卷,也不能讀取受Apple T2安全晶片保護的加密APFS卷。[29]

參見

參考資料

  1. ^ Hansen, K.H.; Toolan, F. Decoding the APFS file system. Digital Investigation. 2017-09-21, 22: 107–132. ISSN 1742-2876. doi:10.1016/j.diin.2017.07.003. 
  2. ^ 2.0 2.1 Volume Format Comparison. Apple Developer. [2018-05-25]. (原始內容存檔於2017-09-05) (英語). 
  3. ^ Apple File System Guide / Frequently Asked Questions. [2018-05-25]. (原始內容存檔於2017-08-29). 
  4. ^ Bertin, René. Compression and APFS. Github. [2019-02-02]. (原始內容存檔於2020-10-21). 
  5. ^ Apple is upgrading millions of iOS devices to a new modern file system today. The Verge. 2017-03-27 [2017-04-02]. (原始內容存檔於2017-03-27). 
  6. ^ Roger Fingas. 'Apple File System' will scale from Apple Watch to Macs, replace HFS+. Apple Insider. June 13, 2016 [2016-06-23]. (原始內容存檔於2016-07-23). 
  7. ^ 7.0 7.1 7.2 7.3 Hutchinson, Lee. Digging into APFS, Apple's new file system. Ars Technica UK. 13 June 2016 [15 June 2016]. (原始內容存檔於2017-07-23). 
  8. ^ 进步与缺憾 资深开发者讲解苹果新文件系统. 威鋒網. [2016-06-29]. (原始內容存檔於2019-12-04). 
  9. ^ Weintraub, Seth. Apple File System (APFS) announced for 2017, scales ‘from Apple Watch to Mac Pro’ and focuses on encryption. 9to5Mac. 2016-06-13 [2017-04-02]. (原始內容存檔於2017-03-28). 
  10. ^ New file system spotted in macOS Sierra [Updated]. Ars Technica. [2017-04-02]. (原始內容存檔於2017-03-28) (美國英語). 
  11. ^ Updating your iPhone will give you one major benefit. JOE.co.uk. [2017-06-09]. (原始內容存檔於2017-05-20) (英語). 
  12. ^ Adam Leventhal. APFS in Detail: Data Integrity. June 19, 2016 [2016-06-23]. (原始內容存檔於2016-06-21). 
  13. ^ APFS in Detail: Data Integrity. dtrace.org. [2017-06-09]. (原始內容存檔於2016-06-21). 
  14. ^ A ZFS developer’s analysis of the good and bad in Apple’s new APFS file system. Ars Technica. [2017-01-28]. (原始內容存檔於2017-06-19) (美國英語). 
  15. ^ Harris, Robin. Why Apple's APFS won't last 30 years | ZDNet. ZDNet. [2017-01-28]. (原始內容存檔於2017-04-06) (英語). 
  16. ^ Tsai, Michael J. APFS's "Bag of Bytes' Filenames. mjtsai.com. [2017-06-09]. (原始內容存檔於2021-01-24) (英語). 
  17. ^ hoakley. APFS is currently unusable with most non-English languages. The Eclectic Light Company. 2017-04-06 [2017-06-09]. (原始內容存檔於2017-06-08). 
  18. ^ Inc., Apple. What's new in Apple File System - WWDC 2017 - Videos - Apple Developer. Apple Developer. [2017-08-03]. (原始內容存檔於2021-05-07) (美國英語). 
  19. ^ 在 Mac 上可以与时间机器配合使用的磁盘类型. Apple Support. [2020-07-15]. (原始內容存檔於2020-07-15) (中文(中國大陸)). 
  20. ^ APFS changes affect Time Machine in macOS Big Sur, encrypted drives in iOS 14. AppleInsider. [2020-07-15]. (原始內容存檔於2021-01-22) (英語). 
  21. ^ Clover, Juli. Apple Releases iOS 10.3 With Find My AirPods, APFS, App Store Review Tweaks and More. [2017-04-02]. (原始內容存檔於2017-03-27). 
  22. ^ Andrle, Tomas, TestIOSAPFSCheck: Trying to programmatically detect if filesystem is APFS, 2017-06-02 [2017-06-09] [永久失效連結]
  23. ^ Paragon Software Group Releases Free Paragon APFS SDK Community Edition for Software Developers, OEMs, Forensic Experts. Paragon Software Group.  GitHub
  24. ^ libyal/libfsapfs. GitHub. 7 November 2019. Library and tools to access the Apple File System (APFS) 
  25. ^ apfs-fuse - Fedora Packages. packages.fedoraproject.org. [2022-10-20]. 
  26. ^ apfs-fuse-20200928-1.el9.x86_64.rpm. rhel.pkgs.org. 
  27. ^ Ross, Alistair. How to mount macOS APFS disk volumes in Linux. The Ultimate Linux Newbie Guide. 23 February 2019.  (Github)
  28. ^ linux-apfs/linux-apfs-rw: APFS module for linux, with experimental write support. GitHub. APFS for Linux. 4 Feb 2022. 
  29. ^ APFS for Windows | Paragon Software. Paragon Software Group. [29 January 2024]. 

外部連結