Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider supporting APFS #51

Open
probonopd opened this issue Oct 28, 2023 · 8 comments
Open

Consider supporting APFS #51

probonopd opened this issue Oct 28, 2023 · 8 comments

Comments

@probonopd
Copy link

Please consider supporting APFS (the filesystem used on macOS nowadays).

https://www.freshports.org/devel/libfsapfs/ contains a library and tools (especially fsapfsmount) to access the Apple File System (APFS).

@vermaden
Copy link
Owner

Thank You for pointing my eyes on this.

As I already support HFS I was not aware that its now possible to mount APFS on FreeBSD.

Expect automount(8) update - I hope sooner then later ...

Regards,
vermaden

@vermaden
Copy link
Owner

vermaden commented Nov 2, 2023

Seems not to work very well ...

I personally created new APFS filesystem on a apfs.dmg file on a Mac - then transferred to my FreeBSD machine.

These are the results of using libfsapfs package.

% pkg info -l libfsapfs                                                                                                                                                   
libfsapfs-e.20221102:                                                                                                                                                                           
        /usr/local/bin/fsapfsinfo                                                                                                                                                               
        /usr/local/bin/fsapfsmount                                                                                                                                                              
        /usr/local/include/libfsapfs.h                                                                                                                                                          
        /usr/local/include/libfsapfs/codepage.h                                                                                                                                                 
        /usr/local/include/libfsapfs/definitions.h                                                                                                                                              
        /usr/local/include/libfsapfs/error.h                                                                                                                                                    
        /usr/local/include/libfsapfs/extern.h                                                                                                                                                   
        /usr/local/include/libfsapfs/features.h                                                                                                                                                 
        /usr/local/include/libfsapfs/types.h                                                                                                                                                    
        /usr/local/lib/libfsapfs.a                                                                                                                                                              
        /usr/local/lib/libfsapfs.so                                                                                                                                                             
        /usr/local/lib/libfsapfs.so.1                                                                                                                                                           
        /usr/local/lib/libfsapfs.so.1.0.0                                                                                                                                                       
        /usr/local/lib/python3.9/site-packages/pyfsapfs.a                                                                                                                                       
        /usr/local/lib/python3.9/site-packages/pyfsapfs.so                                                                                                                                      
        /usr/local/libdata/pkgconfig/libfsapfs.pc                                                                                                                                               
        /usr/local/man/man1/fsapfsinfo.1.gz                                                                                                                                                     
        /usr/local/man/man1/fsapfsmount.1.gz                                                                                                                                                    
        /usr/local/man/man3/libfsapfs.3.gz                                                                                                                                                      
        /usr/local/share/licenses/libfsapfs-e.20221102/LGPL3+                                                                                                                                   
        /usr/local/share/licenses/libfsapfs-e.20221102/LICENSE                                                                                                                                  
        /usr/local/share/licenses/libfsapfs-e.20221102/catalog.mk


% /usr/local/bin/fsapfsinfo ./apfs.dmg                                                                                                                                    
fsapfsinfo 20221102                                                                                                                                                                             

Unable to open: ./apfs.dmg.
libfsapfs_container_superblock_read_data: invalid object type: 0x00000000.
libfsapfs_container_superblock_read_file_io_handle: unable to read container superblock data.
libfsapfs_internal_container_open_read: unable to read container superblock at offset: 0 (0x00000000).
libfsapfs_container_open_file_io_handle: unable to read from file IO handle.
info_handle_open_input: unable to open input container.

% mdconfig.sh -c apfs.dmg 
IN: created vnode at /dev/md0

% /usr/local/bin/fsapfsinfo /dev/md0  
fsapfsinfo 20221102

Unable to open: /dev/md0.
libfsapfs_container_superblock_read_data: invalid object type: 0x00000000.
libfsapfs_container_superblock_read_file_io_handle: unable to read container superblock data.
libfsapfs_internal_container_open_read: unable to read container superblock at offset: 0 (0x00000000).
libfsapfs_container_open_file_io_handle: unable to read from file IO handle.
info_handle_open_input: unable to open input container.

%  doas /usr/local/bin/fsapfsmount /dev/md0 /mnt/   
fsapfsmount 20221102

Unable to open source container
libfsapfs_container_superblock_read_data: invalid object type: 0x00000000.
libfsapfs_container_superblock_read_file_io_handle: unable to read container superblock data.
libfsapfs_internal_container_open_read: unable to read container superblock at offset: 0 (0x00000000).
libfsapfs_container_open_file_io_handle: unable to read from file IO handle.
mount_handle_open: unable to open container.

Does it behaves the same on your side?

Regards,
vermaden

@probonopd
Copy link
Author

Were you using APFS version 1 or 2? According to https://github.com/libyal/libfsapfs/wiki, only version 2 and certain features of it are supported.

@vermaden
Copy link
Owner

vermaden commented Nov 2, 2023

Send me please version '2' or give me the instructions to create it.

Thanks in advance.

@probonopd
Copy link
Author

probonopd commented Nov 4, 2023

Apparently one cannot directly format a regular file with APFS2. APFS (Apple File System) is designed to be used on block devices like hard drives and SSDs, and not on regular files.

APFS version 2 is the default filesystem version for macOS 10.13 and iOS 10.3 and above, hence it will be automatically chosen when creating a new APFS filesystem.

To format a USB stick with the APFS2 file system, one can most likely approximately use the following procedure (unfortunately my Macs don't run a recent enough version of macOS so I couldn't test):

  1. Connect the USB stick to your Mac computer.
  2. Launch Disk Utility. You can find it in the Utilities folder within the Applications folder.
  3. In Disk Utility, locate your USB stick in the list of drives on the left-hand side.
  4. Select the USB stick and click on the "Erase" button in the toolbar.
  5. In the Erase dialog box, choose a name for the volume (filesystem) on the USB stick.
  6. From the Format dropdown menu, select "APFS".
  7. Choose "GUID Partition Map" as the Scheme.
  8. Double-check your settings to ensure they are correct.
  9. Click on the "Erase" button to begin the formatting process.

Please note that formatting the USB stick will erase all data stored on it, so make sure to back up any important files before proceeding.

@vermaden
Copy link
Owner

vermaden commented Nov 5, 2023

I used 'file' for the APFS filesystem creation - does the instruction differ for a file?

@probonopd
Copy link
Author

I would assume it puts the APFS into a UDIF file then, which libfsapfs may not be able to read.

@vermaden
Copy link
Owner

vermaden commented Nov 5, 2023

Possibly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants