![apfs文件系统](https://i-blog.csdnimg.cn/blog_migrate/af383d80f4d14f228766e0ad3b08a3c7.png)
apfs文件系统
![](https://i-blog.csdnimg.cn/blog_migrate/20abce9649b467bbf95a83e771f55561.png)
Apple’s macOS 10.13 High Sierra brings a new file system named “Apple File System”, which largely replaces the older HFS+ file system. Apple File System, also known as APFS, has been used by default on iPhones and iPads since iOS 10.3, and is also used on the Apple Watch and Apple TV—but now it’s finally on the Mac, too.
苹果的macOS 10.13 High Sierra带来了一个名为“苹果文件系统”的新文件系统,该文件系统在很大程度上替代了较旧的HFS +文件系统。 自iOS 10.3起,Apple File System(也称为APFS)已在iPhone和iPad上默认使用,也已在Apple Watch和Apple TV上使用,但现在终于在Mac上使用了。
如何获取苹果文件系统 (How to Get the Apple File System)
You don’t have to do anything special to switch your Mac to the new APFS file system. Just upgrade to macOS 10.13 High Sierra. The upgrade process will automatically migrate your Mac’s internal drive from HFS+ to APFS, assuming your Mac’s internal drive is an SSD or another all-flash storage device.
您无需执行任何特殊操作即可将Mac切换到新的APFS文件系统。 只需升级到macOS 10.13 High Sierra。 假设Mac的内部驱动器是SSD或其他全闪存存储设备,升级过程将自动将Mac的内部驱动器从HFS +迁移到APFS。
This process is automatic. On a Mac with all flash storage, the internal partitions will be migrated from HFS+ (also known as “Mac OS Extended”) to APFS. There’s no way to opt out of this conversion.
这个过程是自动的 。 在具有所有闪存的Mac上,内部分区将从HFS +(也称为“ Mac OS Extended”)迁移到APFS。 无法选择退出此转换。
Fusion Drives (which incorporate both flash and traditional magnetic storage), traditional hard disk drives, and non-Mac volumes (like Windows Boot Camp volumes) won’t be migrated. While APFS doesn’t work on Fusion Drives at the moment, Apple plans to enable APFS on Fusion Drives in the future.
Fusion Drive (融合了闪存和传统磁存储功能),传统硬盘驱动器和非Mac卷(例如Windows Boot Camp卷)将不会迁移。 虽然APFS目前无法在Fusion Drives上运行,但Apple 计划将来在Fusion Drives上启用APFS。
External drives, including USB drives and SD cards, will also not be migrated to APFS. You can choose to format an external drive as APFS with Disk Utility. However, other file systems are recommended. For example, exFAT offers greater compatibility with Windows and other devices. Mac OS X Extended offers compatibility with High Sierra as well as Macs running older versions of the macOS operating system.
包括USB驱动器和SD卡在内的外部驱动器也不会迁移到APFS。 您可以选择使用“磁盘工具”将外部驱动器格式化为APFS。 但是,建议使用其他文件系统。 例如, exFAT提供了与Windows和其他设备的更大兼容性 。 Mac OS X Extended提供与High Sierra以及运行旧版macOS操作系统的Mac的兼容性。
Your Time Machine drive can’t be formatted APFS yet, either. Time Machine can back up from an APFS drive, but the Time Machine destination drive must be formatted as HFS+. The operating system will handle this all automatically—just don’t try to convert your Time Machine disk manually and you’ll be fine.
您的Time Machine驱动器也无法格式化APFS。 Time Machine可以从APFS驱动器备份,但是Time Machine目标驱动器必须格式化为HFS +。 操作系统将自动处理所有这一切-只需不要尝试手动转换Time Machine磁盘,就可以了。
APFS的好处 (The Benefits of APFS)
So why care about APFS at all? It comes with a number of advantages over HFS+, most notably performance and reliability, with a few improvements to encryption and partitions as well.
那么,为什么要完全关心APFS? 与HFS +相比,它具有许多优势,尤其是性能和可靠性,还对加密和分区进行了一些改进。
性能提升 (Performance Increases)
You won’t see any new whiz-bang features with a new file system, but you will see a variety of under-the-hood improvements. For example, you’ll see improved performance in some file operations.
您不会在新文件系统中看到任何新的“神往”功能,但会看到各种底层改进。 例如,您将在某些文件操作中看到提高的性能。
Faster directory sizing may actually be noticeable. When you click the “Get Info” button for a large folder, you’ll see the folder’s total file size noticeably sooner. That’s because APFS stores metadata about the sizes of files in a place where it can be accessed more quickly, whereas HFS+ made the operating system examine the metadata of each individual file one by one.
实际上,更快的目录大小调整可能很明显。 单击大文件夹的“获取信息”按钮时,您会很快看到该文件夹的总文件大小。 这是因为APFS将有关文件大小的元数据存储在一个可以更快访问的位置,而HFS +使操作系统可以逐个检查每个文件的元数据。
Copying files will also be faster. Let’s say you copy a file from one folder to another. Rather than simply creating a second copy of that file’s data on the disk, APFS creates a marker that says there are two files on the disk that point to the same data. This means that the copy operation should happen immediately. If you modify one of the two files, APFS will store both the original and changed file, and everything will work like you expect it to. It’s just faster and more efficient under the hood.
复制文件也将更快。 假设您将文件从一个文件夹复制到另一个文件夹。 APFS不仅仅是在磁盘上创建该文件数据的第二个副本,还创建了一个标记,指出磁盘上有两个文件指向同一数据。 这意味着复制操作应立即进行。 如果您修改两个文件之一,则APFS将同时存储原始文件和更改后的文件,并且一切将按预期运行。 它在引擎盖下更快,更高效。
Performance when creating “sparse files” is also improved. In other words, if an application creates a large file that’s empty, this is now much faster. With HFS+, an application creating a 5 GB file would have to wait while the operating system wrote 5 GB of zeroes of the disk. With APFS, the file system marks the space as allocated but doesn’t write to it immediately, so this should now be nearly instantaneous.
创建“稀疏文件”时的性能也得到了改善。 换句话说,如果应用程序创建的大文件为空,则现在速度更快。 使用HFS +,创建5 GB文件的应用程序将不得不等待操作系统写入5 GB的磁盘零。 使用APFS,文件系统会将空间标记为已分配,但不会立即写入该空间,因此现在应该几乎是瞬时的。
![](https://i-blog.csdnimg.cn/blog_migrate/aa615e3946eeb737ba4c223ae4ad4e4c.png)
可靠性和数据完整性改进 (Reliability and Data Integrity Improvements)
Apple’s new file system is more resistant to data corruption due to bugs and power failures, too.
苹果的新文件系统也更能抵抗由于错误和电源故障引起的数据损坏。
APFS uses “copy-on-write”. For example, when you update a file’s metadata—like its file name, for example—the HFS+ file system will directly modify that metadata. If your Mac crashes of the power goes out before the operation is finished, data corruption may occur. With APFS, when you modify a file’s metadata, APFS will create a new copy of the metadata. APFS points the original file at that metadata only after the new metadata is written, so there’s no risk of the metadata being corrupted. This feature is also found in other modern file systems, like ZFS and BtrFS on Linux and ReFS on Windows.
APFS使用“写时复制”。 例如,当您更新文件的元数据(例如文件名)时,HFS +文件系统将直接修改该元数据。 如果在操作完成之前Mac的电源崩溃了,则可能会发生数据损坏。 使用APFS,当您修改文件的元数据时,APFS将创建元数据的新副本。 APFS仅在写入新的元数据之后才将原始文件指向该元数据,因此不存在元数据被破坏的风险。 在其他现代文件系统中也可以找到此功能,例如Linux 上的 ZFS和BtrFS以及Windows 上的 ReFS 。
Apple File System also uses something called “Atomic Safe-Save”, which is like copy-on-write but applies to other file operations, including renaming a file or moving it.
苹果文件系统还使用一种称为“原子安全保存”的方法,类似于写时复制,但适用于其他文件操作,包括重命名文件或移动文件。
Reliability is also improved thanks to APFS creating and storing checksums associated with data on the disk. When APFS writes a file to disk, it examines the file, runs it through a mathematical formula that generates a shorter string that matches the file, and writes that to disk as well. When APFS reads data, it compares the data to the checksum on disk and verifies it matches. If the data doesn’t match the checksum on disk, this indicates data corruption. It could be due to a bug, hardware failure, or something else—but the operating system can recognize it immediately.
由于APFS在磁盘上创建并存储了与数据关联的校验和,因此可靠性也得到了提高。 当APFS将文件写入磁盘时,它将检查文件,并通过数学公式运行该文件,该数学公式生成与文件匹配的较短字符串,并将其也写入磁盘。 APFS读取数据时,会将数据与磁盘上的校验和进行比较,并验证其是否匹配。 如果数据与磁盘上的校验和不匹配,则表明数据已损坏。 可能是由于错误,硬件故障或其他原因所致,但是操作系统可以立即识别出它。
其他新功能 (Other New Features)
This file system also lays the groundwork for new features and other improvements, which can build on what APFS offers.
该文件系统还为可以基于APFS提供的功能的新功能和其他改进奠定了基础。
For example, APFS incorporates snapshots at the file system level. The first snapshot contains a complete picture of the entire drive, while future snapshots only contain the changes made since the previous snapshot. Only new data you’ve added takes up space. Time Machine works similarly, but APFS’s snapshots are even more efficient. Time Machine doesn’t yet use APFS, but Apple could move Time Machine to APFS in a future release of macOS.
例如,APFS在文件系统级别合并快照。 第一个快照包含整个驱动器的完整图片,而以后的快照仅包含自上一个快照以来所做的更改。 仅添加的新数据会占用空间。 Time Machine的工作原理与此类似,但是APFS的快照效率更高。 Time Machine尚未使用APFS,但Apple可以在将来的macOS版本中将Time Machine移至APFS。
APFS also supports multi-key encryption, which allows for different keys used to encrypt different data on the hard drive. The way FileVault encryption works hasn’t changed yet, but one day macOS could use different encryption passphrases for each user’s data and the system data.
APFS还支持多密钥加密,这允许使用不同的密钥来加密硬盘驱动器上的不同数据。 FileVault加密的工作方式尚未改变,但是有一天macOS可以对每个用户的数据和系统数据使用不同的加密密码。
“Space sharing” is one new feature some people will benefit from today. Traditionally, if you created multiple volumes (partitions) on one physical disk, you had to decide up front how much space each volume would get. So, you might create five different 100 GB volumes on a 500 GB drive. If any of those volumes needed more than 100 GB of space, you’d have to manually resize the volumes. However, if one volume just needed 20 GB of space, you’d have 80 GB of space wasted—unless you resized the volume and then allocated that space to another volume. With APFS, you could create five volumes on a 500 GB drive and not worry about how much each one needs. The volumes will share space. As long as the total space used by those five volumes is less than the 500 GB of total available space, things will just work.
“空间共享”是当今某些人将从中受益的一项新功能。 传统上,如果您在一个物理磁盘上创建了多个卷(分区),则必须预先决定每个卷将获得多少空间。 因此,您可以在500 GB的驱动器上创建五个不同的100 GB的卷。 如果其中任何一个卷需要超过100 GB的空间,则必须手动调整卷的大小。 但是,如果一个卷仅需要20 GB的空间,则您将浪费80 GB的空间-除非您调整该卷的大小,然后将该空间分配给另一个卷。 使用APFS,您可以在500 GB的驱动器上创建五个卷,而不必担心每个卷需要多少容量。 这些卷将共享空间。 只要这五个卷使用的总空间小于可用总空间的500 GB,事情就可以正常工作。
More technical information about APFS is available on Apple’s developer website.
有关APFS的更多技术信息,请访问Apple的开发人员网站 。
关于使用APFS,我需要了解什么? (What Do I Need to Know About Using APFS?)
The switch to APFS should be largely transparent. Your drive will be migrated automatically if APFS supports it. Time Machine and File Vault still work normally.
切换到APFS应该在很大程度上是透明的。 如果APFS支持,则驱动器将自动迁移。 Time Machine和File Vault仍然正常工作。
Some problems do exist with Boot Camp, however. A Windows system installed alongside macOS can’t yet read APFS, even with Apple’s Boot Camp software installed. This means you can’t use the Boot Camp Control Panel to change your startup disk from within Windows at the moment. To reboot back into macOS, hold down the Option key while booting your PC and choose macOS. You can still control your startup disk from System Preferences > Startup Disk in macOS. Apple will hopefully fix this at some point soon.
但是, Boot Camp确实存在一些问题。 即使安装了Apple的Boot Camp软件,与macOS一起安装的Windows系统仍无法读取APFS。 这意味着您目前无法使用Boot Camp控制面板在Windows中更改启动磁盘。 要重新引导回macOS,请在引导PC时按住Option键,然后选择macOS。 您仍然可以通过macOS中的“系统偏好设置”>“启动磁盘”来控制启动磁盘。 苹果有望在某个时候解决此问题。
![](https://i-blog.csdnimg.cn/blog_migrate/6a09006cd72ff424e59d70ec65e53146.png)
When using the Disk Utility application (available at Finder > Applications > Utilities > Disk Utility), you’ll likely see that your Mac’s drive is APFS (unless it’s a Fusion Drive or mechanical hard drive which wasn’t migrated).
使用“磁盘工具”应用程序(位于“查找器”>“应用程序”>“实用工具”>“磁盘工具”中)时,您可能会看到Mac的驱动器是APFS(除非它是未迁移的Fusion Drive或机械硬盘驱动器)。
Thanks to space sharing, even if you have a single volume (partition) on your drive like most people, your drive is formatted with an APFS container that can hold multiple volumes. That’s why you’ll see that it’s shared by multiple volumes here.
多亏了空间共享,即使您像大多数人一样在驱动器上只有一个卷(分区),您的驱动器也会使用可容纳多个卷的APFS容器进行格式化。 这就是为什么您会在这里看到它被多个卷共享的原因。
![](https://i-blog.csdnimg.cn/blog_migrate/c3563af506ec58cec7b0e24d0496a5f2.png)
To add a new volume, click the “New Volume” button. This will add new volumes to the larger APFS container. They’ll appear just like normal volumes or partitions in Finder and elsewhere on the system, but they’ll share space with all the other volumes in the APFS container.
要添加新卷,请单击“新卷”按钮。 这会将新卷添加到更大的APFS容器中。 它们将看起来像Finder中以及系统中其他位置的普通卷或分区一样,但是它们将与APFS容器中的所有其他卷共享空间。
Don’t use the “Partition” button to add a new partition unless you want to add a new, non-APFS volume to your system. Adding a new partition will take space away from the APFS container. However, it is mandatory when adding a Windows volume for Boot Camp, for example.
除非您要向系统中添加新的非APFS卷,否则请不要使用“分区”按钮添加新分区。 添加新分区将占用APFS容器的空间。 但是,例如,在为Boot Camp添加Windows卷时,它是必需的。
![](https://i-blog.csdnimg.cn/blog_migrate/58790a1812b580ba496ff8004cdd535f.png)
You still have some control over the size of your APFS volumes. When creating a new APFS volume, you can click the “Size Options” button and specify a reserve size (minimum size) and quota size (maximum size) for the volume, ensuring it won’t become too small or too large. This isn’t necessary, of course—APFS works automatically even if you don’t specify these options. They just exist if you want that extra control.
您仍然可以控制APFS卷的大小。 创建新的APFS卷时,可以单击“大小选项”按钮,并为该卷指定保留大小(最小大小)和配额大小(最大大小),以确保它不会变得太小或太大。 当然,这不是必需的-即使您未指定这些选项,APFS也会自动运行。 它们只是存在,如果您想要额外的控制。
![](https://i-blog.csdnimg.cn/blog_migrate/cb96094d54cc3223c112830d857c0018.png)
The switch to APFS won’t be noticed by most Mac users, but it lays the groundwork for future improvements, boosts performance in some situations, and helps protect against data corruption. It also moves macOS to the same file system already in use by Apple’s other operating system, iOS.
大多数Mac用户不会注意到切换到APFS的情况,但这为将来的改进打下了基础,在某些情况下可以提高性能,并有助于防止数据损坏。 它还将macOS移至Apple的其他操作系统iOS已使用的相同文件系统。
翻译自: https://www.howtogeek.com/327328/apfs-explained-what-you-need-to-know-apples-new-file-system/
apfs文件系统