What parts of the /usr subdirectory are usually shared in common practice without introducing any system instabilities? My intent is to share share-able parts of the /usr subdirectory among VM's of the same configuration to conserve virtual HD disk space.

Plan A is to:

  1. Install OS: I haven't found an option during the installation process to point a /usr subdirectory to a remote NFS share so all /usr subdirectories will have to be installed for now on the local drive. Will have to resize VM hard drive later.
  2. Configure network settings
  3. Configure /etc/fstab point to individual remote /usr shares.

Plan B is to:

  1. Attach target new VMHD to baseline VM
  2. Manually copy / subdirectories from a baseline VM to new VMHD and mkdir /dev /proc, etc.
  3. Install grub 2 on new hard disk, (grub-install /dev/sdb in my case)
  4. Detach new VMHD from baseline machine and attach it to new VM
  5. Boot new VM, do Plan A 3 and 4.

Are these methods good? Is there a more proper, better or quicker way?

I did Plan B, the new machine booted to grub but keeps trying to find the baseline host's HD which is being referred to by its UUID. I removed all mention of the baseline host's UUID from /boot/grub/grub.cfg on the new machine but grub still keeps trying to find it. I don't know of any other configuration files that grub uses at boot time besides the grub.cfg file that refer to hard disks.


You can share all of /usr as long as all the virtual machines are running identical (or near-identical) versions of the same unix distribution on the same processor architecture (if you have different architectures, you can share /usr/share, but it's probably not worth it). You may or may not want to share /usr/local. If you don't, make it a separate mount point in each VM, or make it a symbolic link to something like ../opt/local inside /usr.

You must take care that /usr is mounted read-only in each VM, or that you use a filesystem that allows sharing. Note that if /usr is mounted as read-only in any VM, even one that is hibernating, you cannot write to /usr in any way. So it would probably be a lot more convenient (but perhaps slightly slower) to mount /usr through a remote filesystem rather than from a disk image inside each VM. If you're using a single virtual machine technology, use its shared folder feature if available (so /usr is mounted at some place on the host). Otherwise use NFS, with the host exporting the directory (again, the host has the directory mounted somewhere).

For the installation, most installers should allow you to mount /usr as NFS in “expert mode”. Accessing shared folder is likely to be harder at this stage. If you can't make it, make /usr a separate filesystem on a separate virtual disk, then copy the contents and get rid of the virtual disk.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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