Solved Accessing FreeBSD veracrypt volumes from Fedora Linux

I am using FreeBSD as a file server. I want to host some veracrypt volumes on this file server, but actually read and write the data from Linux using Samba. I ran into trouble as you can't create ext2-4 partitions in veracrypt on FreeBSD. Your options are: no file system, dos, and UFS. Veracrypt on Fedora Linux chokes when you try to directly mount a UFS encrypted volume. On Linux I couldn't easily read UFS, and I couldn't write it. This post is a bit of a ramble, showing how I found a work around.

Hopefully what I've done hasn't compromised the encryption!

Twice I created a 1TB encrypted volume using veracrypt on FreeBSD with UFS (Unix file system). I couldn't read either of them on FreeBSD, or Linux, with veracrypt. I get "wrong fs type, bad option, bad superblock on" etc. I don't know what went wrong. I created a small 10MB test volume. It works on FreeBSD but I can't read it on another linux (I use Samba share to see these FreeBSD files on Fedora).

I created another veracrypt volume with no file system on FreeBSD. I created a UFS file system on it within FreeBSD. I was checking that I could make a file system over a veracrypt volume. I could read and write this volume on FreeBSD.

Everyting below is done on the Fedora side, where the FreeBSD files are mounted through Samba.

I was able to bring veracrypt partitions from FreeBSD into Fedora Linux using to the veracrypt option not to mount file system. I installed the UFS module in Fedora and ensured it was loaded.

lsmod | grep ufs

fdisk recognizes the partition as FreeBSD.

sudo fdisk -l /dev/mapper/veracrypt1

I am able to mount it (but only read only). It works, I can see my files.

sudo mount -t ufs -o ufstype=ufs2 /dev/mapper/veracrypt1 /mnt/tmp mount: /mnt/tmp: WARNING: source write-protected, mounted read-only.

I unmount the volume but don't dismount it on veracrypt. So it is on the device /dev/mapper/veracrypt1. I overwrite the UFS file system with an ext4 file system.

sudo mkfs -t ext4 /dev/mapper/veracrypt1

I mounted that file system and put some files there for testing.

sudo mount /dev/mapper/veracrypt1 /mnt/tmp

Now I am able to mount that ext4 file system straight into Fedora Linux using veracrypt from the Samba share.
 
You’ll probably need to create the volume on Linux and save it to your SMB share.

If you need to access it from both Linux and FreeBSD, I would recommend formatting it with FAT32.

Edit: I’m in the car (not driving) and wasn’t fully paying attention. I see that this issue is now solved.
 
Back
Top