Jump to content


Photo

Local LVHD SR and Thin Provisioning

Started by Andrew Miskell , 14 February 2010 - 06:16 PM
7 replies to this topic

Andrew Miskell Members

Andrew Miskell
  • 4 posts

Posted 14 February 2010 - 06:16 PM

Are there any plans to support thin provisioning on LVHD based SR's? I know I can convert the SR to ext3 and get thin provisioning support but would prefer not to have the space overhead that ext3 brings.

I'm really trying to decide between VMWare ESXi and XenServer, and while I'm rather impressed with XenServer, I wish it had the option of thin provisioning of disks on the default SR type.



Peter Bats Citrix Employees

Peter Bats
  • 549 posts

Posted 15 February 2010 - 07:27 PM

What makes you believe that the ext3 filesystem gives you space overhead compared to LVHD (which is LVM based)?

Peter



Andrew Miskell Members

Andrew Miskell
  • 4 posts

Posted 16 February 2010 - 04:12 AM

The fact that an ext3 backed SR eats up 29.6gb for metadata/overhead on a 579.3gb disk, while LVM uses 4mb on the same disk.



Roger Klorese Citrix Employees

Roger Klorese
  • 1,378 posts

Posted 16 February 2010 - 04:20 AM

Much of that overhead is unnecessary when a ext3 filesystem is used for virtual disk storage.

From http://wiki.archlinux.org/index.php/Ext3_Filesystem_Tips --

Reclaim Reserved Filesystem Space

Ext3 partition contain a used space of 5% for special reasons by default. The main reason for such space is so root can log in even when the filesystem becomes 100% used. Without this option, the root user might not be able to log in to "clean up" because they system could become unstable, trying to write logs to a 100% full system for example. The other reason is to help with less fragmentation on the filesystem.
The issue with this is that hard drives are getting so big the 5% can add up to be quite a large amount of wasted space. (eg. 100 GB = 5 GB reserved). Now if you separate your filesystems to like /home for example it might be a good idea to adjust these and reclaim that wasted space. It's a safe bet to leave your / filesystem at 5% reserved just in case. Leave reserved space for filesystems containing /var and /tmp also or else you'll end up with problems.

Now to change your reserved space to 1% of the drive, which is fair for non-root filesystems.

# tune2fs -m 1 /dev/sdXY

The main reason for the overhead is to avoid fragmentation on dynamically allocated filesystems, where blocks are added and deleted, added and deleted, frequently. By tuning the margin down to 1% -- or, since it's not a server's root filesystem, 0% -- you can reclaim nearly all of that space.



Andrew Miskell Members

Andrew Miskell
  • 4 posts

Posted 16 February 2010 - 08:42 PM

Roger,

That was it, I forgot ext3 reserves 5% of the space for root only use (I'm a Solaris/Tru64/AIX admin by trade, so I'm more familiar with ZFS/AdvFS/JFS2).

I tuned the parameters down to 0% and it released all that space!

However, I'm still curious as to why Thin Provisioning is enabled for LVM on other disk type FC/iSCSI on not on local storage.



Pål Tuv Members

Pål Tuv
  • 7 posts

Posted 22 March 2010 - 09:53 AM

Could you point me in the direction on how to do this?

I tried using tune2fs as described above, but this is my result:

> root@xen dev]# tune2fs -m 1 /dev/sda3
> tune2fs 1.39 (29-May-2006)
> tune2fs: Bad magic number in super-block while trying to open /dev/sda3
> Couldn't find valid filesystem superblock.

Edited by: Pål Tuv on Mar 22, 2010 5:54 AM



Roger Klorese Citrix Employees

Roger Klorese
  • 1,378 posts

Posted 22 March 2010 - 11:55 AM

That works only for ext3, not for (default) LVM/LVHD.



Pål Tuv Members

Pål Tuv
  • 7 posts

Posted 22 March 2010 - 09:00 PM

My local SR is ext3 with thin provisioning.

> \[root@xen dev]# mount
> /dev/sda1 on / type ext3 (rw)
> none on /proc type proc (rw)
> none on /sys type sysfs (rw)
> none on /dev/pts type devpts (rw)
> none on /dev/shm type tmpfs (rw)
> none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
> sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
> /dev/mapper/XSLocalEXT--376f8ac9--2096--76cd--e1d2--e765485a9305-376f8ac9--2096--76cd--e1d2--e765485a9305 on /var/run/sr-mount/376f8ac9-2096-76cd-e1d2-e765485a9305 type ext3 (rw)

> \[root@xen dev]# df -h
> Filesystem Size Used Avail Use% Mounted on
> /dev/sda1 3.8G 2.1G 1.6G 58% /
> none 376M 0 376M 0% /dev/shm
> /dev/mapper/XSLocalEXT--376f8ac9--2096--76cd--e1d2--e765485a9305-376f8ac9--2096--76cd--e1d2--e765485a9305
> 268G 3.8G 251G 2% /var/run/sr-mount/376f8ac9-2096-76cd-e1d2-e765485a9305

Edited by: Pål Tuv on Mar 22, 2010 5:05 PM

And as I'm typing the post, it dawns on me ;)
tune2fs -m 1 /dev/mapper/XSLocalEXT--376f8ac9--2096--76cd--e1d2--e765485a9305-376f8ac9--2096--76cd--e1d2--e765485a9305

Edited by: Pål Tuv on Mar 22, 2010 5:07 PM