Top Banner
© 2016 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple. A snapshot of the next generation in storage System Frameworks #WWDC16 Session 701 Introducing Apple File System Eric Tamura Manager, Local File Systems Dominic Giampaolo Senior Software Engineer, Storage / File Systems
160

Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Feb 15, 2019

Download

Documents

lythuan
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

© 2016 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple.

A snapshot of the next generation in storage

System Frameworks #WWDC16

Session 701

Introducing Apple File System

Eric Tamura Manager, Local File Systems Dominic Giampaolo Senior Software Engineer, Storage / File Systems

Page 2: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

What is Apple File System?

Page 3: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

What is Apple File System?

Introduction / Motivation

New Features

Demo

New APIs

Page 4: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

What is Apple File System?

Introduction / Motivation

New Features

Demo

New APIs

Page 5: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Apple File System

Page 6: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Introducing Apple File System (APFS)

Page 7: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Introducing Apple File System (APFS)

Next Generation File System

Page 8: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Introducing Apple File System (APFS)

Next Generation File System

Designed to scale from an Apple Watch to a Mac Pro

Page 9: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Introducing Apple File System (APFS)

Next Generation File System

Designed to scale from an Apple Watch to a Mac Pro

Designed to take advantage of flash / SSD storage

Page 10: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Introducing Apple File System (APFS)

Next Generation File System

Designed to scale from an Apple Watch to a Mac Pro

Designed to take advantage of flash / SSD storage

Engineered with encryption as a primary feature

Page 11: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

What about HFS+ ?Motivation

Page 12: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

What about HFS+ ?Motivation

Currently shipping HFS+ as primary file system

Page 13: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

What about HFS+ ?Motivation

Currently shipping HFS+ as primary file system… but its original design is over 30 years old.

Page 14: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

What about HFS+ ?Motivation

Currently shipping HFS+ as primary file system… but its original design is over 30 years old.Designed in an era where floppies and HDDs were state of the art

Page 15: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

What about HFS+ ?Motivation

Currently shipping HFS+ as primary file system… but its original design is over 30 years old.Designed in an era where floppies and HDDs were state of the artSingle-threaded data structures

Page 16: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

What about HFS+ ?Motivation

Currently shipping HFS+ as primary file system… but its original design is over 30 years old.Designed in an era where floppies and HDDs were state of the artSingle-threaded data structures Rigid data structures

Page 17: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Why a new file system?Motivation

Page 18: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Why a new file system?Motivation

Designed (and tuned) for Apple products and ecosystem

Page 19: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Why a new file system?Motivation

Designed (and tuned) for Apple products and ecosystemScale file system footprint to support Apple Watch up to Mac Pro

Page 20: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Why a new file system?Motivation

Page 21: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Why a new file system?Motivation

Enhance security capabilities

Page 22: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Why a new file system?Motivation

Enhance security capabilitiesAdd new features!

Page 23: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Current File System / Storage SW

Page 24: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Current File System / Storage SW

HFS (Standard)

Page 25: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Current File System / Storage SW

HFS (Standard)

HFS+

Page 26: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Current File System / Storage SW

HFS (Standard)

HFS+HFS+J

HFSX (Case Sensitive)

Page 27: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Current File System / Storage SW

HFS (Standard)

HFS+HFS+J

HFSX (Case Sensitive)CoreStorage

Fusion Drive

CoreStorage Full Disk Crypto

Page 28: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Current File System / Storage SW

HFS (Standard)

HFS+HFS+J

HFSX (Case Sensitive)CoreStorage

Fusion Drive

iOS/tvOS/watchOS HFS+

iOS/tvOS/watchOS HFS+ Per-File Crypto

CoreStorage Full Disk Crypto

Page 29: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Current File System / Storage SW

APFS

Page 30: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

What is Apple File System?

Introduction / Motivation

New Features

Demo

New APIs

Page 31: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

What is Apple File System?

Introduction / Motivation

New Features

Demo

New APIs

Page 32: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

What is Apple File System?

Improved file system fundamentals HFS compatibilitySpace sharingCloning files and directories Snapshots (and reversions)Fast directory sizingAtomic safe-save primitivesEncryption

Page 33: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

What is Apple File System?

Improved file system fundamentals HFS compatibilitySpace sharingCloning files and directories Snapshots (and reversions)Fast directory sizingAtomic safe-save primitivesEncryption

Page 34: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Improved File System Fundamentals

Page 35: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Improved File System Fundamentals

Flash / SSD-optimized

Page 36: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Improved File System Fundamentals

Flash / SSD-optimizedCrash-protected

Page 37: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Improved File System Fundamentals

Flash / SSD-optimizedCrash-protectedModern 64-bit native fields

Page 38: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Improved File System Fundamentals

Flash / SSD-optimizedCrash-protectedModern 64-bit native fieldsExtensible design for data structure growth

Page 39: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Improved File System Fundamentals

Flash / SSD-optimizedCrash-protectedModern 64-bit native fieldsExtensible design for data structure growthOptimized for Apple software ecosystem

Page 40: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Improved File System Fundamentals

Flash / SSD-optimizedCrash-protectedModern 64-bit native fieldsExtensible design for data structure growthOptimized for Apple software ecosystemLow-latency design

Page 41: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Improved File System Fundamentals

Flash / SSD-optimizedCrash-protectedModern 64-bit native fieldsExtensible design for data structure growthOptimized for Apple software ecosystemLow-latency design Native encryption support

Page 42: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

What is Apple File System?

Improved file system fundamentals HFS compatibilitySpace sharingCloning files and directories Snapshots (and reversions)Fast directory sizingAtomic safe-save primitivesEncryption

Page 43: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

What is Apple File System?

Improved file system fundamentals HFS compatibilitySpace sharingCloning files and directories Snapshots (and reversions)Fast directory sizingAtomic safe-save primitivesEncryption

Page 44: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

HFS Compatibility

Page 45: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

HFS Compatibility

Support and replace HFS+ functionality*

Page 46: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

What is Apple File System?

Improved file system fundamentals HFS compatibilitySpace sharingCloning files and directories Snapshots (and reversions)Fast directory sizingAtomic safe-save primitivesEncryption

Page 47: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

What is Apple File System?

Improved file system fundamentals HFS compatibilitySpace sharingCloning files and directories Snapshots (and reversions)Fast directory sizingAtomic safe-save primitivesEncryption

Page 48: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Space SharingGPT Header

Partition 0 - HFS+ Vol

Partition 2 - HFS+ Vol

LOLCAT.mp4

Partition 1 - HFS+ Vol

Page 49: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Space SharingGPT Header

Partition 0 - HFS+ Vol

Partition 2 - HFS+ Vol

LOLCAT.mp4

Partition 1 - HFS+ Vol

Page 50: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Space SharingGPT Header

Partition 0 - HFS+ Vol

Partition 2 - HFS+ Vol

LOLCAT.mp4

Partition 1 - HFS+ Vol

Page 51: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Space SharingGPT Header

Partition 0 - HFS+ Vol

LOLCAT.mp4

Partition 1 - HFS+ Vol

Page 52: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Space SharingGPT Header

Partition 0 - HFS+ Vol

Partition 2 - HFS+ Vol

Partition 1 - HFS+ Vol

LOLCAT.mp4

Page 53: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Space SharingGPT Header

Partition 0 - HFS+ Vol

Partition 2 - HFS+ Vol

Partition 1 - HFS+ Vol

LOLCAT.mp4

Page 54: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Space SharingGPT Header

Partition 0 - HFS+ Vol

Partition 1 - HFS+ Vol

LOLCAT.mp4

Page 55: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Space SharingGPT Header

Partition 0 - HFS+ Vol

Partition 1 - HFS+ Vol

LOLCAT.mp4

Page 56: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Space SharingGPT Header

Partition 0 - APFS ContainerVolume 0

Page 57: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Space SharingGPT Header

Partition 0 - APFS ContainerVolume 0

Page 58: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Volume 0

Space SharingGPT Header

Partition 0 - APFS ContainerVolume 0

Page 59: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Volume 0

Space SharingGPT Header

Partition 0 - APFS ContainerVolume 0

Volume 1

Page 60: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Volume 0

Space SharingGPT Header

Partition 0 - APFS ContainerVolume 0

Volume 1

Page 61: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

What is Apple File System?

Improved file system fundamentals HFS compatibilitySpace sharingCloning files and directories Snapshots (and reversions)Fast directory sizingAtomic safe-save primitivesEncryption

Page 62: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

What is Apple File System?

Improved file system fundamentals HFS compatibilitySpace sharingCloning files and directories Snapshots (and reversions)Fast directory sizingAtomic safe-save primitivesEncryption

Page 63: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Cloning Files and Directories

~eric/TOP_SECRET_APFS.key

SSD

Page 64: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Cloning Files and Directories

~eric/TOP_SECRET_APFS.key

~eric/Archive/TOP_SECRET_APFS.key

SSD

Page 65: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Cloning Files and Directories

~eric/TOP_SECRET_APFS.key

~eric/Archive/TOP_SECRET_APFS.key

SSD

Page 66: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Cloning Files and Directories

~eric/TOP_SECRET_APFS.key

~eric/Archive/TOP_SECRET_APFS.key

SSD

Page 67: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

What is Apple File System?

Improved file system fundamentals HFS compatibilitySpace sharingCloning files and directories Snapshots (and reversions)Fast directory sizingAtomic safe-save primitivesEncryption

Page 68: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

What is Apple File System?

Improved file system fundamentals HFS compatibilitySpace sharingCloning files and directories Snapshots (and reversions)Fast directory sizingAtomic safe-save primitivesEncryption

Page 69: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

File System Snapshots

SSD

~dbg/BikeRacing.key ~dbg/CoffeeOrigins.key

Page 70: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

File System Snapshots

SSD

Snapshot FS: /Volumes/Users/dbg

~dbg/BikeRacing.key ~dbg/CoffeeOrigins.key

Page 71: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

File System Snapshots

SSD

Snapshot FS: /Volumes/Users/dbg

~dbg/BikeRacing.key ~dbg/CoffeeOrigins.key

Page 72: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

File System Snapshots

SSD

Snapshot FS: /Volumes/Users/dbg

~dbg/BikeRacing.key ~dbg/CoffeeOrigins.key

Page 73: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

File System Snapshots

SSD

Snapshot FS: /Volumes/Users/dbg

~dbg/BikeRacing.key

Page 74: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Reverting to a Snapshot

SSD

Snapshot FS: /Volumes/Users/dbg

~dbg/BikeRacing.key

Page 75: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Reverting to a Snapshot

SSD

Snapshot FS: /Volumes/Users/dbg

~dbg/BikeRacing.key ~dbg/CoffeeOrigins.key

Page 76: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

What is Apple File System?

Improved file system fundamentals HFS compatibilitySpace sharingCloning files and directories Snapshots (and reversions)Fast directory sizingAtomic safe-save primitivesEncryption

Page 77: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

What is Apple File System?

Improved file system fundamentals HFS compatibilitySpace sharingCloning files and directories Snapshots (and reversions)Fast directory sizingAtomic safe-save primitivesEncryption

Page 78: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Fast Directory Sizing

Page 79: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Fast Directory Sizing

How much space does a directory hierarchy use?

Page 80: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Fast Directory Sizing

How much space does a directory hierarchy use?Users would like to know the answer quickly

Page 81: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs
Page 82: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Fast Directory Sizing

Page 83: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Fast Directory Sizing

The file system could keep track of this…

Page 84: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Fast Directory Sizing

The file system could keep track of this…But keeping track in the file system has one main issue:

Page 85: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Fast Directory Sizing

The file system could keep track of this…But keeping track in the file system has one main issue:• How do you safely update your parent and its parent (and so on…)

Page 86: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Fast Directory Sizing

The file system could keep track of this…But keeping track in the file system has one main issue:• How do you safely update your parent and its parent (and so on…)• Locking child -> parent is a locking order violation in file systems

Page 87: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Fast Directory Sizing

The file system could keep track of this…But keeping track in the file system has one main issue:• How do you safely update your parent and its parent (and so on…)• Locking child -> parent is a locking order violation in file systems

APFS side-steps the problem!

Page 88: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Fast Directory Sizing

The file system could keep track of this…But keeping track in the file system has one main issue:• How do you safely update your parent and its parent (and so on…)• Locking child -> parent is a locking order violation in file systems

APFS side-steps the problem!• Store the size separately

Page 89: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Fast Directory Sizing

The file system could keep track of this…But keeping track in the file system has one main issue:• How do you safely update your parent and its parent (and so on…)• Locking child -> parent is a locking order violation in file systems

APFS side-steps the problem!• Store the size separately• Use atomic operations to update the size

Page 90: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Fast Directory Sizing

The file system could keep track of this…But keeping track in the file system has one main issue:• How do you safely update your parent and its parent (and so on…)• Locking child -> parent is a locking order violation in file systems

APFS side-steps the problem!• Store the size separately• Use atomic operations to update the size• Small incremental cost (extra records)

Page 91: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

What is Apple File System?

Improved file system fundamentals HFS compatibilitySpace sharingCloning files and directories Snapshots (and reversions)Fast directory sizingAtomic safe-save primitivesEncryption

Page 92: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

What is Apple File System?

Improved file system fundamentals HFS compatibilitySpace sharingCloning files and directories Snapshots (and reversions)Fast directory sizingAtomic safe-save primitivesEncryption

Page 93: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Atomic Safe-Save (rename)

~dbg/MakeMoneyFast.key

Page 94: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Atomic Safe-Save (rename)

~dbg/MakeMoneyFast.key /var/tmp/MakeMoneyFast.key

Page 95: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Atomic Safe-Save (rename)

~dbg/MakeMoneyFast.key /var/tmp/MakeMoneyFast.key

Page 96: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Atomic Safe-Save (rename)

~dbg/MakeMoneyFast.key

Page 97: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Non-Atomic Safe-Save (directory)

~dbg/ClutchConcertReview.rtfd

Page 98: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Non-Atomic Safe-Save (directory)

/var/tmp/ClutchConcertReview.rtfd~dbg/ClutchConcertReview.rtfd

Page 99: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Non-Atomic Safe-Save (directory)

/var/tmp/ClutchConcertReview.rtfd~dbg/ClutchConcertReview.rtfd

Page 100: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Non-Atomic Safe-Save (directory)

/var/tmp/ClutchConcertReview.rtfd~dbg/ClutchConcertReview.rtfd

Page 101: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Non-Atomic Safe-Save (directory)

~dbg/ClutchConcertReview.rtfd

Page 102: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Non-Atomic Safe-Save (directory)

~dbg/ClutchConcertReview.rtfd

Page 103: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Atomic Safe-Save (renamex_np)

~dbg/ClutchConcertReview.rtfd

Page 104: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Atomic Safe-Save (renamex_np)

/var/tmp/ClutchConcertReview.rtfd~dbg/ClutchConcertReview.rtfd

Page 105: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Atomic Safe-Save (renamex_np)

/var/tmp/ClutchConcertReview.rtfd~dbg/ClutchConcertReview.rtfd

Page 106: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Atomic Safe-Save (renamex_np)

/var/tmp/ClutchConcertReview.rtfd~dbg/ClutchConcertReview.rtfd

Page 107: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Atomic Safe-Save (renamex_np)

~dbg/ClutchConcertReview.rtfd

Page 108: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

What is Apple File System?

Improved file system fundamentals HFS compatibilitySpace sharingCloning files and directories Snapshots (and reversions)Fast directory sizingAtomic safe-save primitivesEncryption

Page 109: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

What is Apple File System?

Improved file system fundamentals HFS compatibilitySpace sharingCloning files and directories Snapshots (and reversions)Fast directory sizingAtomic safe-save primitivesEncryption

Page 110: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Encryption (HFS+)

Page 111: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Encryption (HFS+)

HFS+ relies on CoreStorage to provide Full Disk Encryption on Macs

Page 112: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Encryption (HFS+)

HFS+ relies on CoreStorage to provide Full Disk Encryption on MacsiOS uses an HFS+ variant that supports per-file keys in conjunction withaccelerated AES hardware

Page 113: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Encryption (APFS)

Page 114: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Encryption (APFS)

APFS supports multiple levels of file system encryption

Page 115: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Encryption (APFS)

APFS supports multiple levels of file system encryption• No encryption

Page 116: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Encryption (APFS)

APFS supports multiple levels of file system encryption• No encryption• One key per Volume (metadata and data)

Page 117: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Encryption (APFS)

APFS supports multiple levels of file system encryption• No encryption• One key per Volume (metadata and data)• Multi-Key Encryption

Page 118: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Encryption (APFS)

APFS supports multiple levels of file system encryption• No encryption• One key per Volume (metadata and data)• Multi-Key Encryption

- Metadata Encryption

Page 119: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Encryption (APFS)

APFS supports multiple levels of file system encryption• No encryption• One key per Volume (metadata and data)• Multi-Key Encryption

- Metadata Encryption- Per-File Encryption

Page 120: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Encryption (APFS)

APFS supports multiple levels of file system encryption• No encryption• One key per Volume (metadata and data)• Multi-Key Encryption

- Metadata Encryption- Per-File Encryption- Per-Extent Encryption

Page 121: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Encryption (APFS)

APFS supports multiple levels of file system encryption• No encryption• One key per Volume (metadata and data)• Multi-Key Encryption

- Metadata Encryption- Per-File Encryption- Per-Extent Encryption

APFS unifies the file system encryption software across all of our platforms

Page 122: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

DemoCloning and Snapshots / APFS on macOS 10.12

Page 123: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

What is Apple File System?

Introduction / Motivation

New Features

Demo

New APIs

Page 124: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

What is Apple File System?

Introduction / Motivation

New Features

Demo

New APIs

Page 125: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Enhanced APIsFoundation / FileManager (Swift)

Automatically adopts our new cloning and safe-save behavior

func copyItem(atPath srcPath: String, toPath dstPath: String) throws

func replaceItem(at originalItemURL: URL, withItemAt newItemURL: URL, backupItemName backupItemName: String?, options options: FileManager.ItemReplacementOptions = [], resultingItemURL resultingURL: AutoreleasingUnsafeMutablePointer<NSURL?>?) throws

Page 126: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Enhanced APIslibcopyfileCoreOS library for copying deep hierarchies—supports cloning!Slightly above the POSIX layerNew flags added

#include <copyfile.h>

int copyfile(const char *from, const char *to, copyfile_state_t state, copyfile_flags_t flags);

int fcopyfile(int from_fd, int to_fd, copyfile_state_t, copyfile_flags_t flags);

new flag bit: COPYFILE_CLONE Equivalent to (COPYFILE_EXCL | COPYFILE_ACL | COPYFILE_STAT | COPYFILE_XATTR | COPYFILE_DATA)

Page 127: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

New APIsSafe-Save APIs

New system calls

#include <stdio.h>

int renamex_np(const char *, const char *, unsigned int)

int renameatx_np(int, const char *, int, const char *, unsigned int)

Page 128: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

New APIsCloning APIs

New file/directory cloning system calls

#include <sys/attr.h> #include <sys/clonefile.h>

int clonefileat(int, const char *, int, const char *, uint32_t);

int fclonefileat(int, int, const char *, uint32_t);

int clonefile(const char *, const char *, uint32_t);

Page 129: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Compatibility

apple.com

Page 130: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Compatibility

apple.com

hdiutil (disk image tool)

hdiutil create -fs APFS -size 1GB foo.sparseimage

Page 131: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Compatibility

apple.com

hdiutil (disk image tool)

hdiutil create -fs APFS -size 1GB foo.sparseimage

diskutil apfs …

diskutil apfs createContainer /dev/disk1s1

diskutil apfs addVolume disk1s1 APFS newAPFS

Page 132: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Compatibility

apple.com

hdiutil (disk image tool)

hdiutil create -fs APFS -size 1GB foo.sparseimage

diskutil apfs …

diskutil apfs createContainer /dev/disk1s1

diskutil apfs addVolume disk1s1 APFS newAPFS

fsck_apfs (APFS File System Check/Repair)

Page 133: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Current Limitations of APFS in macOS Sierra

Page 134: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Current Limitations of APFS in macOS Sierra

Data volumes only

Page 135: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Current Limitations of APFS in macOS Sierra

Data volumes onlyTime Machine backups with APFS

Page 136: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Current Limitations of APFS in macOS Sierra

Data volumes onlyTime Machine backups with APFSFileVault / Fusion Drive Support

Page 137: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Current Limitations of APFS in macOS Sierra

Data volumes onlyTime Machine backups with APFSFileVault / Fusion Drive SupportCase-sensitive

Page 138: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Compatibility

Page 139: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Compatibility

APFS cannot be shared over AFP (Use SMB instead)

Page 140: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Compatibility

APFS cannot be shared over AFP (Use SMB instead)OS X Yosemite or earlier will not recognize Apple File System volumes

Page 141: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Developer Preview availablein macOS Sierra 10.12

Page 142: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Rollout Plan

Page 143: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Upgrading to APFS

Page 144: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Upgrading to APFS

Apple will provide an in-place upgrade path for HFS+ to APFS

Page 145: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Upgrading to APFS

Apple will provide an in-place upgrade path for HFS+ to APFS User data remains in place

Page 146: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Upgrading to APFS

Apple will provide an in-place upgrade path for HFS+ to APFS User data remains in place Write the new APFS metadata into HFS+’s free space

Page 147: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Shipping in 2017

Page 148: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Summary

Page 149: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Summary

APFS will be the default file system for all Apple products in 2017

Page 150: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Summary

APFS will be the default file system for all Apple products in 2017Ultra-modern, crash-protected, space-sharing

Page 151: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Summary

APFS will be the default file system for all Apple products in 2017Ultra-modern, crash-protected, space-sharingSupports cloning, snapshots, enhanced data security features

Page 152: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Summary

APFS will be the default file system for all Apple products in 2017Ultra-modern, crash-protected, space-sharingSupports cloning, snapshots, enhanced data security featuresTuned and designed for the Apple ecosystem

Page 153: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

More Information

https://developer.apple.com/wwdc16/701

Page 154: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Takeaways

Page 155: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Takeaways

APFS is coming soon

Page 156: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Takeaways

APFS is coming soonPlease test your apps against APFS with the WWDC macOS build (and run them on APFS)

Page 157: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Takeaways

APFS is coming soonPlease test your apps against APFS with the WWDC macOS build (and run them on APFS) Please report any bugs you encounter via bugreporter so we can investigate

Page 158: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Related Sessions

How iOS Security Really Works Nob Hill Tuesday 4:00PM

Page 159: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs

Labs

File Systems Lab Frameworks Lab C Tuesday 12:30 PM

Page 160: Introducing Apple File System · What is Apple File System? Introduction / Motivation New Features Demo New APIs