LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Virtualization and Cloud (https://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/)
-   -   How can drive order be forced? (https://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/how-can-drive-order-be-forced-4175415127/)

PeterSteele 07-05-2012 05:18 PM

How can drive order be forced?
 
I want to create a VM that is "bound" (for lack of a better word) to a given physical drive. I want to partition the physical drive into three slices, one for the core OS, one for swap, and the rest for data. So for example, I might have something like this:

/dev/sda1 --8GB root partition
/dev/sda2 --10GB swap partition
/dev/sda3 --data partition spanning the rest of the drive space

When I tried this, I used the following virt-install command to define the mapping:

virt-install --disk path=/dev/sda1 --disk path=/dev/sda2 --disk path=/dev/sda3 ...

My intent was to have /dev/sda1 be mapped to /dev/vda on my VM, and /dev/sda2 to be mapped to /dev/vdb, and /dev/sda3 to be mapped to /dev/vdc. However, what I got was the first two mappings reversed--sda1 was mapped to vdb and sda2 was mapped to vda.

So my question is how can I guarantee the drive mapping will be in a specific order? I didn't see anything in the drive options to specify an id or anything like that.

jefro 07-06-2012 03:18 PM

This has been here for a few days so leeme ask some questions.

You are trying to boot to some OS and then use that mounted partition to then run a VM? Not sure how you even got it to boot at all. I would have thought the command ought to be -disk path=/dev/hdc \

I think you are trying to use a virtio block device. http://www.linux-kvm.org/page/Boot_f...o_block_device

Just to get post some action really is all I an saying.

PeterSteele 07-06-2012 07:40 PM

I have in fact used the option "-disk path=/dev/sdX" where sdX is some free drive on my system. That works fine. This gives me a single virtual drive under my VM /named /dev/vda. If I use "-disk path=/dev/sdX1 -disk path=/dev/sdX2 -disk path=/dev/sdX3" where I first partition my drive into specific slices, that also works fine and the VM sees three virtual drives named /dev/vda through /dev/vdc. The problem was that it seemed that the drive order did not map directly to what I gave on the command line. However, I've done some additional tests today and I believe I may have been incorrect about that. In a second test at least the virtual drive order matched. I have to do some more tests to see exactly what's going on.


All times are GMT -5. The time now is 02:10 AM.