1

Background

First off, this is a continuation of How can I use unique hostnames across VMs with a shared root filesystem? Is this method even recommended? I started a new thread because the edits and comments were veering off topic, and this isn't the type of forum where I should be asking multiple questions on the same thread. Besides, my basic question of Is this recommended? had already been answered: no.

Before, I was attempting to share an entire root filesystem across virtual machines and picking a few directories to have different contents on each machine (e.g. /var). I learned, however, that only a few directories in / should be shared (in my case, /home, /usr, and /opt), but despite learning quite a bit from the accepted answer, I'm still unsure of how to actually implement this.

My Setup

Currently I have one VirtualBox VM running, which is a basic Debian install with all system directories (e.g. /home, /var, /tmp) on one partition on the first drive. Future machines will start with clones of this first drive. The second drive is used as a PV as part of VG shared.

  • Host machine: Arch (5.10.4-arch2-1)
  • Guest machine: Debian 10
    • Primary drive: 50GB dynamically allocated VDI, appears as /dev/sda
      • Partition 1
        • Takes all available space
        • Appears as /dev/sda1
        • Ext4 filesystem
    • Shared drive: 16GB dynamically allocated VDI, appears as /dev/sdb
      • Partition 1
        • Takes all available space
        • Appears as /dev/sdb1
        • Contains a VG (named shared) with three (roughly) equal LVs
          • Each LV takes ~1/3 of the space
          • Appear as /dev/shared/usr, /dev/shared/home, and /dev/shared/opt
          • Ext4 filesystems

Here are some LVM outputs and the contents of /etc/fstab:

LVM/fstab

I haven't added home or opt entries yet to fstab yet; I'm waiting to get usr working because that's been the most challenging.

Next steps

From a live ISO, I continue by mounting the filesystem at /mnt and backing up /mnt/usr and copying its contents to /mnt/dev/shared/usr, temporarily mounted at /mnt/mnt/shared/usr.

root@archiso ~ # mount /dev/sda1 /mnt
root@archiso ~ # cd /mnt
root@archiso /mnt # mv usr usr.bak
root@archiso /mnt # mkdir usr
root@archiso /mnt # mkdir -p mnt/shared/usr
root@archiso /mnt # mount /dev/shared/usr mnt/shared/usr
root@archiso /mnt # cp -rL usr.bak/* mnt/shared/usr
root@archiso /mnt # vim etc/fstab # add last line as shown in section above

The Issue

When I reboot to the Debian system, I see a timeout as systemd attempts to mount /dev/shared/usr.

timeout

If I login as root, I notice that /usr is mounted, but as read-only.

Goals

My ultimate goal is to manage secondary memory efficiently by sharing the forementioned directories across machines. My immediate goal is to mount /usr from the LV on startup, so my multiple VMs can use it (one at a time, unlike through NFS which can serve multiple machines).

If what I'm trying to do would be better accomplished through other means (like NFS), point me in the right direction and I will try things that way, instead. It's worth noting that I'm not experienced with LVM or NFS.

8
  • If no-one mentioned this on your other question, take a look at how Sun Microsystems handled this in the '90s - they did diskless and almost-diskless workstations with highly shared filesystems really well Commented Jan 12, 2021 at 15:58
  • @roaima Is this what you mean? Wikipedia: Diskless node Commented Jan 12, 2021 at 17:26
  • No. The "diskless" is less important than the "Sun Microsystems" Commented Jan 12, 2021 at 17:33
  • 1
    @roaima I just realized you probably didn't get notified for my last two comments, so I'm tagging you again. Commented Jan 13, 2021 at 15:14
  • 1
    I've been looking at drbl.org to see if they've got up-to-date documentation on what can be shared read-only and what must be read-write and local. Unfortunately it looks like the Sun Microsystems stuff I remember of, has been subsumed into Oracle and the documentation updated and pruned heavily Commented Jan 13, 2021 at 15:44

0

You must log in to answer this question.

Browse other questions tagged .