Vdisk

From ISPWiki

Jump to: navigation, search

Transferring VPS among partitions

We modified the procedure on how to work with disk templates on VDSmanager under FreeBSD 8. Unionfs is no longer used. On FreeBSD 8 we use hard links to the template files. If a user attempts to edit this file, the hard link is removed, and the file template content is copied to the user's private disk. This allows to greatly increase file system efficiency, however some limits appeared. For example, if you wish to use several partitions to store the VPS's private disks (e.g. to distribute load), you will have to install the VPS templates on each partition.

Moving a VPS from one partition to another

Follow the instructions below (the VDS template is supposed to have been installed on two partitions with quota enabled).

  1. Create a directory for the VPS
  2. Select the VID (virtual disk id) vdisk alloc
  3. Set quota for this VID vdisk quota
  4. Copy the template files into this directory vdisk copypub
  5. Stop the VPS
  6. Copy the VPS private files into this directory vdisk copyvds
  7. Edit the path to the VPS private files in the VDSmanager config (the PrivateDisk parameter)
  8. Start the VPS

Example

Transfer the VPS from /vs/disk to /vs/disk2

Create a new disk. If it already existsб you can skip this step.

vdisk check /vs/disk2
vdisk enable /vs/disk2

Install the template on the new disk. If the template is already installed, you can skip this step.

mkdir /vs/disk2/pub
uptmp -N FreeBSD-8-minimal /vs/disk2/pub/FreeBSD-8-minimal

Copy the VPS 10.10.10.10 into the new disk (1000000 4096000 is the number of inode and quota in KB):

mkdir /vs/disk2/10.10.10.10
vdisk alloc /vs/disk2/10.10.10.10
vdisk quota /vs/disk2/10.10.10.10 1000000 4096000
vdisk copypub /vs/disk2/10.10.10.10 /vs/disk2/pub/FreeBSD-8-minimal
vdisk copyvds /vs/disk/10.10.10.10 /vs/disk2/10.10.10.10
Was this helpful? Yes | No
Personal tools