# Mounting APFS partition



## knightjp (Jan 10, 2019)

Is there a way to mount an APFS partition in FreeBSD.


----------



## ziomario (Jul 9, 2022)

Can someone give an answer at this question ? very thanks.


----------



## T-Daemon (Jul 9, 2022)

Try fsapfsmount() from devel/libfsapfs.


----------



## ziomario (Jul 9, 2022)

```
mario@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)


mario@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.
```


----------



## eternal_noob (Jul 9, 2022)

Maybe try to add the -v flag, so we can see more of these error messages.

There are several issues with libfsapfs:


> Unsupported APFS format features:
> 
> * APFS version 1
> * Fusion drive (NX_INCOMPAT_FUSION)
> ...





			fsapfsmount libcfile_file_read_buffer_with_error_code: unable to read from file with error: Invalid argument - Google Search


----------



## ziomario (Jul 9, 2022)

I'm realizing that it is not yet mature enough. In addition I'm reading from here :

https://news.ycombinator.com/vote?id=16401800&how=up&goto=item?id=16401800

 krylon on Feb 17, 2018 :

"There are only two FreeBSD filesystems that are really useable: UFS2 and ZFS.". Keep in mind that the intense proliferation of different filesystems on Linux is the rare exception. On Windows, you get FAT, NTFS and ReFS, but nobody uses ReFS, and FAT is mostly for USB drives, SD cards and such. On macOS, the situation is not that much different: They have HFS+, more recently APFS, and they support FAT so you can use USB drives and such. In practice is not much of a problem. Especially when one of your two options is ZFS. ;-)

in addition :

terminalcommand on Feb 17, 2018

ExFAT can be problematic due to corruption. I used to have an external HDD formatted to ExFAT plugged in on my raspberry pi. When crashes occured whilst having torrent open, the disk never fully recovered. I had to constantly run repairs. For small drives e.g. USB sticks ExFAT is great but for larger drives I'd stay away from ExFAT.

The end.


----------



## free-and-bsd (Jul 9, 2022)

That is why ZFS seems to me to be the most promising. There were (weren't there??) even talks about porting it to windows.


----------



## hardworkingnewbie (Jul 9, 2022)

APFS is, as the name says, the APPLE File System. It is by now the standard file system on all new Macs. There's by my knowledge nothing this thing has which ZFS cannot do.


----------



## ziomario (Jul 10, 2022)

Point is why fsapfsmount() from devel/libfsapfs does not work ? why the developer maintain it if it does not work ? it says APFS version 1 is not supported. New Macs have version 1 ? is there a commercial file system that's compatible with UFS2 / ZFS / EXT4 + NTFS ? I mean,not to boot FreeBSD,but to store data that can be read and written by multiple OS,such as FreeBSD,Windows and Linux ? Something like this : I get a large USB disk,I format it with this fs,I use the driver included with the product (a driver which works under FreeBSD,another which works under Windows and another which works under Linux) and boom,the data on the disk will become read and write between FreeBSD,Windows and Linux. Does exists something like this ? And I'm not speaking about a network fs,but about a local disk fs.


----------



## tyson (Jul 10, 2022)

ZFS works perfectly fine on macOS and Linux. If you want to access your data from Windows too id use exfat.


----------



## free-and-bsd (Jul 10, 2022)

tyson said:


> ZFS works perfectly fine on macOS and Linux. If you want to access your data from Windows too id use exfat.


How about OpenZFS on Windows?


----------



## hardworkingnewbie (Jul 10, 2022)

ziomario said:


> Point is why fsapfsmount() from devel/libfsapfs does not work ? why the developer maintain it if it does not work ?


The only thing what's wrong is making such statements, and bashing a project while making no own research about that project.









						GitHub - libyal/libfsapfs: Library and tools to access the Apple File System (APFS)
					

Library and tools to access the Apple File System (APFS) - GitHub - libyal/libfsapfs: Library and tools to access the Apple File System (APFS)




					github.com
				




It clearly states there:
Project information:​​* Status: experimental​* Licence: LGPLv3+​
So why on Earth do you expect something which is clearly labeled as *experimental* to be a full featured, functioning piece of software?

Use exFAT, problem solved.


----------



## tyson (Jul 10, 2022)

free-and-bsd said:


> How about OpenZFS on Windows?


Tried it once with no success so I cant really tell. Maybe it does work good right now, but I have no idea .


----------



## free-and-bsd (Jul 10, 2022)

tyson said:


> Tried it once with no success so I cant really tell. Maybe it does work good right now, but I have no idea .


This is, strictly speaking, off topic, of course ... but I'm going to try it. So happens that I have all sorts of filesystems on the drives attached to this machine. One of them has Windows 10, so I'll check now how this latest version of ZFS on Windows will handle my ZFS pools ))


----------



## ziomario (Jul 10, 2022)

tyson said:


> ZFS works perfectly fine on macOS and Linux. If you want to access your data from Windows too id use exfat.



ZFS does not work well on Windows and anyway I think that it is unnecessarily complicated to understand and to use. 
Did u read what I've written before about ExFAT ? I want to write it again :



> terminalcommand on Feb 17, 2018 : (on https://news.ycombinator.com/vote?id=16401800&how=up&goto=item?id=16401800)
> 
> ExFAT can be problematic due to corruption. I used to have an external HDD formatted to ExFAT plugged in on my raspberry pi. When crashes occured whilst having torrent open, the disk never fully recovered. I had to constantly run repairs. *For small drives e.g. USB sticks ExFAT is great but for larger drives I'd stay away from ExFAT.*



Unfortunately I have a 9 TB USB large disk and ExFAT is not good. As you can read above,the risk is the data corruption. In addition I've realized that it stoles 1 TB of space to the disk. I've seen it personally.


----------



## ziomario (Jul 10, 2022)

hardworkingnewbie said:


> The only thing what's wrong is making such statements, and bashing a project while making no own research about that project.
> 
> 
> 
> ...



if a project is experimental and it does not work at all, don't make it public, keep it to yourself and wait that it is a little bit more mature.


----------



## ziomario (Jul 10, 2022)

free-and-bsd said:


> This is, strictly speaking, off topic, of course ... but I'm going to try it. So happens that I have all sorts of filesystems on the drives attached to this machine. One of them has Windows 10, so I'll check now how this latest version of ZFS on Windows will handle my ZFS pools ))



ZFS on Windows is not yet stable and mature[/B]. Do you want to put your data at risk ? I want to ask again : is there and old / commercial / but still usable file system that's compatible with UFS2 / EXT4 / NTFS ?


----------



## elgrande (Jul 10, 2022)

ziomario 
I noticed this (you) for some time here, this will be *my first and last reply* to you.
Your behavior is here just inappropriate. You are in a free community for people who freely contribute to a free OS. You are mostly just ranting and demanding in a very rude way. Despite the fact that obviously you are not understanding all the things and you are doing things the wrong way, you always blame others and behave inadequate.
For example a lot of users are using exfat (and other FS drivers) on FreeBSD for years without problems, in your case the problem is not the drivers, it is sitting in front of the screen.
Are you sure this OS and community is the right one for you and you might not want to resort to a paid OS?
@moderators: sorry if this is too rude, I had this on my mind for some time now, please delete if inappropriate.


----------



## hardworkingnewbie (Jul 10, 2022)

ziomario said:


> if a project is experimental and it does not work at all,*don't make it public*, keep it to yourself and wait that it is a little bit more mature.


*Wrong again, *publishing early and often is exactly what makes open source tick and is it about! Linux started that way, and many other succesful projects as well!

Thank god you are not setting the rules on how to manage open source projects, we would be stuck in a proprietary world if you would be in charge for that.

Regarding your USB drive: caring about data lass on an USB drive is already an oxymoron in itself, because if would really care you would be using SATA/SAS HDDs instead because USB is notoriously instable...


----------



## ziomario (Jul 10, 2022)

elgrande said:


> ziomario
> I noticed this (you) for some time here, this will be *my first and last reply* to you.
> Your behavior is here just inappropriate. You are in a free community for people who freely contribute to a free OS. You are mostly just ranting and demanding in a very rude way. Despite the fact that obviously you are not understanding all the things and you are doing things the wrong way, you always blame others and behave inadequate.
> For example a lot of users are using exfat (and other FS drivers) on FreeBSD for years without problems, in your case the problem is not the drivers, it is sitting in front of the screen.
> ...



I'm just confirming the thesis of some users who certainly has more skills than me (krylon and terminalcommand), adding to what they think what I think, which is based on my personal experience. I haven't targeted anyone in particular and I'm not insulting anyone. Your consideration seems to me to be a nice and good excuse to place my opinions and put me to the side of the bad and wrong user. It's not fair. I've explained why I can't use exFAT and because I don't want to use ZFS massively (because I'm chosen it for the FreeBSD installation that I'm using,but I'm not using it in all its potential because for me it's too tricky). This is my personal opinion (not only my opinion,regarding the exFAT fs). It's not a bad idea to try to understand my position when I say that ZFS is unnecessarily complicated. Because it's a fact. For some unexperienced users ZFS is tricky. The fact that it is not tricky for a lot of other more experienced users don't change the fact that it is for the first ones. I like FreeBSD,I've learnt a lot about it and I don't want to change it for the moment. But I don't think a bad idea to find some tools that makes easier for me to perform certain tasks, even if I have to pay. Linus Torvalds thinks the same as me about the integration of "free" tools with commercial tools :









						Linus Torvalds: Open source without commercial interests = crap
					

Open source did very well without companies getting involved.  It has done even better with these companies.  Linus Torvalds explains why.




					www.cnet.com
				




I think its sane to use the right tool that's able to satisfy our needs and / or  that we find comfortable to work with. Radical positions never bring long-term benefits.


----------



## ziomario (Jul 10, 2022)

hardworkingnewbie said:


> *Wrong again, *publishing early and often is exactly what makes open source tick and is it about! Linux started that way, and many other succesful projects as well!
> 
> Thank god you are not setting the rules on how to manage open source projects, we would be stuck in a proprietary world if you would be in charge for that.
> 
> Regarding your USB drive: caring about data lass on an USB drive is already an oxymoron in itself, because if would really care you would be using SATA/SAS HDDs instead because USB is notoriously instable...



Stop saying wrong. Here we are talking about opinions and points of view. They are never wrong,they can't be wrong. Technical reasoning may be wrong, because computer science is an exact science, but not points of view, personal perceptions or tastes. If a tool is so experimental that can't be used,from my perspective it makes no sense to put it inside the ports or the packages. For you it is ? ok. For me not,because I can't test it,I can't collaborate to improve it because it seems too much experimental. I can't use it. Experienced users can help,but not the people with a medium knowledge. And when I ask for some help,no one is able to help me because it just not work enough. It's useless. The bigger mistake that you make is given by the fact that you have some troubles by putting your feet inside the shoes of someone that's not experienced,the so called newbie. For these people you should be less demanding. I'm here to learn and the learning is a slow process. It needs time,a lot of errors,choices. Those people who reach different conclusions than those reached by experienced people should not be judged bad. You are simply dealing with a different user target.


----------



## hardworkingnewbie (Jul 12, 2022)

No, I won't stop saying wrong to things which are wrong. The idea behind open source is to create a community, get people involved and feedback. Whichever type of feedback that might be. 

So by releasing often and early the author is able to get that; otherwise he will not. 

And aside if something is experimental this does not decrease its value, maybe its useful for roughly 80% the use cases outside, to that would be justification enough to have it in ports. It's anyway always your responsibility about which programs you're putting on your computer and running.

And BTW ZFS is not complicated, the basics are quite easy. Of course you can come up with many complicated setups, but that's just then showing the power of that file system. 

Reg. your use case you should probably get yourself a NAS, install something like TrueNAS on it and that's it.


----------



## ziomario (Jul 13, 2022)

hardworkingnewbie said:


> Reg. your use case you should probably get yourself a NAS, install something like TrueNAS on it and that's it.



I can't buy it. No money.


----------



## free-and-bsd (Jul 24, 2022)

ziomario said:


> Stop saying wrong. Here we are talking about opinions and points of view. They are never wrong,they can't be wrong.


Yes, but this is not a forum to support freedom of expression. This particular forum has its own purpose, rules & guidelines. And here is a quote you should have read before ever starting to post here:


> As of today, FreeBSD Forums staff will actively close down (and eventually remove) topics that serve no other purpose than to complain that "FreeBSD is not (like) Linux" (or Windows, or MacOS, or any other operating system), or that "FreeBSD does not use systemd", or that "FreeBSD has no default GUI", or that "FreeBSD does not encrypt gremlins", etc. This also includes topics that devolve into that kind of debate.
> 
> Note that this is a general user and administrator forum, where the community aims to assist those who want to install, run, or upgrade _*FreeBSD as-is*_. Discussions about what FreeBSD _needs to be_, or _needs to add_, or _needs to lose_, are pointless on the forums. We do not maintain the operating system here.


So, to put it simple. Personal opinion is a good thing, it's a natural human thing. And freedom of expression is also a good thing.
But here at this forum some free opinions and expressions will have to be deleted. Others may not be deleted, but still will be considered by forum members as violation of the forum spirit and guidelines.

This forum is meant for PRACTICAL HELP. And when you're developing or supporting the usage of a free OS, negative opinions and complaints DO NOT HELP. Rather, they discourage others from using this software. I don't think an intelligent person like yourself would fail to see this simple point. And this applies not only to the things you say, but also to HOW you put your questions and make your comments.

You can safely assume that ppl here very well realize all the shortcomings of this or that software. But if you want to (and can) DO something about it, you start up by leaving these things behind. If, on the other hand, something cannot be helped at the moment, why dwell on that, for goodness sake? Time will come and this will be addressed... Until then, there's a lot can be done about numerous other issues.


----------

