Setup Vservers on the Shared Disk

"/dev/drbd0" now has a filesystem on it and we can use it for our vserver setup. Since this is Debian, the configuration directory for vservers is "/etc/vservers" and the data directory is "/var/lib/vservers". If your setup is different, make sure you adjust as necessary. We want to keep both these directories on the shared DRBD disk, so we'll mount the DRBD disk somewhere else on our filesystem, and then store the "/etc/vservers" and "/var/lib/vservers" directories in separate directories on the DRBD partition. Then we'll use "mount -o rbind" to bind the appropriate directory to the right place on our filesystem. We'll also want to copy over anything that's already in those directories to the new directory on the DRBD disk. We also could have created two DRBD disks and used one for "/var/lib/vservers" and one for "/etc/vservers". You need to run the following commands on the Primary node: mkdir /home/drbd0 mount -o tag /dev/drbd0 /home/drbd0 mkdir -p /home/drbd0/vservers/{root,conf} rsync -avH /var/lib/vservers/ /home/drbd0/vservers/root/ rsync -avH /etc/vservers/ /home/drbd0/vservers/conf/ mount -o tag,rbind /home/drbd0/vservers/root /var/lib/vservers mount -o rbind /home/drbd0/vservers/conf /etc/vservers The locations we are using, "/home/drbd0", /home/drbd0/vservers/root", etc. are, of course, totally arbitrary. Use whatever locations you want. You'll also need to run "mkdir /home/drbd0" on the Secondary as well. Nothing else is needed on the Secondary. If you had vservers already installed, you may want to "rm -rf /var/lib/vservers/*; rm -rf /etc/vservers/*" before you mount the DRBD disk to those directories. If not, you'll "lose" all the space that those directories are taking up on your disk. The only thing to note here is the use of the "tag" option when mounting the data directory. If you want to have hard drive limits on our vservers, then you need the file system mounted with the "tag" option. If you don't plan to use hard drive limits on your vservers, then you don't need that. (And you can always remount it later with different options if you change your mind.) Now set up your vservers and run them like normal. Everything should work "like normal" except that actually everything is being replicated real-time from the Primary to the Secondary. Let's test if this is true. Shut down your vserver(s) on the Primary. Then unmount the directories. Finally change the state of the DRBD disk to Secondary. Here's the commands (once you've shut down your vservers). umount /var/lib/vservers umount /etc/vservers umount /home/drbd0 drbdadm secondary vs Now go to the other node (the original Secondary node) and do everything in reverse - change DRBD to primary then mount everything and finally start your vservers. Here' the commands:drbdadm primary vs mount -o tag /dev/drbd0 /home/drbd0 mount -o tag,rbind /home/drbd0/vservers/root /var/lib/vservers mount -o rbind /home/drbd0/vservers/conf /etc/vservers Now start up some vservers. Everything should run just like it did on the other node.