Adding Multiple Physical Disks to VM

ptmuldoon

Well-Known Member
Apr 28, 2012
36
2
48
I'm just getting started with all this virtualization stuff, but making some progress.

I installed ProxMox, and for my first VM installed Ubuntu Server.

Now, I'm trying to add a couple of Physical disks to the VM (to use as fileserver). There are drives sdb and sdc, and fdisk shows the following. Eventually, I'll move over 4 disk raid 5 setup, but just learning for now.

Code:
Disk /dev/sdb: 640.1 GB, 640135028736 bytes
255 heads, 63 sectors/track, 77825 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xe14d6285


   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               2       77825   625121280   83  Linux


Disk /dev/sdc: 640.1 GB, 640135028736 bytes
255 heads, 63 sectors/track, 77825 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b6d3f


   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1       77826   625130496   83  Linux

I followed the WIKI here, but can only seem to get 1 disk to show up.


http://pve.proxmox.com/wiki/FAQ#How_can_I_assign_a_physical_disk_to_a_VM.3F

I entered these two commands but get an 'unable to change media' when trying to add the 2nd drive
Code:
root@server1:~# qm set 100 -ide1 /dev/sdb1
root@server1:~# qm set 100 -ide2 /dev/sdc1
unable to change media type

Am I doing something in correct?
 
Last edited:
You are trying to assign physical disks to a VM?
You are aware of that any physical device you assign to a VM cannot be shared with the other VM's and host?
Also assigning physical devices to a VM means no migration and HA!
 
You are trying to assign physical disks to a VM?
You are aware of that any physical device you assign to a VM cannot be shared with the other VM's and host?
Also assigning physical devices to a VM means no migration and HA!

Actually, I did read you can share the physical disks with other Virtual Machines as long as they share the same file systems. I.e. a VM of Ubuntu Desktop and a VM of Ubuntu server should be able to share the same physical ext4 formatted disks. I also think I should be able to set up a Windows VM and than 'share' the disk via samba.

But all the above aside. How do you add more than 1 physical disk to a VM? I already have an existing Ubuntu Server setup with about 2TB of media in a mdadm raid 5 setup. And the raid drives are separate from the OS. I should be able setup a VM or Ubuntu Server and just move the raid array.

I am able to add the first disk of sdb and than mount and read the data on it. But I can't seem to mount the 2nd sdc hard drive.



I am new at proxmox and virtualization in general. So if there is a better way, I'd love to learn about it.
 
Actually, I did read you can share the physical disks with other Virtual Machines as long as they share the same file systems. I.e. a VM of Ubuntu Desktop and a VM of Ubuntu server should be able to share the same physical ext4 formatted disks. I also think I should be able to set up a Windows VM and than 'share' the disk via samba.
Do you have the references? This is new to me.
I am new at proxmox and virtualization in general. So if there is a better way, I'd love to learn about it.
I would strongly advice you not to assign physical disks on the host to VM's it sort of contradicts the hole idea of virtualization. If you require direct access to disks from VM's then your options are:
1) SAN mount (LUN or Multi Path) via fibre channel -> best, but most expensive
2) Dedicated file server via LAN (NFS, CIFS etc) -> OK. Can be cheap or costly depending on hardware
3) NAS box (QNAP or Synology are excellent choices) -> OK. Tend to be slow.
 
I maybe confused on being able to share a physical disk with VM's, but this is from the WIKI
Also see /etc/qemu-server/<vmid>.conf if you want to add it editing the conf file by hand (i.e. adding ide1: /dev/sdb2). After that you can run the VM as usual, and you will have the new storage device available inside it. Beware that you can't assign it to more than one running VM if the filesystem is not designed for such scenario.


Its reads IF
the filesystem is not designed for such scenario, so I took that to me it is possible.

But for my needs, I'm looking to move an existing NAS box / file server running Ubuntu Server on to ProxMox in a VM. Since I already have 4 disks configured via mdadm in raid 5 on another machine, shouldn't you be able move/add those disks to a VM?
 
You're right. However, MOST filesystems are not designed for such a scenarion ;) (well at least ext2/3/4, NTFS, FAT...)

In a home machine, I have a similar setup: proxmox physical host with a number of VMs. One VM is FreeNAS; it also has access to some physical disks.
These are the lines in <vmnumber>.conf:
Code:
ide1: /dev/sdb
ide2: /dev/sdc
I think I had to edit this item manually in the config, but it works and I let FreeNAS use them as software RAID.

Note: I noticed you're trying to assign partitions (such as /dev/sdb1) as disks to your VM. Seems a bit strange (doesn't your Linux RAID software need access to the entire disk, not just the partition?)
Try the VM command you entered without the 1, (e.g. /dev/sdb)... perhaps that works.
Otherwise you could try editing <vmnumber>.conf similar to how I did it above...
 
Last edited:

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!