All of lore.kernel.org
 help / color / mirror / Atom feed
* Mounting filesystems with blktap2
@ 2012-02-18  5:54 Matthew Hook
  2012-02-18  7:12 ` John Weekes
  0 siblings, 1 reply; 2+ messages in thread
From: Matthew Hook @ 2012-02-18  5:54 UTC (permalink / raw)
  To: xen-devel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Mounting filesystems with blktap2
  2012-02-18  5:54 Mounting filesystems with blktap2 Matthew Hook
@ 2012-02-18  7:12 ` John Weekes
  0 siblings, 0 replies; 2+ messages in thread
From: John Weekes @ 2012-02-18  7:12 UTC (permalink / raw)
  To: xen-devel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-02-18  7:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-18  5:54 Mounting filesystems with blktap2 Matthew Hook
2012-02-18  7:12 ` John Weekes

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.