Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ======================
- step 1: new vm to fill
- ======================
- in proxmox gui:
- -create new vm with a 1GB disk
- -set things up however you like (choose bridge, network, ram, etc.)
- -this means it has a new MAC address
- ======================
- step 2: copy the files
- ======================
- in the proxmox host, command line:
- # This should match the file from your old vm. The default proxmox is not "disk#.img".
- oldvmdisk=/mnt/mynas/images/100/disk1.img
- # This should match the new file created in step 1.
- newvmdisk=/mnt/mynas/images/101/disk1.img
- qemu-img convert -O raw -p "$oldvmdisk" "$newvmdisk"
- ======================
- step 3: update the vm OS configuration
- ======================
- ---------------
- option A) without rebooting the VM
- ---------------
- in the proxmox host, command line:
- losetup /dev/loop5 "$newvmdisk"
- kpartx -a /dev/loop5
- lsblk (figure out which dm-# device is right)
- dmdevice=dm-5
- mkdir /mnt/newvm
- mount /dev/"$dmdevice" /mnt/newvm
- vim /mnt/newvm/etc/network/interfaces
- (change IP)
- vim /etc/udev/rules.d/70-persistent-net.rules
- (delete or comment all lines)
- umount /mnt/newvm ; kpartx -d /dev/loop5 ; losetup -d /dev/loop5
- ---------------
- option B) with rebooting
- ---------------
- in the proxmox host:
- -Remove the vm from the bridge, so it has a NIC, but not a network. If you can't figure out how, just remove the whole network device.
- -Start the vm
- run the commands in the VM:
- vim /mnt/newvm/etc/network/interfaces
- (change IP)
- vim /etc/udev/rules.d/70-persistent-net.rules
- (delete or comment all lines)
- shutdown -h now
- Stop vm (not restart)
- in the proxmox host:
- -Add back the bridge or network device.
- ======================
- step 4: start it and test it
- ======================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement