The vzctl partadd command is used to create a new drive inside your Container by mounting it to a loopback file on the Hardware Node. After the command execution, the mounted drive becomes visible
X:\vz\root\CT_ID\ folder and.efd format in the X:\vz\private\CT_ID folder.You can then use the newly created Container drive in the same way as you would use it on a stand-alone server: format it, create new files and folders within the drive, etc.
The vzctl partadd command has the following syntax:
vzctl partadd CT_ID --drive CT_drive --size drive_size
[--file File_Name]
The options that can be passed to vzctl partadd are explained in the table below:
Option |
Description |
|
Mandatory. The name of the Container drive to be created inside the Container. Upon the command completion, this name will be shown as the name of the folder in the |
|
Mandatory. The size of the Container drive to be created inside the Container, in kilobytes. If you use this option without specifying any value, the Container drive size will be set to 100 Mb. |
|
Optional. The name of the file to be created on the Node. Upon the command completion, this name will be visible as the name of the file in the |
Let us assume that you wish to create a new drive having the name of F:\ and the size of 50 Mb inside Container 101. Besides, you want the drive to be displayed as the MyVirtualDisk.efd file inside the C:\vz\private\101\ folder on the Hardware Node. To this effect, you should issue the following command on your Node:
vzctl partadd 101 --drive F:\ --size 51200 --file MyVirtualDisk
After the command execution, the newly created drive becomes visible as the C:\vz\root\101\F folder and the C:\vz\private\101\MyVirtualDisk.efd file on your Hardware Node. You can also log in to Container 101 via RDP and check (e.g. by launching Windows Explorer) that a new drive with the name of Local Disk (F:) is now available inside the Container. This drive has the size of 50 Mb and can be used as any other drive on a stand-alone server.
The vzctl partdel command is used to unmount the Container drive mounted by means of the vzctl partadd command from a file on the Hardware Node. It has the following syntax:
vzctl partdel CT_ID --drive CT_drive [--delete]
The command requires only the --drive option to be specified. However, you may also use the --delete option to remove the file from the X:\vz\private\CT_ID folder on the Node which, otherwise, remains intact.
For example, to unmount the F:\ drive that was mounted to Container 101 in the example above and delete the MyVirtualDisk file from the C:\vz\private\101 folder on the Node, you should execute the following command:
vzctl partdel 101 --drive F:\ --delete