[CentOS] Question about storage for virtualisation

Tue Jun 26 16:29:46 UTC 2012
Gordon Messmer <yinyang at eburg.com>

On 06/25/2012 06:05 PM, Nicolas Ross wrote:
>
> If I set vcpu let's say to 2-3 for a single vm, does this mean that
> those CPU are dedicated to that vm or many vm can share the same
> physicial cpus ?

Normally, they won't be dedicated.  You cannot assign more CPUs to a 
guest than there are in the host system, but you can overcommit CPUs in 
general.  That is, if you have 8 cores, you can create two guests with 6 
virtual CPUs each.  If the guests both become busy enough to fully 
utilize 6 CPUs, the performance of each will naturally be degraded 
relative to only one guest being busy enough to fully utilize 6 CPUs.

While CPUs cannot be overcommitted, memory can.  Again, if you 
overcommit memory, the host will swap excess utilization and severely 
degrade guest performance.  Take care to avoid doing this.

> So, I was wondering what's the best for managing storage for VMs ? I see
> mostly recomandations for LV for storing VM's disks. It seem to helps to
> create snapshots for backup purposes. Is this the fastest way of
> creating backups ? And will data access be faster that if I use regular
> files ?

Yes, performance of guests backed by LVs will be significantly better 
than the performance of guests backed by regular files.

No, you cannot make reliable backups of guests using snapshots of the 
LV.  A snapshot taken at any given time may have inconsistent data.  Run 
your backup software in the guest rather than in the host.  Under a 
Linux guest, you're able to snapshot filesystems and make backups.

When you make a snapshot under LVM, the file system contained therein is 
made consistent (though I'm having trouble finding actual documentation 
to that effect) before the snapshot is taken.  If you have open files, 
you may need to take additional steps to make that data consistent (as 
you would if you were backing up a MySQL database).  Taking a snapshot 
of a running KVM guest will not make data consistent, so you won't be 
able to reliably make a backup that way.

Finally, do not use snapshots as your primary means of backup.  If your 
media fails, you will lose your data.

> As for the guest paritions, I am accustomed of separating my servers
> disks with separate /, /usr, /var, /home and /data partitions. I can't
> recall today why I started doing this, 15 years ago, but I still like it
> that way and continue to do so. Do I still "need" to do this with VMs ?

I don't believe there's any more or less need to do so.  I would 
strongly recommend that you not segregate / and /usr.  Fedora and future 
versions of RHEL/CentOS will expect a unified / and /usr.