6

I read the man pages on both, and they seems to be interchangeable and to be doing the same job.

So can someone explain when I should use partx, and when kpartx ?

6

partx asks the kernel to probe a given device and re-read the partition table. The kernel is doing the work here.

kpartx creates device mapper entries and so can be used by devices that the kernel does not natively support partitioning, such as multipath device mapper devices ("kpartx" is part of multipath-tools) or files.

0

I think they are pretty much the same, but kpartx only deals with disk images while partx also allows you to map partitions within a block device.

  • Notice that the kernel does support partitions on loop devices without necessarily using kpartx / device-mapper. Either losetup -P or partx -a /dev/loop0 are able to give you access to partitions on a loop device (disk image). – sourcejedi May 4 '18 at 14:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.