Giter VIP home page Giter VIP logo

linux-apfs-oot's Introduction

Apple File System
=================

The Apple File System (APFS) is a copy-on-write filesystem apparently intended
to replace HFS+ on all Apple devices in the near future. This module provides
a degree of experimental read-only support on Linux.

This repo is a standalone version of <git://github.com/eafer/linux-apfs.git>
for the purpose of making it easier to build the module out-of-tree. It is
supposed to work with a range of kernel versions starting at 4.9 or before, but
only a few of those have actually been tested. If you run into any problem,
please send a report to <[email protected]>.

The long-term goal is to support writes as well. To help with testing, a set
of userland tools is under development. The git tree can be retrieved from
<git://github.com/eafer/apfsprogs.git>.

Known limitations
=================

This module is the result of reverse engineering. As it is read-only there
should be no risk of data corruption, but do not expect everything to be read
correctly. Testing in general has been limited so far, so you may experience
crashes. Please report any issues that you find.

Apple has released other versions of the filesystem to the public before the
current one. I would not expect them to be compatible with this module at all,
but I am open to fixing that if requested.

Many features are not yet supported:

 o Encryption.
 o Compression, though the compressed contents of a file can be read from the
   'com.apple.decmpfs' and 'com.apple.ResourceFork' xattrs as long as they are
   under 64k.
 o Restoring to a snapshot.
 o Access control lists. This is not a priority.

Build
=====

In order to build a module out-of-tree, you will first need the Linux kernel
headers. On Debian, you can get them by running (as root):

  apt-get install linux-headers-$(uname -r)

Now you can just cd to the linux-apfs-oot directory and run

  make

The resulting module is the apfs.ko file. Before you can use it you must insert
it into the kernel, as well as its dependencies. Again as root:

  modprobe libcrc32c
  insmod apfs.ko

Mount
=====

Like all filesystems, apfs is mounted with

  mount [-o options] device dir

where 'device' is the path to your device file or filesystem image, and 'dir'
is the mount point. The following options are accepted:

  vol=n
	Volume number to mount. The default is volume 0.

  uid=n, gid=n
	Override on-disk inode ownership data with given uid/gid.

  cknodes
	Verify the checksum on all metadata nodes. Right now this has
	a severe performance cost, so it's not recommended.

So for instance, if you want to mount volume number 2, and you want the metadata
to be checked, you should run (as root):

  mount -o cknodes,vol=2 device dir

To unmount it, run

  umount dir

Credits
=======

Originally written by Ernesto A. Fernández <[email protected]>,
with several contributions from Gabriel Krisman Bertazi <[email protected]>
and Arnaud Ferraris <[email protected]>.

Work was first based on reverse engineering done by others [1][2], and later
on the (very incomplete) official specification [3]. Some parts of the code
imitate the ext2 module, and to a lesser degree xfs, udf, gfs2 and hfsplus.

[1] Hansen, K.H., Toolan, F., Decoding the APFS file system, Digital
    Investigation (2017), http://dx.doi.org/10.1016/j.diin.2017.07.003
[2] https://github.com/sgan81/apfs-fuse
[3] https://developer.apple.com/support/apple-file-system/Apple-File-System-Reference.pdf

linux-apfs-oot's People

Contributors

binex-dsk avatar eafer avatar luflosi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

linux-apfs-oot's Issues

mounting throws no error, but nothing happened

$? returns 0
when running
mount -o vol=0 /dev/sdc2 /mnt/osx_sys_highsierra/

but "mount" shows no new mount and mountpoint is empty, tried it vor volumes 0 -3, the 4th and up throws an error, kernel 5.2.9-arch1-1-ARCH

APFS parity

It seems that sgan81/apfs-fuse supports both encryption (full disk) and compression (except LZFSE). Any plans to port these over?

Mounting APFS Fusion Drive?

Is it possible to mount an APFS Fusion Drive using this yet? You may want to look into how bcache implemented the binding of two devices into one for its cache system.

p.s. This is AFAIK the only Linux kernel filesystem module that supports easy automatic tiered filesystem, and it also have good feature parity with btrfs (too bad btrfs lacked tiering - it even struggles on top of bcache.) When this matures to the point of supporting both read/write access and Fusion Drive, I would seriously consider migrate my Linux boxes to this, as all of them have hybrid SSD and HDD setups, and bcache is wasteful for medium capacity SSD's.

Error building on Arch Linux

Just upgraded my system (i'm using Arch Linux), and got an error with this module:

==> dkms install --no-depmod -m linux-apfs -v 0.1 -k 5.8.0-arch1-1
Error! Bad return status for module build on kernel: 5.8.0-arch1-1 (x86_64)
Consult /var/lib/dkms/linux-apfs/0.1/build/make.log for more information.
==> Warning, `dkms install --no-depmod -m linux-apfs -v 0.1 -k 5.8.0-arch1-1' returned 10

Make.log is this:

DKMS make.log for linux-apfs-0.1 for kernel 5.8.0-arch1-1 (x86_64)
Tue Aug 4 13:26:17 EDT 2020
make: Entering directory '/usr/lib/modules/5.8.0-arch1-1/build'
AR /var/lib/dkms/linux-apfs/0.1/build/built-in.a
CC [M] /var/lib/dkms/linux-apfs/0.1/build/btree.o
CC [M] /var/lib/dkms/linux-apfs/0.1/build/dir.o
CC [M] /var/lib/dkms/linux-apfs/0.1/build/extents.o
CC [M] /var/lib/dkms/linux-apfs/0.1/build/file.o
CC [M] /var/lib/dkms/linux-apfs/0.1/build/inode.o
CC [M] /var/lib/dkms/linux-apfs/0.1/build/key.o
CC [M] /var/lib/dkms/linux-apfs/0.1/build/message.o
CC [M] /var/lib/dkms/linux-apfs/0.1/build/namei.o
/var/lib/dkms/linux-apfs/0.1/build/inode.c: In function 'apfs_readpages':
/var/lib/dkms/linux-apfs/0.1/build/inode.c:31:9: error: implicit declaration of function 'mpage_readpages'; did you mean 'mpage_readpage'? [-Werror=implicit-function-declaration]
31 | return mpage_readpages(mapping, pages, nr_pages, apfs_get_block);
  |         ^~~~~~~~~~~~~~~
  |         mpage_readpage
cc1: some warnings being treated as errors
make[1]: *** [scripts/Makefile.build:281: /var/lib/dkms/linux-apfs/0.1/build/inode.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1756: /var/lib/dkms/linux-apfs/0.1/build] Error 2
make: Leaving directory '/usr/lib/modules/5.8.0-arch1-1/build'

Why is this happening?

bad node only when mounting volume 0

Volumes 1-3 work fine to mount and are browsable, but when trying to mount volume 0 I get this error:

bad node in block 0xad22
unable to read catalog root node

apfsck -uw /dev/nvme0n1p2 returns

Container keybag: odd inconsistency (may not be corruption).
Volume superblock: unknown optional feature

I don't find much in udev apart from the previously metioned unable to read catalog root node.

I'm on kernel 5.6.0-rc4-1-mainline on a MBP 2019 16,1 w/ NVMe SSD.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.