Linux Virtualization Adding Storage to Guests: Difference between revisions
Jump to navigation
Jump to search
Line 13: | Line 13: | ||
Create the storage volume with: | Create the storage volume with: | ||
[[virsh vol-create-as]] | [[virsh vol-create-as|virsh vol-create-as --pool <pool-name> --name <volume-name> --capacity <capacity> --format <fomat>]] | ||
==Shut Down the Guest== | ==Shut Down the Guest== |
Revision as of 14:53, 30 June 2017
External
Internal
Add a Storage Volume as Block Device to Guest
Provision the Storage Volume
Create the storage volume with:
virsh vol-create-as --pool <pool-name> --name <volume-name> --capacity <capacity> --format <fomat>
Shut Down the Guest
virsh shutdown <guest-name>
Note that is also possible to add the device while the guest is running, see virsh man page for more details.
Configure the Guest to Mount the Storage Volume at Boot
Use virsh attach-disk as shown in the example, by specifying the file-based storage volume path, as shown by the virsh vol-list command, and the device name under which the disk is exposed to guest, typically "vdX", where X is "a", "b", etc:
Start the Guest
virsh start <guest-name>
Upon startup, the new disk should be available as /dev/vdX.
Partition the New Disk
Partition the new disk with
fdisk /dev/vdX
More details about fdisk are available here: