Shared data between multiple distros

Inspired by the recent discussion about multi-booting I would like to know how do you manage to share the files between multiple different distros?
I am not a distro-hopper and most of the stuff I try runs in VMs, so I’m unsure what is the best way. I know that sharing the same home partition wouldn’t be the brightest idea, especially in my case since the distros will use different filesystems and DEs. A common data partition then? Is it really needed if the distros can access the files of each other anyway?
Concerning filesystems one is ext4 on LUKS, another compressed (zstd) btrfs (not encrypted).

Just to be clear, you are trying to share data across your VMs or across different distros you are multi-booting?

Across different distros I’m planning to multi-boot :slight_smile:

1 Like

There are a lot of ways you can do it.

One easy way is to create a data partition that you mount inside every distro and then symlink it to wherever you want it.

For example, you could mount it at /data and under that you could have /data/downloads, /data/Documents, /data/mozilla, etc, etc.

Then you could symlink or bind mount those directories to ~/Downloads, ~/Documents and ~/.mozilla so no matter which distro you were using you have your Downloads, Documents and Firefox profile but with little risk of cross contamination. There are probably more directories you want to share than that but hopefully that is enough to demonstrate the idea.

I like keeping my /home separate for each distro to avoid any weird conflicts but some people just share the entirety of /home.

I do something similar but slightly more complicated with zfs. I carve up my data into datasets and mount it into each Linux distro in /etc/fstab. I even put the different distros in datasets in the same pools. I believe you could something similar with btrfs and subvolumes. For example, at this moment I am in Fedora and here is df -h

Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                  32G     0   32G   0% /dev
tmpfs                     32G  355M   31G   2% /dev/shm
tmpfs                     32G  2.4M   32G   1% /run
zproot/ROOT/fedora/root  523G  8.3G  514G   2% /
tmpfs                     32G   97M   32G   1% /tmp
/dev/nvme0n1p1           949M  663M  286M  70% /boot
zproot/ROOT/fedora/home  518G  3.4G  514G   1% /home
zpssd/data/steam         864G   71G  793G   9% /home/dalto/.local/share/Steam
zpssd/data/minecraft     794G  364M  793G   1% /home/dalto/.minecraft
zpssd/data/mozilla       794G   63M  793G   1% /home/dalto/.mozilla
zpssd/data/dotsteam      793G  256K  793G   1% /home/dalto/.steam
zpssd/data/thunderbird   801G  7.5G  793G   1% /home/dalto/.thunderbird
zpssd/data/dotvmware     793G  256K  793G   1% /home/dalto/.vmware
zpssd/data/appimage      794G  193M  793G   1% /home/dalto/Applications
zpssd/data/pictures      1.3T  454G  793G  37% /home/dalto/Pictures
zpssd/data/qemuvms       840G   47G  793G   6% /home/dalto/qemu
zpssd/data/vmware        1.2T  386G  793G  33% /home/dalto/vmware
zpmain/data/documents    346G  113G  234G  33% /home/dalto/Documents
zpmain/data/music        390G  157G  234G  41% /home/dalto/Music
zpmain/data/vmstorage    930G  697G  234G  75% /home/dalto/vmware/vmstorage
zpmain/data/downloads    605G  372G  234G  62% /home/dalto/Downloads
zpmain/data/games        1.9T  1.7T  234G  88% /storage/games
zpmain/data/data         323G   90G  234G  28% /storage/data
tmpfs                    6.3G   56K  6.3G   1% /run/user/1000

It is carved up even more in Arch-based distros because I have datasets for my yay and pacman caches.

The result is that no matter which distro I am in, most everything is more or less the same from apps/data perspective.

3 Likes

Thank you! That was pretty much how I was going to do it. For now I want something simple, because I am not very familiar with btrfs. One reason to use it for me is to learn it, while having another distro with the familiar and safe filesystem (ext4).

1 Like

Pretty much mounting partitions in each of the operating systems.
The trouble starts with Windows if you multi boot with it. There’s NTFS support available in Linux but it’s painfully slow. like an order of magnitude slower than in windows.
Going the other way around there’s a proprietary (commercial) ext3 and ext4 driver from paragon allowing mounting of these partitions in Windows, but last time i tried it, half a year ago it was laggy and unreliable. I guess exFAT could also be a solution, but it’s also slow.

1 Like

I forgot to mention it yesterday, but another thing which bothers me is sharing the same encrypted swap partition. Would it be too complicated to set up? (With hibernation support). I usually just have a swap file inside encrypted root partition, so unfortunately have no experience with that either :confused:
What complicates things is that one distro is of Gentoo-family (no systemd based initramfs, etc…), another - Arch. I am afraid the information I’ve read in the Arch wiki may not be sufficient…

You’ve probably been through this:
https://wiki.archlinux.org/index.php/Dm-crypt/Swap_encryption
but it appears to be that you can have what you want under the control of the kernel, rather than the distro itself (if you get what I mean), and thus shouldn’t run into any oddities even with Gentoo! (provided you didn’t drop that part of the kernel, that is!)

Hibernation support does complicate things quite a lot though. Good luck! Masybe a Stack Exchange (or AskUbuntu) style question?

1 Like

Yep, I’ve read that and about leaving it to the kernel I have a slight idea how it may work (or not work), but unfortunately lack knowledge and experience to be sure.
Well, the mere fact that I have such newbie questions clearly indicates that I am not prepared for this kind of set-up.
Reading through Gentoo wiki in my spare time :sweat_smile: and going to try to set up something similar in a VM later. Just decided to ask here while I am at it, maybe somebody has done it and can share some tips or links.

Thanks, I am just learning, it is going to be a useful experience in any case.