Some time ago, I gave you a second review of XenServer, a
Xen-appliance with paid support from Citrix, which comes with some rather useful and handy capabilities,
including remote management via XenCenter. All in all, a handsome product, with a corporate price tag for those
who can afford it.

One of the problems, so to speak, with XenServer, is that does not allow you to add local storage repositories,
i.e. local disk, one or more, using XenCenter. True, you are probably not supposed to keep virtual machines on
your local disk, both for redundancy and performance, but you just might, so why be limited? Let's unlimit
ourselves.

Task at hand

So what we want to achieve is a successful configuration of a local storage repository on our local disk, which
shares the same resources with the server, including the main storage LVM, as well as a small standard share
reserved for root. How do we go about this task?

There are some two or three ways you can try to achieve this. I will mention them all. Please note that all
solutions here are somewhat ugly and complex and require the use of the command line. You will probably not
like them and prefer to use your own Xen or KVM setup with full local storage control. Still, if you care.

Option 1: Mount local directory

This is the simplest task. If you have a local directory with ISO images, e.g. /vm/iso, which you have
populated using scp command for instance, then you want to have that repository visible in XenCenter. However,
as we've already mentioned, the program does NOT allow adding local storage through its GUI interface.

When you run that command, if successful, it will return a UUID for the created storage repository. Please
note, you can repeat the same command as many times as you want, and each time it will create a new storage repository, which will show in your GUI afterwards as a separate entry.

And then, when you try to install the VM, you will find Local listed. Notice the two identical entries, which
will show up if you enter the same command twice, so do note this as this could confuse you. Not sure if this
is a bug, but this is how it works.

Option 2: Working with LVM and not recommended

This is a far more difficult and complex setup. It involves working with the LVM storage spanning your local
disks, which is used to contain your virtual machine configurations and disks.

What you will want to do is create a new LVM on your disk and then add it as a storage for your operating
system images or anything else you need. You will have to use LVM commands to achieve this. Luckily, LVM is
flexible and allows making some pretty drastic changes on the fly, like resizing, allocation, addition and
removal of volume groups and volumes, without having to reboot the system.

The procedure is elaborated in rich detail in one of the posts on Citrix forums; for details hop below into the
More Reading section. Anyhow, what you need to do is find your unallocated disk space and create a new volume
group. Alternatively, resize an existing one and then create a new one from the freed space. Then, you will
need to create a volume, format it and finally mount it for use.

Some screenshots of this ugly activity:

Option 3: Existing default ISO dir

You can also use the existing /opt/xensource/packages/iso directory for storing
ISO images, although it is somewhat small and might accommodate only a small number of files. As a hack you
could symbolically link this directory to another disk or partition where you might want to keep the images.

Adding new disks is virtually identical to what we have done in the first step. Add disk, make sure it is
detected, create a partition table and format it. Then, mount it on some mount point in your system. Finally,
create a new storage repository:

More reading

And an unrelated - use
Linux Samba sharing to fake Windows CIFS. The actual post is in Spanish, but the explanations and the images
are self-explanatory. You really don't need any translations. So there you go, a bonus thingie for you.

Conclusion

Adding storage repositories in this manner may seem awfully complex to you, especially if you've used KVMstorage management or ran Xen from the command line
before. LVM does add a lot of operational flexibility, but it makes administration less accessible to most
users. Furthermore, the lack of filesystem transparency creates a problem when you need to figure out a
special, custom setup. What if there's a new type of repository available? In standard Linux, you would mount
the new filesystem somewhere, and that's all, problem solved. The underlying system would figure out what
protocol or drivers might be needed. On the other hand here, the distinction with XenServer turns a simple task
into a big project.

Of course, local storage is never a good idea for keeping virtual machines, because it makes backups, recovery
and accessibility across the data center more cumbersome, as well as introduces some capacity and performance
penalty especially when scaling out, but it does highlight the way XenServer is designed. With this tutorial in
hand, your mission might be tad simpler after all. At least, you learned about some remote access and command
line use, and just briefly touched the LVM management. Should come handy.