Menu

fix for building with macFUSE 4.0.5

2021-02-11
2024-01-12
  • Christophe Migliorini

    I have been able to build and use osxFuse with macFUSE 4.0.5 on Catalina and the following patch.

    diff -r dcd83b3f36e5 src/Make.inc
    --- a/src/Make.inc      Wed Jan 13 21:14:14 2016 +0200
    +++ b/src/Make.inc      Thu Feb 11 16:18:40 2021 +0100
    @@ -7,9 +7,9 @@
     OBJECTS=$(BUILD)/obj
    
     CC=gcc
    -FUSE_CFLAGS=-D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26
    -FUSE_LDFLAGS=-losxfuse
    -FUSE_INCLUDES=-I /usr/local/include/osxfuse
    +FUSE_CFLAGS=-D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26 -D_DARWIN_USE_64_BIT_INODE
    +FUSE_LDFLAGS=-lfuse
    +FUSE_INCLUDES=-I /usr/local/include/libfuse
     XFSUTILS_INCLUDES=-I $(SRC)/xfsutil
     XFS_INCLUDES=-I $(SRC)/xfsprogs/include
    

    This one removes a deprecation warning (since 10.12). I wonder if there was a (performance?) reason for using syscall(FSCTL, ... instead of this.

    diff -r dcd83b3f36e5 src/xfsprogs/include/darwin.h
    --- a/src/xfsprogs/include/darwin.h     Wed Jan 13 21:14:14 2016 +0200
    +++ b/src/xfsprogs/include/darwin.h     Thu Feb 11 16:18:40 2021 +0100
    @@ -30,13 +30,9 @@
     #define __BIG_ENDIAN   BIG_ENDIAN
     #define __LITTLE_ENDIAN        LITTLE_ENDIAN
    
    -#include <sys/syscall.h>
    -# ifndef SYS_fsctl
    -#  define SYS_fsctl    242
    -# endif
     static __inline__ int xfsctl(const char *path, int fd, int cmd, void *p)
     {
    -       return syscall(SYS_fsctl, path, cmd, p, 0);
    +       return fsctl(path, cmd, p, 0);
     }
    
     static __inline__ int platform_test_xfs_fd(int fd)
    

    Having said that, it's still not working, giving

    sudo fuse-xfs -p /dev/rdisk6s1 -- /tmp/xfs/
    cache_purge: shake on cache 0x7fce92008600 left 1 nodes!?
    cache_purge: shake on cache 0x7fce92008e00 left 1 nodes!?
    

    If there's something I can help with...

     

    Last edit: Christophe Migliorini 2021-02-11
  • Christophe Migliorini

    In fact it does work -- I was using a /dev/diskx so needed sudo. I managed to create a filesystem, add files on another machine and read them from my Catalina box.

    Still, creating the filesystem on another, more recent, linux box does not work because fuse-xfs does not support V5 -- so an XFS filesystem created on a modern machine will not be recognized.

    I figured out you use xfsprogs, which I'm willing to upgrate to a more recent version, so I pulled 3.1.4 (based on xfsprogs/VERSION) from kernel.org, but there are differences in the tree... Did you make alterations?

     
    • Alexandre Hardy

      Alexandre Hardy - 2021-02-14

      Hi!

      Thanks for the feedback!

      I'm afraid I have not had time to work on fuse-xfs to keep it up to date. I generally use /usr/local/bin/xfs-cli which is installed with the package to access my disk drives when I lose access with macFUSE / osxFUSE.

      You can execute that in a terminal like this
      /usr/local/bin/xfs-cli /dev/rdisk1
      (depending on which disk you want to access). You probably still need sudo

      The commands are fairly straight forward, if you are familiar with the terminal interface, and you can use that to browse files on the disk, and copy files off the disk. Supported commands include:
      ls : list the contents of the directory
      cd $DIRECORY: change into a directory
      cat $FILE: write the contents of a file to the screen.
      get $FILE: copy the file to the current directory (where xfs-cli was run from)

      It is not well documented, since it is a last resort for when the osx fuse fails for some reason.

      As for whether the xfsprogs code was modified: Yes it was, to make it compile correctly on Mac OS X. I thought I had separate commits for my fixes. Ah, here it is. The original source was added at commit b9f8e4. I managed to lose that history (or direct access to that history) when I rearranged the file structure in commit ef8446.

      Please feel free to try to get it to work, and submit a patch if you get anything right. To be honest, I don't think I will be getting round to fixing this for modern versions of OSX or XFS during this year.

      Hope that helps!

      Kind regards
      Alexandre

       
      • Christophe Migliorini

        Hi, Thanks much for replying! In fact my main issue is support for XFS v5.

        But then yes, it's going to be a decent amount of work to get a more recent xfsprogs 5+ to compile. I'll give it a shot anyway.

         
        • Christophe Migliorini

          Hi, I thought I would give you an update.

          xfsprogs v4.18.0 is the last version that offers support for darwin (and it was not compiling that much...). I sort of fixed it here.

          https://github.com/cmigliorini/xfsprogs-dev/pull/1/files

          Was able to use mkfs-xfs and xfs_repair on a file. Then I dd--ed the file to a diskand was able to mount it from a Linux box.

           

          Last edit: Christophe Migliorini 2021-03-12
  • Radovan Biciste

    Radovan Biciste - 2024-01-11

    Hello,
    Do think it would be possible to compile it for Apple M1 and M2 chips?
    Do you please have a dmg available? My OpenSuSE laptop died on me and need to get data out of there.

     
    • Alexandre Hardy

      Alexandre Hardy - 2024-01-12

      Hi!

      I think it should be possible to compile for M1 and M2 chips, if I recall correctly the types are well specified in the xfsprogs code, so it should work fine.

      However, I tried to access an XFS volume on a more recent XFS based linux install, and found that the xfsprogs currently in use is not compatible with recent XFS filesystems. As noted above, it will take quite some work to get that working.

      I am no longer on a Mac OS X system, so I will not be attempting to support the newer XFS filesystems in the near future.

      Kind regards
      Alexandre

       
      • Radovan Biciste

        Radovan Biciste - 2024-01-12

        Hi,
        Thank you for the quick reply. I did not have a luck even with the commercial product. My disk is using snapshots and I did not see all folders etc. To get the XFS working again would most likely require remerge the latest XFS codebase. That is well beyound my knowledge.
        After all I was able to get my data out using Ubuntu USB stick fairly easily.
        Best,
        Radovan

         

Log in to post a comment.