Open main menu

OpenVZ Virtuozzo Containers Wiki β

Changes

In-place VM disk expand

2,386 bytes added, 13:31, 21 December 2015
add TRD for prl_disk_tool
=== Feature ===

prl_disk_tool resize --resize_partition /in-place VM disk expand

=== Description ===

the prl_disk_tool utility now can expand VM disks in-place.

<code>prl_disk_tool resize</code> worked in-place even before
<code>prl_disk_tool resize --resize_partition</code> now expands disk, last partition (in case of logical paritition, the extended container as well) and its filesystem.

As before, you will need:

* <code>libguestfs-winsupport</code> for last ntfs partition
* <code>libguestfs-xfs</code> for last xfs partition
* <code>btrfs-progs</code> for last btrfs partition

The approximate algorithm is as following (for GPT):

# part-list -> (start, end); blockdev-getsize64 -> diskEnd; store partition attrs
# create overlay image of size newSize on top of current
# debug sh 'sgdisk -e /dev/sdaN' (working on libguestfs API)
# part-del /dev/sda N
# part-add /dev/sda attrs.type start (blockdev-getsize64 - (diskEnd - end))
# restore partition attrs
# stretch filesystem (resize2fs, ntfsresize etc)
# prl_disk_tool merge --external overlay (qemu-img commit)

For MBR, we avoid step (3) and repeat (4)-(5) for extended partition before resizing logical (if needed).

If something goes wrong before (8), we just remove overlay and nothing will change to original image. Overlay is lightweight: for 1GB full disk it used only 6.3Mb of space (I think it's affordable).

=== Products ===

Virtuozzo 7

Packages

* prl-disk-tool >= 7.0.7
* libguestfs >= 1.31.7
* btrfs-progs >= 4.2 (optional)
* libguestfs-winsupport >= 7.2.1 (optional)
* libguestfs-xfs (in dependencies)
* qemu-img >= 1.5.3-86

=== Testing ===

Need to test the following cases:

* resize --resize_partition /works for ext2/ext3/ext4/ntfs/btrfs/xfs/swap last partitions
* it works for GPT partitions, preserving partition attributes
* it works for MBR partitions (primary/extended/logical), preserving partition attributes.

=== Known issues ===

* only listed filesystems are supported
* LVM is not supported (working on it)
* GPT disk GUID is not preserved (it may cause specific OSes to fail - need to check which ones)
* Resizing drops internal snapshots (working on it)

=== Person responsible for the feature ===

Maxim Perevedentsev (mperevedentsev at virtuozzo.com)

== Links ==

* [https://lists.openvz.org/pipermail/users/2015-December/006670.html TRD in users@ mail archive]

[[Category: TRD]]