Add Comment

You are not currently logged in. If you do not have a user account then please consider creating one and logging in before you post your comment. This will allow you to track replies to your comment, and take part in the site much more freely.

To add your comment, fill in all the boxes below and then preview it to make sure you're happy with the way that it looks.

This is the comment you were replying to, attached to the weblog Xen: how do i alert a domU to an lvresize on dom0?


Re: Xen: how do i alert a domU to an lvresize on dom0?
Posted by dkg (216.254.xx.xx) on Wed 20 Jun 2007 at 04:15
After a bit more research and testing, i've gotten further than i thought i would. I can now get an updated size of the block device in the domU as long as the block device isn't currently in use (e.g. mounted, swapping, etc). This is done using the /usr/sbin/xm block-* commands. Basically, just detach and reattach the block device:
0 domU:~# grep sda3 /proc/partitions 
   8     3    2097152 sda3
0 domU:~#
0 dom0:~# lvresize --size +1G vg0/domU-srv
  Extending logical volume domU-srv to 3.00 GB
  Logical volume domU-srv successfully resized
0 dom0:~# xm block-list domU
Vdev  BE handle state evt-ch ring-ref BE-path
2049    0    0     4      6      8     /local/domain/0/backend/vbd/11/2049  
2050    0    0     4      7      9     /local/domain/0/backend/vbd/11/2050  
2051    0    0     4      9      619   /local/domain/0/backend/vbd/11/2051  
0 dom0:~# xm block-detach domU 2051
0 dom0:~# xm block-attach domU phy:vg0/domU-srv /dev/sda3 w
0 dom0:~# 
0 domU:~# grep sda3 /proc/partitions 
   8     3    3145728 sda3
0 domU:~# 
Unfortunately, if i have the block device mounted in the domU, and i try this, the block-detach command claims to work on the dom0, but the block-list shows otherwise:
0 dom0:~# xm block-list domU
Vdev  BE handle state evt-ch ring-ref BE-path
2049    0    0     4      6      8     /local/domain/0/backend/vbd/11/2049  
2050    0    0     4      7      9     /local/domain/0/backend/vbd/11/2050  
2051    0    0     4      9      760   /local/domain/0/backend/vbd/11/2051  
0 dom0:~# xm block-detach domU 2051
0 dom0:~# xm block-list domU
Vdev  BE handle state evt-ch ring-ref BE-path
2049    0    0     4      6      8     /local/domain/0/backend/vbd/11/2049  
2050    0    0     4      7      9     /local/domain/0/backend/vbd/11/2050  
2051    0    0     4      9      760   /local/domain/0/backend/vbd/11/2051  
0 dom0:~# 
when i did that block-detach, this message spewed on the console of the domU as well:
vbd vbd-2051: 16 Device in use; refusing to close
Once i unmount the filesystem, it appears to actually cause the underlying device to be released:
0 domU:~# umount /dev/sda3
0 domU:~# 
0 dom0:~# xm block-list domU
Vdev  BE handle state evt-ch ring-ref BE-path
2049    0    0     4      6      8     /local/domain/0/backend/vbd/11/2049  
2050    0    0     4      7      9     /local/domain/0/backend/vbd/11/2050  
0 dom0:~# 
So, i'm most of the way there. i could do it without a reboot, as long as the block device is not mounted within the domU. But what i really want is what Steve assumed i wanted from the beginning: i want to resize the underlying block device while a filesystem on it is mounted within the domU, and i haven't figured out how to do that yet. Any other suggestions?

Username:Anonymous
Title:
Your Comment:

Posting Format:

 

Inappropriate comments will be removed.

Some help on entry formatting is available

User Login

Username:

Password:

[ Advanced Login ]

Register Account

Quick Site Search