How to differentiate between Sparse and non-sparse disk in OVM x86?

In case of OVM x86 people face lot of difficulties to figure out whether disk is sparse or non-sparse. If you are having good naming convention then you are lucky if not then you are in big trouble. I have figured out two ways to determine the nature of disk.

Case 1 :  Using OVM manager CLI.

I have connected to the CLI of OVM manager

[root@OVM-1 ~]# ssh -l admin OVM-1 -p 10000
admin@ovm-1’s password:

Issuing below command will show the mapping of disk to disk names.

OVM> list VirtualDisk
Command: list VirtualDisk
Status: Success
Time: 2014-10-14 20:25:48,246 IST
id:0004fb0000120000ad06906d5a735bd0.img  name:Non-sparse1-LIn1
id:0004fb0000120000ea645f4fa6a4abf8.img  name:Sparse-1-Lin1
id:0004fb0000120000f81558f292b2f52e.img  name:rootdisk-1

I am having naming convention with which I can tell which is sparse and non-sparse. If it is not there we can issue below command.

Here name I am taking from previous command. Have a close look at the “Max size” and “Used size”.

If the Max size is equal to Used size then it is non-sparse disk for sure. If Max size is greater than Used size then its sparse disk.

  • Sparse Disk :

OVM> show VirtualDisk name=Sparse-1-Lin1
Command: show VirtualDisk name=Sparse-1-Lin1
Status: Success
Time: 2014-10-14 20:26:00,547 IST
VmDiskMapping 1 = 0004fb0000130000e9a90559c1e2b127  [Mapping for disk Id (0004fb0000120000ea645f4fa6a4abf8.img)]
  Max (GiB) = 1.0
  Used (GiB) = 0.93
Shareable = No
Repository Id = 0004fb0000030000f1532acb312df8a2  [LinuxRepo-1]
Id = 0004fb0000120000ea645f4fa6a4abf8.img  [Sparse-1-Lin1]
Name = Sparse-1-Lin1
Locked = false

  • Non-Sparse Disk 

OVM> show VirtualDisk name=Non-sparse1-LIn1
Command: show VirtualDisk name=Non-sparse1-LIn1
Status: Success
Time: 2014-10-14 20:26:29,649 IST
VmDiskMapping 1 = 0004fb0000130000e70f5443092d366b  [Mapping for disk Id (0004fb0000120000ad06906d5a735bd0.img)]
  Max (GiB) = 1.0
  Used (GiB) = 1.0
Shareable = No
Repository Id = 0004fb0000030000f1532acb312df8a2  [LinuxRepo-1]
Id = 0004fb0000120000ad06906d5a735bd0.img  [Non-sparse1-LIn1]
Name = Non-sparse1-LIn1
Description = Non Sparse Disk for Linux 1 vm
Locked = false

Sometime people ask if the disk is fully utilized then how can they differentiate between sparse and non-sparse. I have simulated that case as well. Even if the disk is 100% utilized it will never reach the exact value of “Max Size”. Example of Sparse which I have shown below is shown after the disk is 100% utilized on VM level to which it is assigned 🙂

Case 2 : Checking the size of vDisk in Repository

Currently I have taken the putty session to physical server and jumped to the repository path where my vDisks are located.

[root@OVS-2 VirtualDisks]# pwd

After that I have issued below command to see the sparse and non-sparse disk.

If the first value is greater than or equal to second value then the disk is non-sparse. ex First vDisk.

If the first value is less than second value it is sparse disk. ex Second and Third vDisk.

[root@OVS-2 VirtualDisks]# ls -lsh
total 4.8G
1.0G -rw——- 1 root root 1.0G Oct 14  2014 0004fb0000120000ad06906d5a735bd0.img
956M -rw——- 1 root root 1.0G Oct 14  2014 0004fb0000120000ea645f4fa6a4abf8.img
2.9G -rw——- 1 root root  10G Oct 14  2014 0004fb0000120000f81558f292b2f52e.img


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s