How to attach drive to domU
From MyWiki
(Difference between revisions)
(Created page with 'Recently I needed to add an extra virtual drive to a running domU without downtime. '''Note:''' the domU name here is vm1 and the name of the virtual drive is <tt>vm1-data</tt>.…') |
m (Protected "How to attach drive to domU" ([edit=sysop] (indefinite) [move=sysop] (indefinite))) |
Current revision as of 14:50, 3 November 2009
Recently I needed to add an extra virtual drive to a running domU without downtime.
Note: the domU name here is vm1 and the name of the virtual drive is vm1-data. I use LV-based virtual drives for all the domU's, so the notation I use on the dom0 level is domU_name-partition_name_inside_domU.
Here is what I did.
Contents |
Create LV backed virtual drive
lvcreate -L14G -n extra-sw rootvg_dom0 mkfs.ext3 /dev/rootvg_dom0/extra-sw e2label /dev/rootvg_dom0/extra-sw /extra
List the existing virtual drives
[root@dom0 ~]# xm block-list vm1 Vdev BE handle state evt-ch ring-ref BE-path 51712 0 0 4 6 8 /local/domain/0/backend/vbd/17/51712 51728 0 0 4 7 9 /local/domain/0/backend/vbd/17/51728
Attach the new LV-based virtual drive
[root@dom0 ~]# xm block-attach vm1 phy:/dev/rootvg_dom0/extra-sw xvdc r
And now list the drives again to see that the attach operation worked as expected:
[root@dom0 ~]# xm block-list vm1 Vdev BE handle state evt-ch ring-ref BE-path 51712 0 0 4 6 8 /local/domain/0/backend/vbd/17/51712 51728 0 0 4 7 9 /local/domain/0/backend/vbd/17/51728 51744 0 0 4 9 971 /local/domain/0/backend/vbd/17/51744
Now inside the domU
Here is what I have in the /etc/fstab for the extra drive. Mind you, I was using e2label to label the new drive:
LABEL=/extra /extra ext3 defaults,ro 1 1
Now, I just mount it and get on with it:
[root@vm1 ~]# mount /extra