Monday, October 19, 2009

Managing Disk space with OpenVZ

You can increase the limit from the host system (VE0) only. This is how:

1. Get the current values for disk quota:

# vzquota stat 123
resource usage softlimit hardlimit grace
1k-blocks 327664 1048576 1153434
inodes 18857 200000 220000

2. To increase the disk space quota, use vzctl set --diskspace. For example, we want to increase it by a factor of 2:

vzctl set 123 --diskspace $(( 1048576*2 )):$(( 1153434*2 )) --save

3. To increase the disk inodes quota, use vzctl set --diskinodes. For example, we want to increase it by a factor of 3:

vzctl set 123 --diskinodes $(( 200000*3 )):$(( 220000*3 )) --save

Note: shell does not support floating-point arithmetics, i.e. you can not use expressions like $(( 220000*1.5 )). To use floating point, try bc instead, something like this: $(echo 220000*1.5 | bc).

Disk space and inodes are different things. Inodes identify the physical location on a disk where a file resides in unix filesystems. The inode count reflects the number of files on the server, not the amount of space used. This allows for multiple paths (hard links) to point to a single file.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.