The initial disk size is 14
GB, with 6 GB allocated to a swap partition, leaving about 5.4 GB available in
/dev/sda3, the partition in which Cisco Prime
Network Registrar runs. This is certainly too small for all
installations. Therefore, you may need to increase the size of the disk. There
are two steps to this process.
Increasing the size
of the disk must be done when the VM is not running. You may do this before you
install the VM, when the VM is certainly not running, or you may do this after
you have brought up the VM and it has already run. If the VM is running, you
must shut down the VM before you increase the size of the disk. Once the VM is
not running, use the
truncate and
virt-resize
commands to create a larger disk and copy the data onto the larger
disk, as well as to change the partition table and resize the filesystem to use
the additional space.
Following is an
example of how you might use these commands to increase the size of the disk
from the default size of 14 GB to 16 GB. In practice, you almost certainly
would use a larger size than 16 GB. The new size of the disk is specified on
the
truncate
command.
root:tsegi$ truncate -s 16G @BUILDNAME-disk1.big.raw
root:tsegi$ virt-resize --expand /dev/sda3 @BUILDNAME-disk1.raw @BUILDNAME-disk1.big.raw
Examining @BUILDNAME-disk1.raw ...
100%
[[▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒]] --:--
**********
Summary of changes:
/dev/sda1: This partition will be left alone.
/dev/sda2: This partition will be left alone.
/dev/sda3: This partition will be resized from 7.5G to 9.5G.
**********
Setting up initial partition table on @BUILDNAME-disk1.big.raw ...
Copying /dev/sda1 ...
100%
[[▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒]] 00:00
Copying /dev/sda2 ...
100%
[[▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒]] 00:00
Copying /dev/sda3 ...
100%
[[▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒]] 00:00
Resize operation completed with no errors. Before deleting the old disk, carefully check that the resized disk boots and works correctly.
The operation in the
above example took about 5 or 6 minutes on a moderately powerful machine. The
time it will take on your machine will vary depending on a variety of factors.
The
truncate
command creates a new disk file of a specified size and the
virt-resize
command recreates the partitions of the input disk out the output disk, copies
the data from the original disk file onto the new disk file, and enlarges the
filesystem in the specified partition to encompass everything in the partition.
After completing this operation, replace the disk of the VM with the new disk
using the virtual machine manager.
![](https://www.cisco.com/content/dam/en/us/td/i/templates/note.gif) Note |
Though once you
have used the new disk, the data on the original disk is old and should not be
used, it is still a working disk and could be saved as a backup. If you
returned to using the original disk, all memory of the processing performed
while the new, larger disk was operating will be lost, and serious conflicts
between IP addresses granted to DHCP while the new disk was in use and the DHCP
server's future activity when using the old disk will occur.
|
If you increase the
size of the disk before the installation of the VM, you must rename the new
disk file to be the same as the original disk file: @BUILDNAME-disk1.raw, as
that is what the installonkvm script expects the name of the disk file to be.