# I'm looking for a secure ext driver for linux which works great on Freebsd



## ziomario (Jun 17, 2021)

Hello. Since I have a lot of disks partitioned and formatted with the ext4 fs,I'm looking for a working ext driver that can I use on Freebsd that gives to me read and write access to those disks. I've found the fuse-ext2 from the ports,but here :









						GitHub - alperakcan/fuse-ext2: Fuse-ext2 is a multi OS FUSE module to mount ext2, ext3 and ext4 file system devices and/or images with read write support.
					

Fuse-ext2 is a multi OS FUSE module to mount ext2, ext3 and ext4 file system devices and/or images with read write support. - GitHub - alperakcan/fuse-ext2: Fuse-ext2 is a multi OS FUSE module to m...




					github.com
				




I can read :

Even though write support is available, _please do not mount your filesystems with write support unless you have nothing to lose_

So,this product is not yet mature ? what tool do u use ?


----------



## covacat (Jun 17, 2021)

run a mini behyve linux instance and nfs/sshfs
performance wont be as good but at least there is a lot less corruption risk


----------



## Alain De Vos (Jun 17, 2021)

Read is always safe. The fuse user-mode driver works but is a bit slow.
Note freebsd can also read-write xfs and fat32 and ntfs partitions.


----------



## Vull (Jun 17, 2021)

I use ext2fs. It's part of the base system. Look up `man ext2fs`.


----------



## sidetone (Jun 17, 2021)

https://github.com/alperakcan/fuse-ext2 was already referring to sysutils/fusefs-ext2.


Vull said:


> I use ext2fs. It's part of the base system. Look up `man ext2fs`.


The last I remember, ext2fs(5) is for read-only access. Has that changed?


----------



## Vull (Jun 17, 2021)

sidetone said:


> https://github.com/alperakcan/fuse-ext2 was already referring to sysutils/fusefs-ext2.
> 
> The last I remember, ext2fs(5) is for read-only access. Has that changed?


It gives me read/write access. `chown`, `chmod`, everything I've tried. I don't know its history and have only been using it since FreeBSD-13.0. I don't use it for anything critical, just for scratch partitions and file transfers, because it doesn't keep a journal.


----------



## sidetone (Jun 17, 2021)

Write access on ext3 and ext4 too?


----------



## Vull (Jun 17, 2021)

Yes.


----------



## Alain De Vos (Jun 17, 2021)

Too share data between linux and freebsd i just tar.xz my data and put in on a fat32 partition.


----------



## Vull (Jun 17, 2021)

Alain De Vos said:


> Too share data between linux and freebsd i just tar.xz my data and put in on a fat32 partition.


I've done that before too. It's a good way to go, but then, when I boot Windows 10, it always wants to take ownership of any ntfs or fat32 partitions I create, so I've gone over to using this method instead. I should probably just delete Windows 10, but I still use it once a year or so, to print out tax forms on my Epson printer, and for MagicJack whenever I need a fax line.


----------



## Alain De Vos (Jun 17, 2021)

My epson scanner works fine with FreeBSD. For governemental login it works with a gsm login app to aknowledge my identity. So I can do all tax stuff with FreeBSD.


----------



## ralphbsz (Jun 17, 2021)

ziomario said:


> Even though write support is available, _please do not mount your filesystems with write support unless you have nothing to lose_
> 
> So,this product is not yet mature ? what tool do u use ?


If you want the full-featured and most reliable file system implementation for a Linux file system, use Linux. Such implementations on other OSes are all "bad" copies. By "bad" I mean that they will be risky to use, in particular when writing to disk. There are very few file systems that can really be shared between OSes (because they use the same implementation on multiple systems, or because the underlying file system is so well known that it can be implemented risk- and bug-free), and in the open source world I think they are OpenZFS, FAT, and the CD/DVD file systems (which are standardized). There are quite a few commercial file systems that can be compatibly used from multiple OSes.

My suggestion would be to run a small VM or a small server with Linux.


----------



## ziomario (Oct 5, 2021)

ralphbsz said:


> There are quite a few commercial file systems that can be compatibly used from multiple OSes.



Which ones are they ?


----------



## rootbert (Oct 5, 2021)

+1 for a small bhyve VM. If this is not possible, I have not had problems with fusefs-lkl


----------



## ralphbsz (Oct 6, 2021)

ziomario said:


> Which ones are they ?


Incomplete list from memory:

CXFS (Silicon Graphics, someone bought it when they went under, but I don't know whether it's still sold)
Panasas
Pivot3 (no longer marketed as a file system, now an embedded component owned by Quantum)
PolyServe (no longer sold, I think)
QFS (Sun, now Oracle)
SAN FileSystem  (a.k.a. IBM StorageTank, no longer sold but merged into other products)
Spectrum Scale (a.k.a. IBM GPFS)
StorNext (was also marketed by Apple as Xsan, don't know whether still sold)
Veritas Cluster
??? (I know HP sells one, but I don't know its name)

Nearly all of the above had a way to access them from Linux, and typically also from the proprietary Unixes (AIX, HP-UX, Irix, whatever Sun's OS is called this week), and often also Windows and Mac.

A lot of the products listed above may no longer be sold to new customers, but are often supported by vendors for a decade or more after the last sale.

There are probably lots of others that I'm not aware of, or that I forgot.

Some of the nominally open source storage systems (such as Ceph or Lustre) are hardly ever used in large production without getting a big support contract from the authors (Inktank now a division of RedHat/IBM, and whoever owns Peter Braam's company, a while ago it was in Xyratex -> Seagate, but I lost track of it). So it's not clear whether one wants to count them as commercial/proprietary or not.


----------



## gpw928 (Oct 6, 2021)

I would be tempted to re-think the question.

In the long term you don't really want to be supporting "foreign" file systems.  e.g. even if you can read and write EXT4, you may eventually need to repair (`fsck`) EXT4.  Not sure what FreeBSD offers there, or how much grief you would suffer if you ever needed to do it.

If I had a number of EXT4 formatted disks, I would acquire enough spare disk capacity to copy them from a native Linux host to a native FreeBSD host across the network using rsync(1).  You could do this incrementally with just one spare large disk.

If I really cared about the ability to return the data to Linux at any subsequent date, I would use ZFS as the target file system, as OpenZFS is going to converge on both Linux and FreeBSD and it has the ability to export file systems.


----------



## ct85711 (Oct 12, 2021)

I've actually encountered this issue on, needing to run fsck on an EXT3/4 partition.  Frankly it was more of an issue, that I had a power loss and the partition got marked as dirty/bad and it wouldn't mount without having a fsck run over it first.  In the end, I had to rip that drive from the system and put it in an external drive bay, so I can plug it in my other system that had a linux system working.   Eventually, I'd like to transfer the contents to an ZFS volume so that I can share that data again (while being able to back it up properly).


----------



## ziomario (Oct 12, 2021)

what about to create a small (bhyve or virtualbox) linux vm and give to them the physical disk to repair with the linux version of fsck ? it could be valid even using the dd version of linux ? because I've realized that the freebsd version of dd is much slower than the linux version. Is bhyve enough secure when we give to it a physical disk instead of a virtual disk ? does virtualbox supports the assignement of a physical disk ? is it more secure than bhyve ?


----------



## Vull (Oct 13, 2021)

One could just boot up a Linux "live" installer USB drive and run fsck from there. Uncomplicated.


----------



## bakul (Oct 13, 2021)

With bhyve you can also use _virtio-9p_ to share a host directory with a Linux guest. For example, add something like the following to the bhyve command line:
`-s 8,virtio-9p,sharename=<host-dir-path>`

In the guest you need something like
`mount -t 9p -o trans=virtio,version=9p2000.L,rw sharename /mnt`

With this, `dd` on a large file (once cached) achieves about 5.2GB/s on the host and 227MB/s on the guest.


----------



## Menelkir (Oct 13, 2021)

FYI, ext2fs() works pretty well, and as far I've had to use it, sysutils/e2fsprogs worked well fixing issues with the file system, of course I don't know if there's some bugs that can prevent you to fix something really bad, but it worked in all of my use case scenarios. I never had a situation that these two tools was unable to give me access or unable to fix external drives under ext3 and ext4.


----------



## ziomario (Oct 13, 2021)

Menelkir said:


> FYI, ext2fs() works pretty well, and as far I've had to use it, sysutils/e2fsprogs worked well fixing issues with the file system, of course I don't know if there's some bugs that can prevent you to fix something really bad, but it worked in all of my use case scenarios. I never had a situation that these two tools was unable to give me access or unable to fix external drives under ext3 and ext4.



If I don't remember bad,ext2fs doesnt have the write support. Or if it supports it,it is not encouraged. So,without it,how can the errors be fixed with fsck ?


----------



## ziomario (Oct 13, 2021)

bakul said:


> With bhyve you can also use _virtio-9p_ to share a host directory with a Linux guest. For example, add something like the following to the bhyve command line:
> `-s 8,virtio-9p,sharename=<host-dir-path>`
> 
> In the guest you need something like
> ...



I'm not sure that bhyve is enough bug free with the assignement of phisycal disks. Some time ago I've assigned a sata disk (where I had installed netbsd) and the disk where I'd installed freebsd has been damaged. But not the disk where I'd installed netbsd. This is how I'd attached the physical disk :


```
bhyve -S -c 8 -m 8G -w -H \
    -s 0,hostbridge \
    -s 1,virtio-blk,/dev/ada1 \
    -s 6,virtio-net,tap0 \
    -s 29,fbuf,tcp=0.0.0.0:5900,w=1440,h=900 \
    -s 30,xhci,tablet \
    -s 31,lpc -l com1,/dev/nmdm1A \
    -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
    vm0
```

you can read what happened reading this post : https://forums.freebsd.org/threads/...try-to-boot-freebsd-in-multi-user-mode.82215/


----------



## Menelkir (Oct 13, 2021)

ziomario said:


> If I don't remember bad,ext2fs doesnt have the write support. Or if it supports it,it is not encouraged. So,without it,how can the errors be fixed with fsck ?


Nope, ext2fs have write support, and actually the performance is really good to both read and write. As far as I know, journaling isn't supported so be cautious.


----------



## Vull (Oct 13, 2021)

Menelkir said:


> Nope, ext2fs have write support, and actually the performance is really good to both read and write. As far as I know, journaling isn't supported so be cautious.


If ziomario had only read this very thread, that he himself started, he would already know these answers, and wouldn't have to ask repeatedly. I'm pretty well convinced he's just trolling us for his own amusement.


----------



## sidetone (Oct 13, 2021)

Vull said:


> I use ext2fs. It's part of the base system. Look up `man ext2fs`.





sidetone said:


> https://github.com/alperakcan/fuse-ext2 was already referring to sysutils/fusefs-ext2.
> 
> The last I remember, ext2fs(5) is for read-only access. Has that changed?





Vull said:


> It gives me read/write access. `chown`, `chmod`, everything I've tried. I don't know its history and have only been using it since FreeBSD-13.0. I don't use it for anything critical, just for scratch partitions and file transfers, because it doesn't keep a journal.





sidetone said:


> Write access on ext3 and ext4 too?





Vull said:


> Yes.


----------



## bakul (Oct 13, 2021)

ziomario said:


> -s 1,virtio-blk,/dev/ada1 \


I have never used physical disks with bhyve. Did you try other block device types such as `ahci-hd`? Also, `nocache` and `direct` _block-device-options_ may help.


----------



## ziomario (Oct 13, 2021)

Vull said:


> If ziomario had only read this very thread, that he himself started, he would already know these answers, and wouldn't have to ask repeatedly. I'm pretty well convinced he's just trolling us for his own amusement.



your belief is wrong. I'm on the freebsd forum from some time and I haven't any interest to troll. If I were an occasional user,maybe. Is it allowed to don't remember and to ask the same things because maybe I miss something or someone could have different informations from what I read even only a little of time ago ? Things change fast. I learned that crossing informations can be useful.


----------



## ziomario (Oct 13, 2021)

bakul said:


> I have never used physical disks with bhyve. Did you try other block device types such as `ahci-hd`? Also, `nocache` and `direct` _block-device-options_ may help.



thanks. your advice would have been useful before. Now, after the disk showed some serious problems I don't think I will risk again attaching a physical disk in bhyve anymore. But I take your advice into account.


----------



## dd_ff_bb (Oct 13, 2021)

ziomario said:


> Is bhyve enough secure when we give to it a physical disk instead of a virtual disk ?



ziomario this made me curious  (Actually im pretty sure i can install linux guest on ada1 if i start from scratch) 
Regardless real question is can i boot already installed linux so I have wifes' old disk on ada1 with ubuntu 20.04 installed.

First i tried to boot it with:

```
bhyve -c 2 -m 4G -w -H -s 0,hostbridge -s 4,virtio-blk,/dev/ada1 -s 5,virtio-net,tap6 -s 29,fbuf,tcp=0.0.0.0:5900,w=1280,h=1024,wait -s 30,xhci,tablet -s 31,lpc -l com1,stdio -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd ubuntuvm
```

Didnt boot fall back to uefi boot menu. Little bit tinkering found out it was installed in legacy mode

so i tried grub-bhyve:


```
root@m:~ # cat device.map
(hd0) /dev/ada1
root@m:~ # grub-bhyve -m device.map -r hd0,msdos1 -M 4G ubuntuvm

grub> ls
(hd0) (hd0,msdos5) (hd0,msdos1) (host)
grub> ls (hd0,msdos1)
        Partition hd0,msdos1: Filesystem type fat, UUID 522B-073D - Partition start at 2048 - Total size 1048576 sectors
grub> ls (hd0,msdos1)/

grub> ls (hd0,msdos5)/
lost+found/ boot/ swapfile etc/ media/ var/ bin dev/ home/ lib lib32 lib64 libx32 mnt/ opt/ proc/ root/ run/ sbin snap/ srv/ sys/ tmp/ usr/ cdrom/ core
grub> ls (hd0,msdos5)/dev/mapper/
error: file `/dev/mapper/' not found.
grub> ls (hd0,msdos5)/dev/      
fd pts/ shm/ console full null ptmx random stderr stdin stdout tty urandom zero
```

According to this document:
https://docs.freebsd.org/en/books/handbook/virtualization/#virtualization-host-bhyve

Creating a Linux® Guest section: there should be /dev/mapper/ in ubuntu installation but as you see above there isnt in this case.

I dont know enough ubuntu to move forward. If you have any suggestions i can try.


----------



## bsduck (Oct 13, 2021)

Menelkir said:


> ext2fs have write support, and actually the performance is really good to both read and write


I once tried to write something like 25GB of data (movies) to an ext4-formatted USB stick, and found it painfully slow. I ended up reformatting the stick as UFS so the process wouldn't need hours to complete. Maybe it's better depending on the disk, but at least in my case I wouldn't call that good performance.


----------



## Menelkir (Oct 13, 2021)

bsduck said:


> I once tried to write something like 25GB of data (movies) to an ext4-formatted USB stick, and found it painfully slow. I ended up reformatting the stick as UFS so the process wouldn't need hours to complete. Maybe it's better depending on the disk, but at least in my case I wouldn't call that good performance.


An hour ago I've copied files to an USB2 drive ext4 formated by 25~30Mb/s.


----------



## bakul (Oct 13, 2021)

dd_ff_bb said:


> I dont know enough ubuntu to move forward. If you have any suggestions i can try.


I used a normal file as a "disk" and installed from ubuntu-20.10-live-server-amd64.iso. Nothing magic. If you have enough space and are running zfs on the host, may be you can create a working disk image, copy all the useful bits from your wife's disk and then copy this working image onto a physical disk?


----------



## ziomario (Oct 14, 2021)

dd_ff_bb said:


> ziomario this made me curious  (Actually im pretty sure i can install linux guest on ada1 if i start from scratch)
> Regardless real question is can i boot already installed linux so I have wifes' old disk on ada1 with ubuntu 20.04 installed.
> 
> First i tried to boot it with:
> ...



what problem do u have ? U can try :

1) to install ubuntu on the disk /dev/ada1


```
bhyve -S -c 4 -m 8G -w -H \
-s 0,hostbridge \
-s 1,ahci-cd,/mnt/da1p1/vms/os/.iso/ubuntu-21.04-desktop-amd64.iso \
-s 2,virtio-blk,/dev/ada1 \
-s 3,virtio-net,tap0 \
-s 29,fbuf,tcp=0.0.0.0:5900,w=1440,h=900,wait \
-s 30,xhci,tablet \
-s 31,lpc \
```

2) to boot ubuntu :


```
bhyve -S -c 4 -m 8G -w -H \
-s 0,hostbridge \
-s 1,virtio-blk,/dev/ada1 \
-s 2,virtio-net,tap0 \
-s 29,fbuf,tcp=0.0.0.0:5900,w=1440,h=900,wait \
-s 30,xhci,tablet \
-s 31,lpc \
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
vm0
```


----------



## dd_ff_bb (Oct 14, 2021)

ziomario said:


> what problem do u have ? U can try :



I guess you got it wrong. I don't have any problem with bhyve installations, i already have my instances running.

I was just curios to test your question; if i can boot "linux distro which was installed on physical drive out side Bhyve" from Bhyve.

And i had to stop because of ubuntu/legacy obstacle thats it. It was more of a information than question.


----------



## ziomario (Oct 14, 2021)

I've understood that. For this reason I've suggested to try to install and boot linux on the physical disk ada1 using UEFI bootloader. The parameters that I have shown do exactly that.


----------



## dd_ff_bb (Oct 14, 2021)

ziomario said:


> I've understood that. For this reason I've suggested to try to install and boot linux on the physical disk ada1 using UEFI bootloader. The parameters that I have shown do exactly that.



Never mind, you can just dismiss my msg(s) for this post. Seems like we are not on the same page.


----------



## ziomario (Oct 14, 2021)

dd_ff_bb said:


> Never mind, you can just dismiss my msg(s) for this post. Seems like we are not on the same page.



yes,I don't understand you...


----------

