All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Bryn M. Reeves" <bmr@redhat.com>
To: Andre Caldas <andre.em.caldas@gmail.com>
Cc: dm-devel@redhat.com
Subject: Re: Choosing the device name in kpartx.
Date: Mon, 3 Oct 2016 07:59:41 +0100	[thread overview]
Message-ID: <20161003065940.GA3480@localhost.localdomain> (raw)
In-Reply-To: <CADVh14WfxhnCj8Mok1iq-KXJ7hYOBF0rUBQboVdxfGT=Zdq6Tw@mail.gmail.com>

On Sun, Oct 02, 2016 at 02:10:50AM -0300, Andre Caldas wrote:
> As I understood it, when I call
> $ kpartx -a disk.img
> kpartx chooses a "device name" X, detects the partitions and their
> numbers N, and creates device nodes with naming
> XpN.

This command performs several steps for you. You can have greater
control by issuing those steps yourself:

1. Create a loop device mapping the image (/dev/loopN)
2. Create a device-mapper device with a linear map of the loop:

   # dmsetup create $DEV_NAME --table="0 $DEV_SIZE linear /dev/loopN"

   This allows you to give any DEV_NAME you like to the device (with
   the default kpartx behaviour, the partitions just map the loop
   device, so have names like 'loop0p1' etc.).

3. Map partitions on the new dm device with kpartx:

   # kpartx -a /dev/mapper/$DEV_NAME

See the kpartx man page for options to fine-tune the partition device
names.

The dmsetup command has lots of options to control the output format
that can be used to get readily parseable data.

Regards,
Bryn.

  reply	other threads:[~2016-10-03  6:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-02  5:10 Choosing the device name in kpartx Andre Caldas
2016-10-03  6:59 ` Bryn M. Reeves [this message]
2016-10-03 11:35   ` Andre Caldas
2016-10-03 11:48   ` Bryn M. Reeves

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=20161003065940.GA3480@localhost.localdomain \
    --to=bmr@redhat.com \
    --cc=andre.em.caldas@gmail.com \
    --cc=dm-devel@redhat.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.