All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Weekes <lists.xen@nuclearfallout.net>
To: xen-devel@lists.xensource.com
Subject: Re: Mounting filesystems with blktap2
Date: Fri, 17 Feb 2012 23:12:03 -0800	[thread overview]
Message-ID: <4F3F4F43.5050107@nuclearfallout.net> (raw)
In-Reply-To: <CAMrHX2WFfn5f-nS75aP1mx9UGQkUQjet=f3YjQhrVMdiWft9Sg@mail.gmail.com>

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

      reply	other threads:[~2012-02-18  7:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-18  5:54 Mounting filesystems with blktap2 Matthew Hook
2012-02-18  7:12 ` John Weekes [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F3F4F43.5050107@nuclearfallout.net \
    --to=lists.xen@nuclearfallout.net \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.