I am trying to create a virtual machine to be used to teach electronic health records for a class by giving each student a configured application s/he can then use, e.g., to record treatments. The application includes a database of several GB. I would like to give each student an individual database to work with, but would prefer not to have to give each student a separate copy of the database, when 99% of the database will be the same for all of them.
My current plan is to create the database on filesystem such as btrfs or zfs with a master copy of the database. To add a student, a script would take a snapshot of the filesystem (or preferably just a sub-tree at directory in the file system) and mount the snapshot with copy-on-write in a different place for each student. For example, if I had a /home/master, one might snapshot the master subdirectory and make it available at /home/adam and /home/eve. Now Adam and Eve can each have a complete database, with one master copy, but each time one of them updates the database, the blocks in the filesystem on which the modified parts of the database live would be copied. The additional space used is for modifications by each student.
I am trying to decide between zfs and btrfs. One advantage of zfs over btrfs appears to be that the snapshots can be auto-mounted without editing /etc/fstab - with btrfs, adding 30 students to the class would seem to require 30 entries in /etc/fstab. I have zero experience in zfs, and barely any experience with btrfs, so this will be a learning experience for me.
A couple of questions, please:
- For this application, are there any considerations other than mounting in choosing between zfs and btrfs?
- Should I explore some other alternative, along the lines of unionfs-fuse? A filesystem in userspace hs the advantage of not requiring root to create a copy, but at least unionfs-fuse does copy-on-write at the file level, not the block level, so each student would end up with a complete copy of the database. So, unionfs-fuse itself is out.
Thank you very much, in advance, for advice, opinions, and pointers.
P.S. My other challenge is to create scripting that is bullet-proof, because the virtual machine could be used in many classes at many institutions. Many instructors will not be very computer savvy, and I want to minimize support. But at least on this, I have a fair amount of experience, although not for anything this complicated.