Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Which directories, and how, can I share between FreeBSD and Linux? In particular, how can I deduplicate respectively /usr/home and /home? I guess directly sharing a partition between both systems could lead to conflicting dotfiles, so that may not be the right solution. Is union-mounting the shared partition reasonable? This way, I could move the dotfiles into the "/" partition of each OS, and share the rest of the files into the shared partition.

Which filesystem should I use for the shared home partition itself? I have under 2GB RAM so I don't think ZFS will behave, from what I've read. Maybe ext2 will do? Any better options? EDIT: is write-to-UFS kernel support in Linux stable already?

  • Linux distro is LMDE.
  • Actually using PC-BSD but as far as I've read it should behave just as FreeBSD for this. Correct me if I'm wrong.
  • Partitions would be:
OS      Mountpoint FS    Size (GiB; Total:~160GB)
Linux   /          ext4  16
FreeBSD /          ufs   16
Shared  /mnt/home/ ext2? ~124    # EDITED: See below
Shared         -   swap  4

Any other partitions I should make? It's a workstation without "persistent" servers, but I may fool around with jails in FreeBSD. Maybe I should have a partition for those?

Disclaimer: I haven't actually used union filesystems before, and am new to BSD in general; feel free to propose better solutions :)

EDIT: How about adding a "dotfiles" tree in each root partition and union-mount it?

Mount points in FreeBSD:
/
/mnt/home/
/usr/home/: /usr/dotfiles/ U /mnt/home/            # /usr/dotfiles/ has priority

Example contents:
/usr/dotfiles/fchurca/: .cache .kderc
/mnt/home/fchurca/: .vimrc development/ Documents/ # .vimrc isn't platform-specific
/usr/home/fchurca: .cache .kderc .vimrc development/ Documents/

This way, it could work for all the (two at most) users of the box.

share|improve this question
    
Technically, /usr is read-only data that can be shared between hosts, but I wouldn't recommend sharing it for two entirely different operating systems. Using /home in both should be fine, as long as your user software is of similar versions. If tou just want to "play around with jails", use a VM. –  jordanm Jan 17 '13 at 6:02
    
With playing around with jails I meant that apart from starting doing my "usual work"* in BSD, I'd like to take jails for a ride. Should I make a partition for the jails? *: webdev and database; both are hosted on another box so I mostly use editors, clients, and network mounts in this one) –  fchurca Jan 17 '13 at 15:02

3 Answers 3

I have a laptop on which I'm multi-booting four OSes.

I was considering doing something similar with the home directory for Linux and BSD systems. I looked at zfs but there are some issues with version compatibility (and I only have 3 Gigs of Ram, so maybe that's pushing it). Also, I think Linux support for UFS is limited, so I'm leaning toward ext2.

I was thinking maybe that for /home/srobert/.config directory (and similar dotfiles), I could use a script that would execute on login, perhaps from .xinitrc, that would either link .config-freebsd to .config OR link .config-linux to .config, depending on the output of uname. I haven't tried this (yet) but it's a theory.

To quote the great Yogi: In theory, theory and practice are the same. In practice, they ain't.

share|improve this answer

I would recommend not to share the /home partition. The issue is many applications store their configuration and data in hidden files and directories in each user home directory. The risk is very high you do not use the very same version of these applications under both of the environments (say gnome, kde, gtk, firefox, thunderbird, VirtualBox, wine and the likes). If that is the case, upward, downward or architectural incompatibilities might mess up these files and make these applications unstable or worst make you lose data.

I just checked and I have more than one hundred of these files/directories in my home dir.

$ ls -d ~/.??* | wc -l
119

I would suggest to create a dedicated shared partition, mounted for for example in /export/shared, and possibly use links to share specific files and directories once you are sure they are compatible. Make sure you backup them before upgrading these applications on either side.

share|improve this answer
1  
The issue is precisely on how to share /home without the dotfiles conflicting :) –  fchurca Jan 17 '13 at 14:54

You should only share data partitions. Do not share any program partitions.

/home is fine but avoid bin, dev, etc, usr, var, opt, and pretty much anything other than home.

As for the filesystem, it will have to be something both kernels have drivers for. I'm not sure how good BSD's ext support is, but Linux's UFS support is good enough, which means that you probably want to stick with UFS or MSDOS. The swap partition can be shared as long as both recognize the same partition type for swap (which I believe they do, but I am not certain).

And if you're sharing partitions between operating systems don't do anything like trying to run one in a VM from the other. Operating systems need to have exclusive control over filesystems. Two different running operating systems that thing they both have exclusive control over a partition will lead to corruption real fast.

share|improve this answer
    
From what I've read, ext2 works in FreeBSD. ext4 doesn't, and ext3 has to be mounted as ext2. ¿How good is UFS support? As far as I know, write-support requires recompiling the kernel to enable it explicitly as it isn't considered stable. Then again, things may have changed. If so, which kernel version has stable write-to-UFS support? Also, both installations are physical, so simultaneous mounting is a non-issue :) –  fchurca Jan 17 '13 at 14:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.