# Filesystem natively supported by FreeBSD and Linux



## usakhncit (Sep 25, 2019)

Hi
I have dualbooted Linux and FreeBSD. My data is in separate drive mounted as /home with ext4 filesystem. When I mount this ext4 partition in FreeBSD and copy and move some file, it creates some problems and Linux complain about 'orphan links' (Screenshot is attached). So, I am thinking to change filesystem of my /home directory. So, in this regard kindly guide me that which filesystem is natively supported by both, FreeBSD and Linux, so these kinds of problem do not happen.
Thanks


----------



## sidetone (Sep 25, 2019)

You can try msdosfs. Perhaps there's a better choice.

It's also possible that ext4 has more features than ext2 and ext3 that make that an occurrence.


----------



## usakhncit (Sep 25, 2019)

sidetone said:


> You can try msdosfs. Perhaps there's a better choice.
> 
> It's also possible that ext4 has more features than ext2 and ext3 that make that an occurrence.


Is msdosfs same filesystem as vfat or fat32?


----------



## sidetone (Sep 25, 2019)

I believe msdosfs on FreeBSD covers vfat, fat32 and other fat numbered filesystems, from doing a search on the forum.
But know that exfat is different, it's not native on FreeBSD, that it requires a port and a special modification in fstab.

Thread poll-what-fs-do-you-use-on-your-portable-hd.16800 and other threads.


----------



## usakhncit (Sep 25, 2019)

sidetone said:


> I believe msdosfs on FreeBSD covers vfat, fat32 and other fat numbered filesystems, from doing a search on the forum.
> But know that exfat is different, it's not native on FreeBSD, that it requires a port and a special modification in fstab.
> 
> Thread poll-what-fs-do-you-use-on-your-portable-hd.16800 and other threads.


So, it means that it is an insecure and non-journal filesystem?


----------



## sidetone (Sep 25, 2019)

I don't know.


----------



## Wozzeck.Live (Sep 25, 2019)

ext2 is the best choice, it is handled natively since many years now by the FreeBSD kernel module ext2fs, BUT this is a non journalised file system. Being a non journalised filesystem, ext2 is a good choice for portable/shared data

msdosfs is quite old now, and not supported anymore (the Microsoft  DOS file system is frozen since many years, and replaced by exfat) and it has some limitations. For example it doesn't support files higher than 5 gigabytes, and not for saying that this is not a journalised file system

Depending on Linux flavor, support of ZFS is in a beta state (so very advanced) in some distros like OpenSUSE Tumbleweed.
In some few years we should be able to perfectly exchange data through ZFS, but we should wait that FreeBSD switches to ZFS on Linux (ZOL).

For moment, implementation of ZFS in FreeBSD is not exactly the same. But with FreeBSD 13, FreeBSD will probably switch definitively to ZOL and we should expect full compatibility. IXSystems has already ported an early version of ZOL available for FreeBSD 13 (Current)

Anyway, in some cases ZFS is not a solution for user (not supported by some old controllers, not compatible with fake raid, should be preferably used with good hardware configuration)

But looking to your message.... I am not sure at all that ext4 is the problem. Using "lklfuse", there should be no problem.
Theses kind of error may occur when we force connect dirty filesystem. Dirty filesystem should firslty by checked with e2fsck before mouting it.

I suspect possible issues at a hardware level.
You should make some tests with an external USB Hard drive formatted in ext4.... try to copy data, connect to Linux... repeat operation to check if you can reproduce the error.

I have a 64 Gbyte sdcard formatted in ext4 and connected permanently to a Linux box.
Sometimes I disconnect it and I connect it to a FreeBSD system... I have never had any issue.


----------



## usakhncit (Sep 25, 2019)

Wozzeck.Live said:


> ext2 is the best choice, it is handled natively since many years now by the FreeBSD kernel module ext2fs, BUT this is a non journalised file system. Being a non journalised filesystem, ext2fs is a good choice for portable/shared data
> 
> msdosfs is quite old now, and not supported anymore (the Microsoft  DOS file system is frozen since many years now, and replaced by exfat) and it has some limitations. For example it doesn't support files higher than 5 gigabytes, and not for saying that this is not a journalised file system
> 
> ...


Thanks a lot. Very informative, well structured and detailed answer


----------



## userxbw (Sep 25, 2019)

Chapter 22. Other File Systems
					

This chapter shows the other filesystems supported by FreeBSD




					www.freebsd.org
				











						USB and SD Card Problems: permissions and automount
					

Hello :)  I have a problem regarding USB and SD card reader :  USB : automount works very well but I must be root to write or clear something, else I can just read. SDCARD : sometimes automount works, and sometimes not. When It works, it is just readable and I must be root to write or erase...




					forums.freebsd.org
				











						FreeBSD Desktop – Part 17 – Configuration – Automount Removable Media
					

In this article in the FreeBSD Desktop series I will introduce various methods to automatically (or not) mount external/removable devices such as USB or eSATA disks/pendrives or SD/microSD flash ca…




					vermaden.wordpress.com
				




and automount. look into it, this is what I am using on a separate hdd formatted to ext4 I get read write in Fbsd and Linux don't complain about it.


----------



## usakhncit (Sep 25, 2019)

userxbw said:


> Chapter 22. Other File Systems
> 
> 
> This chapter shows the other filesystems supported by FreeBSD
> ...


Yes, I am planning to try it on weekend. Thanks.


----------



## SirDice (Sep 26, 2019)

Wozzeck.Live said:


> msdosfs is quite old now, and not supported anymore (the Microsoft DOS file system is frozen since many years now, and replaced by exfat) and it has some limitations. For example it doesn't support files higher than 5 gigabytes, and not for saying that this is not a journalised file system


FAT is still supported, heck the EFI partition is actually FAT32. Maximum filesize is 4 GB, not 5.






						Comparison of file systems - Wikipedia
					






					en.wikipedia.org


----------



## Alain De Vos (Sep 26, 2019)

Note : It is possible to do block based gjournaling on an ext2 or msdos partition.


----------



## D-FENS (Sep 26, 2019)

zetrotrack000 said:


> Hi
> I have dualbooted Linux and FreeBSD. My data is in separate drive mounted as /home with ext4 filesystem. When I mount this ext4 partition in FreeBSD and copy and move some file, it creates some problems and Linux complain about 'orphan links' (Screenshot is attached). So, I am thinking to change filesystem of my /home directory. So, in this regard kindly guide me that which filesystem is natively supported by both, FreeBSD and Linux, so these kinds of problem do not happen.
> Thanks


Linux can mount UFS and ZFS. Why don't you try to use the native FreeBSD file systems and see if you have problems mounting them with Linux?

Edit: By the way, as suggested above, using ext3 might also help - I think it is older and more stable than ext4 (Linux might be ahead of FreeBSD in the ext4 development, which might be the source of your trouble). ext2 is probably not a good idea because it is not journaled, i.e. not as safe as ext3 would be.


----------



## kpedersen (Sep 26, 2019)

If it is external between different operating systems I tend to use NTFS (via ntfs-3g kernel module). This way it works on Linux, Windows and *BSD.

My main motivation is that it provides no file / folder ownership so is quite easy to plug in, copy and go without having to chown, chmod etc.
Oddly enough I actually find it faster than the fat32 module at copying files. This might be in my mind however.


----------



## tedbell (Sep 26, 2019)

You can mount ufs in linux.


----------



## Crivens (Sep 26, 2019)

And please, nobody use any fat based stuff for /home. DON'T!


----------



## D-FENS (Sep 27, 2019)

Crivens said:


> And please, nobody use any fat based stuff for /home. DON'T!


Unless they want to have a lot of fun debugging permissions.


----------



## usakhncit (Sep 27, 2019)

Thanks everyone for your messages. From your recommendations, I think I will try UFS or ZFS in Linux.
tedbell, I have mounted FreeBSD's ufs partition in Linux, but it is only in read-only mode. I will check for read-write options. If you have any clue regarding read-write options, then kindly share with me.
I will also look into ext3.
I will avoid ext2, FAT, NTFS and other older filesystems.
Thanks everyone


----------



## D-FENS (Sep 27, 2019)

From here: https://askubuntu.com/questions/85154/mount-ufs-filesystem

```
sudo mount -r -t ufs -o ufstype=ufs2 /dev/sdb1 /home/<your_username>/ufs_mount
```
You can throw in a `-o rw` or `-o rw,ufstype=ufs2` to make it read-write.


----------



## usakhncit (Sep 27, 2019)

roccobaroccoSC said:


> From here: https://askubuntu.com/questions/85154/mount-ufs-filesystem
> 
> ```
> sudo mount -r -t ufs -o ufstype=ufs2 /dev/sdb1 /home/<your_username>/ufs_mount
> ...




```
[pc zetro]# sudo mount -r -t ufs -o rw,ufstype=ufs2 /dev/sda4 /freebsd/
mount: /freebsd: WARNING: device write-protected, mounted read-only.
```


----------



## D-FENS (Sep 27, 2019)

Look here: https://gms.tf/dtracing-passwords-for-fun.html
Maybe your Linux kernel is compiled with only read-only support for UFS. You can check this with this command:
`cat /proc/config.gz | gunzip | grep CONFIG_UFS`

My own kernel is indeed compiled without write support but I don't use UFS anyway:

```
% cat /proc/config.gz | gunzip | grep CONFIG_UFS
CONFIG_UFS_FS=m
# CONFIG_UFS_FS_WRITE is not set
# CONFIG_UFS_DEBUG is not set
```

If you want to use UFS in your Linux, you need to compile a custom kernel. You can take your current configuration (mentioned above) and uncomment *CONFIG_UFS_FS_WRITE*.

However, I recommend you trying ZFS instead. ZFS is a very powerful file system and if you have enough RAM (>= 4GB) you should give it a try.
You can create a partition for your /home or whatever you want to share (you can even install FreeBSD on a ZFS pool). Then in GNU/Linux you need to install ZFS support (e.g. https://wiki.archlinux.org/index.php/ZFS ) and make the kernel driver load automatically on startup. It will discover the pool and mount it, you don't need an fstab for that. Just make sure you don't put /root in the ZFS pool on the Linux side, otherwise if something goes wrong with ZFS you won't be able to log in.


----------



## usakhncit (Sep 27, 2019)

roccobaroccoSC said:


> Look here: https://gms.tf/dtracing-passwords-for-fun.html
> Maybe your Linux kernel is compiled with only read-only support for UFS. You can check this with this command:
> `cat /proc/config.gz | gunzip | grep CONFIG_UFS`
> 
> ...


Great suggestion. I will try it tomorrow


----------



## garry (Sep 29, 2019)

roccobaroccoSC said:


> .....I recommend you trying ZFS instead... in GNU/Linux you need to install ZFS support and make the kernel driver load automatically on startup. It will discover the pool and mount it...



This would be a great solution for me.  I'm running Gentoo now to get an up-to-date sagemath but I would love to run my beloved FreeBSD in parallel and share a 2 TB "library".  But I tried this before, years ago, and ran into problems because the "ownership" notion of zfs.  How would I get linux and freebsd to both automatically mount the zfs pool without having to always export the pool from one before rebooting and importing the pool into the other os?  On my previous attempt I tried to set the hostid of both systems and the pool to the same value and I don't remember details of what I tried but I know that I finally gave up.  It seemed that zfs resists being owned by multiple "hosts".  Can anyone guide me on this now?

*Edit*:  Today I stumbled upon the obvious solution to which I had been blind -- there is a zfs mountpoint option "_legacy_".  If mountpoint is _legacy_, zfs file systems can be managed with traditional *mount*, *umount*, *fstab*. From the zfs() manual "If a file system's mount point is set to legacy, ZFS makes no attempt to manage the file system, and the administrator is responsible for mounting and unmounting the file system".  The correct answer to my question was RTFM, a lesson I learn again (and again).


----------



## D-FENS (Sep 30, 2019)

garry said:


> This would be a great solution for me.  I'm running Gentoo now to get an up-to-date sagemath but I would love to run my beloved FreeBSD in parallel and share a 2 TB "library".  But I tried this before, years ago, and ran into problems because the "ownership" notion of zfs.  How would I get linux and freebsd to both automatically mount the zfs pool without having to always export the pool from one before rebooting and importing the pool into the other os?  On my previous attempt I tried to set the hostid of both systems and the pool to the same value and I don't remember details of what I tried but I know that I finally gave up.  It seemed that zfs resists being owned by multiple "hosts".  Can anyone guide me on this now?


Great point! I have not thought about that because I don't doubleboot anymore.
Just a speculation - The ZFS pool is registered in the ZFS cache file, right? What if you put the cache file on a UFS partition for example and shared this between the two OS-es too?

Edit: Take a look here: https://ericmccorkleblog.wordpress....ebsd-and-gentoo-linux-on-a-common-zfs-volume/


----------



## sidetone (Mar 26, 2020)

My ext2fs(5) filesystem could only mount as read only on FreeBSD 12.1.

`mount -t ext2fs -o ro /dev/da?s? /media/share`
My fstab now has a corresponding entry.


----------



## Alain De Vos (Mar 26, 2020)

So if i'm correct for rw mount of ext2,ext3,ext4 you always need fuse or lkl


----------

