libyal / libfsapfs

Library and tools to access the Apple File System (APFS)
GNU Lesser General Public License v3.0
339 stars 38 forks source link

FreeBSD: libcfile_file_read_buffer_with_error_code: unable to read from file with error: Invalid argument #60

Open Marietto2008 opened 2 years ago

Marietto2008 commented 2 years ago

Hello.

Is there a way to mount an APFS partition in FreeBSD (I'm using 13.1-RELEASE) in read and write mode ? I've tried the following,without success :

pkg install devel/libfsapfs

root@marietto:/home/marietto # gpart show

34         976773101   ada1     GPT         (466G)
34                 6            - free -    (3.0K)
40            409600      1     efi         (200M)
409640     488543392      2     apple-apfs  (233G)
488953032  487820096      3     apple-apfs  (233G)
976773128          7            - free -    (3.5K)

root@marietto:/home/marietto # fsapfsmount -f 1 /dev/ada1p2 /mnt/ada1p2
fsapfsmount 20210424

Unable to open source container
libcfile_file_read_buffer_with_error_code: unable to read from file with error: Invalid argument
libcfile_file_read_buffer: unable to read from file.
libbfio_file_io_handle_read_buffer: unable to read from file: /dev/ada1p2.
libbfio_file_range_io_handle_read_buffer: unable to read from file IO handle.
libbfio_internal_handle_read_buffer: unable to read from handle.
libbfio_handle_read_buffer_at_offset: unable to read buffer.
libfsapfs_object_read_file_io_handle: unable to read object data at offset: 4096 (0x00001000).
libfsapfs_internal_container_open_read: unable to read object at offset: 4096 (0x00001000).
libfsapfs_container_open_file_io_handle: unable to read from file IO handle.
mount_handle_open: unable to open container.

I don't know which version of APFS is used by my Monterey installation. Anyway,if it is read only,I'm not interested. Point here is that I use MacOS rarely,so,I wanted to use the space not occupied by MacOS to store data and informations related to the other operating systems that I use (linux,Freebsd,windows) otherwise it's a wasted space. For sure I don't want to reboot my PC to copy there my data ! No,I can't do it using a macos vm created with bhyve,because bhyve does not support macos. And no,I can't do it using a VirtualBOX vm,because I can't use Virtualbox and bhyve at the same time.

joachimmetz commented 2 years ago

This looks more like an issue with reading from a block device on FreeBSD, likely determining the device size.