Moving Mounted Hard Disk

Abstract3000

Member
Feb 21, 2019
23
1
8
43
Greetings,
I was hoping someone here might be able to assist me in a slight issue I'm having.

I have 2 VM's ID: 100 & ID: 105, both VM's are UEFI Windows 10 Installs with 128G Disk, Though I have an Additional HDD 1TB formatted LVM and Mounted to ID:100 for additional Space (Just Storage, No OS) I want to move this disk from ID:100 to ID:105, though I'm having troubles understanding how to go about this. I have been reading the Proxmox guide here but it seems to apply to the Disk with the OS on the Local drive, as when I look at /var/lib/vz/images/100 I only have files for what appears to be the 128G Disk on Local and the EFI Disk.

Here is the config file for ID:100
Code:
balloon: 4096
bios: ovmf
boot: dcn
bootdisk: virtio0
cores: 4
cpu: host
efidisk0: local:100/vm-100-disk-1.qcow2,size=128K
hostpci0: 09:00,x-vga=on,pcie=1
machine: q35
memory: 12288
name: Windows10
net0: virtio=46:09:45:C7:76:65,bridge=vmbr0
numa: 0
ostype: win10
sata0: local:iso/virtio-win-0.1.171.iso,media=cdrom,size=363020K
sata2: local:iso/Win10_1903_V2_English_x64.iso,media=cdrom,size=5243474K
scsihw: virtio-scsi-pci
smbios1: uuid=df76f911-2beb-4978-ae44-4fadb4d8587b
sockets: 1
usb0: host=5-3
usb1: host=5-4.1
usb3: host=1-3
usb4: host=5-2
virtio0: local:100/vm-100-disk-0.qcow2,cache=writeback,size=128G
virtio1: mameDrive:vm-100-disk-0,size=931G
vmgenid: f1c00a15-3822-4e6a-927d-9835e79f69f1

I want to simply move that virtio1: mameDrive:vm-100-disk-0,size=931G disk to ID:105 so it simply appears as an additional mounted drive as it currently does on ID:100, As mentioned this is an additional physical 1TB HDD formatted as LVM, then Mounted to ID:100 and further Formatted NTFS in Windows 10 and appears as an Additional HDD, this is not the Disk being used to boot off of, only storage. Any help as to how to proceed would be much appreciated :)

Thanks for your consideration!
 
What happens, Windows poweroff of course, detach the drive from 100 (becomes an unused disk), then trying re-attach it to 105 (From the hardware section)? This hoping the process is seamless and no need to lvrename (hopefully done automatically)? Otherwise, is as simple of detach the drive from the GUI, lvrename, then copy the parameters with the new name to 105.conf file.
 
Additionally, they maybe a residue of the old disk in 100.conf file, that might need to be removed. Etc.
 
What happens, Windows poweroff of course, detach the drive from 100 (becomes an unused disk), then trying re-attach it to 105 (From the hardware section)? This hoping the process is seamless and no need to lvrename (hopefully done automatically)? Otherwise, is as simple of detach the drive from the GUI, lvrename, then copy the parameters with the new name to 105.conf file.
If I detach the Drive on ID:100 Hardware Section it becomes "Unused Disk 0" at the bottom, The only Option I have from there is to "Remove" It in which IF I do will erase All Information, I don't want to do that.

When Trying to Add a Hard Disk in ID:105 with it detached in ID:100 if you select the volume it still wants you to state the Disk Size, there is no additional space ont he HDD as it has been formated for NTFS in the other Windows 10....
 
So If I got this correctly I "Detach" disk from ID:100

now in command line
Code:
 #lvdisplay
 
 --- Logical volume ---
  LV Path                /dev/Data-Storage/vm-100-disk-0
  LV Name                vm-100-disk-0
  VG Name                Data-Storage
  LV UUID                ezlsPB-8Rzr-HmPh-9jEF-gEps-Jp2N-Ne1DlX
  LV Write Access        read/write
  LV Creation host, time server, 2019-03-10 12:26:16 -0700
  LV Status              available
  # open                 0
  LV Size                931.00 GiB
  Current LE             238336
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

# lvs -o +lv_tags
  LV            VG           Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert LV Tags
  vm-100-disk-0 Data-Storage -wi-a----- 931.00g                                                     pve-vm-100

This tells me the directory is /dev/Data-Storage/vm-100-disk-0

So then I should do something like this:
Code:
# lvrename /dev/Data-Storage/vm-100-disk-0 /dev/Data-Storage/vm-105-disk-0

Then add the Following line to /etc/pve/qemu-server/105.conf

Code:
virtio1: mameDrive:vm-105-disk-0,size=931G

The only Question I have is that The tags for the drive would still remain "pve-vm-100" how do i update the tag?

Thanks!
 
idk wha tags you're referring to? man lvrename, it clearly states

Code:
lvrename VG LV_name NewName

So, in your case, that will be:

Code:
 lvrename Data-Storage vm-100-disk-0 vm-105-disk-0

As mentioned earlier, when you detach the drive, there will be residue of the drive in 100.conf. You might want to remove it.

P.S. AFAIK, PVE doesn't delete data from attached disks when you remove the drive from the VM, the drive is simply remove from the conf file and becomes available, could be wrong.
 
idk wha tags you're referring to? man lvrename, it clearly states

Code:
lvrename VG LV_name NewName

So, in your case, that will be:

Code:
 lvrename Data-Storage vm-100-disk-0 vm-105-disk-0

As mentioned earlier, when you detach the drive, there will be residue of the drive in 100.conf. You might want to remove it.

P.S. AFAIK, PVE doesn't delete data from attached disks when you remove the drive from the VM, the drive is simply remove from the conf file and becomes available, could be wrong.
Ok the only reason I'm questioning that is because on the Proxmox Wiki they give this example:

# lvrename pve/vm-400-disk-1 pve/vm-2300-disk-1
Renamed "vm-400-disk-1" to "vm-2300-disk-1" in volume group "pve"

I'm not trying to disagree with you by any means, just wondering if their is a specific proxmox page on the lvrename command that I could bookmark for reference :)

Thanks for all your replies! Much appreciated!
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!