[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Mounting filesystems with blktap2



On 2/17/2012 9:54 PM, Matthew Hook wrote:
For those wanting to know how to mount filesystems through blktap2
here is how you do it, as I couldn't find it fully documented.
The instructions on the blktap2 readme file are rather out of date.


You can mount them under Dom0 like so.

e.g. to mount a vhd file,
sudo xm block-attach 0 tap2:vhd:/home/xen/xenwin7-persist.vhd  xvdb w 0

Now the device should appear under /dev

ls /dev/xvdb*
/dev/xvdb  /dev/xvdb1  /dev/xvdb2

sudo mount /dev/xvdb2 /mnt

Mounts the first partition on xvdb to the path /mnt

You can also mount with tap-ctl and kpartx, but it's a little more complicated:

# tap-ctl allocate
/dev/xen/blktap-2/tapdev7
# tap-ctl spawn
tapdisk spawned with pid 28746
# tap-ctl attach -p 28746 -m 7
# tap-ctl open -p 28746 -m 7 -a aio:/somewhere/some_example_image.img
# kpartx -a /dev/xen/blktap-2/tapdev7
# ls /dev/mapper/tapdev7*
/dev/mapper/tapdev7p1  /dev/mapper/tapdev7p2
# mount /dev/mapper/tapdev7p1 /mnt
# umount /mnt
# kpartx -d /dev/mapper/tapdev7p1
# tap-ctl close -p 28746 -m 7
# tap-ctl detach -p 28746 -m 7
# tap-ctl free -m 7

(Is this a better way? I don't actually know.)

Note that when using the tap-ctl method in scripts, I've found that it's important to intersperse "sync" commands and slight timeouts before umount/kpart -d/tap-ctl close, as otherwise you will sometimes end up with the tapdisk2 process hung in an uninterruptible disk sleep and unable to be queried (causing havoc when it comes to trying to trying to view the process list). At least, under 4.1.

-John

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.