I've made a TrueOS VM in VirtualBox, using a vmdk that virtualises a physical harddisk partition (sda5) as a complete disk. As a result, I now have a GPT/GUID partition table on that sda5 partition (sda has a GPT/GUID partition table itself).

I can see that partition table when I create a loopback device (losetup /dev/sda5 /dev/loop0) on the host but I haven't yet figured out how to create the /dev/loop0p1, /dev/loop0p2 etc. devices in order to mount the partitions on /dev/loop0.

Is this possible? Could it be related to the max_part parameter of the loop device module? FWIW, the loop module is built into my kernel, and /sys/module/loop/parameters/max_part returns 0 ... can I change that value without rebooting?

1 Answer 1

kpartx -a /dev/loop0

should create the partition devices for you.

Note: the partition devices will be /dev/mapper/loop0p1 etc.

  • Forgot to mention... I recalled kpartx from the past, but when I didn't find it on my current system I assumed it had gone irrelevant for 4.x kernels. Wrongly so, it indeed does the trick. Thanks!
    – RJVB
    May 20, 2018 at 13:09

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.