Re: Choosing the device name in kpartx.

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

 



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.

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel



[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux