move VM to secound hard

  • Thread starter Thread starter zitanix
  • Start date Start date
Z

zitanix

Guest
Hi
my server have 2 Hard Disk
can i move a vps from first hard disk to secound hard disk ?
 
Hi
my server have 2 Hard Disk
can i move a vps from first hard disk to secound hard disk ?

do you talk about a container or a KVM guest?
 
im eaxtly mean
move vps from first hard disk to secound hard disk
 
Last edited by a moderator:
im eaxtly mean
move vps from first hard disk to secound hard disk

Hi,
you can do that - but only with handwork.
First, how are you use your second harddisk? If you mount the filesystem on /var/data then you can add a second storage (this can be done at the web-frontend):
Code:
/etc/pve/storage.cfg:
dir: local2
    path /var/data
    content images
after that, you can move your harddisk-files:
Code:
mv /var/lib/vz/images/110 /var/data/images/
now it's time to change the config:
Code:
/etc/qemu-server/110.cfg
ide0: local2:110/vm-110-disk-1.raw

Now you can start your vm - but please take a backup before!

Udo
 
Hi,
you can do that - but only with handwork.
First, how are you use your second harddisk? If you mount the filesystem on /var/data then you can add a second storage (this can be done at the web-frontend):
Code:
/etc/pve/storage.cfg:
dir: local2
    path /var/data
    content images
after that, you can move your harddisk-files:
Code:
mv /var/lib/vz/images/110 /var/data/images/
now it's time to change the config:
Code:
/etc/qemu-server/110.cfg
ide0: local2:110/vm-110-disk-1.raw
Now you can start your vm - but please take a backup before!

Udo
thanks for reply
this is my config , disk 2 are lvm partition and added and used in proxmox

Code:
/etc/pve/storage.cfg
dir: local
        path /var/lib/vz
        content images,iso,vztmpl,rootdir

lvm: disk2
        vgname second-hdd
        content images
i dont know where exact directory or path of disk2
 
Last edited by a moderator:
Hi,
in this case you use the second hdd as local lvm-strorage. Add in the VM a disk on this storage (same size as on the local storage).
With
Code:
lvdisplay
you will see the disk as a logical volume e.g.
Code:
/dev/second-hdd/vm-110-disk-1

If you use already the raw-format for the diskimage you can copy the image directly. If you use qcow2, you must convert it first to raw.
To copy a raw partition:
Code:
dd if=/var/lib/vz/images/110/vm-110-disk-1.raw of=/dev/second-hdd/vm-110-disk-1 bs=1024k
After that change the config, that ide0 (or virtio0) is now on the second storage - you have the line due to adding a second HD in the conffile - and delete the old entry. For more than one disk, you must repeat the steps.

To convert qcow2-file use qemu-img

Hope that helps

Udo
 
That can't be done, because I get "You have no write access". When I add it manually using shell entry will appear in webinterface for a couple of seconds but then it disappers. And how that storrage will be used? When I have 2 disks with 40 GB then I simply can create a VZ with 80 GB and both disks will be used?
 
That can't be done, because I get "You have no write access". When I add it manually using shell entry will appear in webinterface for a couple of seconds but then it disappers.

You obviously have a cluster, and try to edit the storage configuration on the node. Please edit the storage configuration on the master - it will be synced to all nodes.